public bool move(int fromColumn, int fromRow, int toColumn, int toRow) { bool isMovePossible = chessboardArray[fromRow, fromColumn].isMovePossible(toRow, toColumn); if (isMovePossible) { if (chessboardArray[toRow, toColumn].GetType().Name == "King") { lastTeam = Team.NONE; } chessboardArray[toRow, toColumn] = chessboardArray[fromRow, fromColumn]; chessboardArray[fromRow, fromColumn] = new Pieces(fromRow, fromColumn, Team.NONE, rule); chessboardArray[toRow, toColumn].setX(toColumn); chessboardArray[toRow, toColumn].setY(toRow); changeTeam(); } return(isMovePossible); }
public void createUnit(Pieces chessUnit) { chessboardArray[chessUnit.getY(), chessUnit.getX()] = chessUnit; }
public Boolean sameTeam(Pieces piece1, Pieces piece2) { return(piece1.getTeam() == piece2.getTeam()); }
public Boolean isOppositeTeam(Pieces piece1, Pieces piece2) { return((piece1.getTeam() == Team.BLACK && piece2.getTeam() == Team.WHITE) || (piece1.getTeam() == Team.WHITE && piece2.getTeam() == Team.BLACK)); }
public bool isTeamsTurn(Pieces piece) { return(piece.getTeam() != Team.NONE && piece.getTeam() != lastTeam); }