@FXML public void markerChoice(ActionEvent event) { hboxMarkerChoice.setVisible(false); hboxCoinFlip.setVisible(true); btnCoinFlip.setDisable(true); if (event.getSource().equals(btnMarkerX)) { player.setPlayerMarker("X"); computer.setComputerMarker("O"); } else { player.setPlayerMarker("O"); computer.setComputerMarker("X"); } }
public void playerTurn(MouseEvent event) { int spot = -1; String playerMarker = player.getPlayerMarker(); if (event.getSource().equals(lblSpot1)) { lblSpot1.setText(playerMarker); spot = 0; lblSpot1.setDisable(true); } else if (event.getSource() == lblSpot2) { lblSpot2.setText(playerMarker); spot = 1; lblSpot2.setDisable(true); } else if (event.getSource() == lblSpot3) { lblSpot3.setText(playerMarker); spot = 2; lblSpot3.setDisable(true); } else if (event.getSource() == lblSpot4) { lblSpot4.setText(playerMarker); spot = 3; lblSpot4.setDisable(true); } else if (event.getSource() == lblSpot5) { lblSpot5.setText(playerMarker); spot = 4; lblSpot5.setDisable(true); } else if (event.getSource() == lblSpot6) { lblSpot6.setText(playerMarker); spot = 5; lblSpot6.setDisable(true); } else if (event.getSource() == lblSpot7) { lblSpot7.setText(playerMarker); spot = 6; lblSpot7.setDisable(true); } else if (event.getSource() == lblSpot8) { lblSpot8.setText(playerMarker); spot = 7; lblSpot8.setDisable(true); } else if (event.getSource() == lblSpot9) { lblSpot9.setText(playerMarker); spot = 8; lblSpot9.setDisable(true); } playboard.placeMarker(spot, playerInternalMarker); playboard.showBoardStatus(); if (playboard.checkForWin(playerInternalMarker)) { endGame("Human"); } else { computerMove(false); } }