You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
726 B

public class Move {
//source and dest coordinates
int startIndex;
int destIndex;
public Move(int startIndex, int destIndex) {
this.startIndex = startIndex;
this.destIndex = destIndex;
}
public Move(int sourceRow, int sourceColumn, int destinationRow, int destinationColumn) {
//TODO
}
public int getSourceRow() {
return startIndex / 12 - 2;
}
public int getSourceCol() {
return startIndex % 12 - 2;
}
public int getDestRow() {
return destIndex / 12 - 2;
}
public int getDestCol() {
return destIndex % 12 - 2;
}
//returns something like e2-e4 or Qc8++
public String toString() {
return "("+getSourceRow()+","+getSourceCol() + ") -> " + "("+getDestRow()+","+getDestCol() + ")";
}
}