added the method tryMove and the methods used by it into serverstate

This commit is contained in:
Hanno Fleischer
2024-11-17 17:52:25 +01:00
parent 9662e1f684
commit 90fb6e4133
4 changed files with 174 additions and 1 deletions

View File

@@ -57,4 +57,13 @@ public Node[] getInfield() {
public void setPieceOnBoard(int index, Piece piece) {
infield[index].setOccupant(piece);
}
public int getInfieldIndexOfPiece(Piece piece) {
for (int i = 0; i < infield.length; i++) {
if (infield[i].getOccupant() == piece) {
return i;
}
}
return -1;
}
}