package class7_3_Command_021_inClass_start; import javafx.scene.control.Alert; public class MoveCommand implements Command { private Controller controller; private int x; private int y; private char whoseTurn; public MoveCommand(Controller controller, int x, int y) { this.controller = controller; this.x = x; this.y = y; } @Override public void execute() { whoseTurn = controller.getWhoseTurn(); controller.getButton(x,y).setText(""+whoseTurn); boolean isWin = false; isWin |= controller.checkRow(y); isWin |= controller.checkColumn(x); // isWin |= checkDiagonals(x, y); Not yet implemented... and not part of quiz! if(isWin) { Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setHeaderText("Player "+controller.getWhoseTurn()+" has won!"); alert.showAndWait(); } controller.updateTurn(); } @Override public void unexecute() { controller.getButton(x,y).setText(""); controller.setWhoseTurn(whoseTurn); } }