public int GetMove(int playerScore) { diceController.SelectSelectable(); // Returns 1 for roll, 2 for bank, 3 for player handover. // The AI rolls the dice, selects all score giving dice, and banks // whenever it reaches a score above a set threshold (1000 for the first throw in // accordance with the rules). if (diceController.CanBank(playerScore) && diceController.GetHandScore() >= bankThreshold) { return(2); } if (diceController.FailedThrow()) { return(3); } return(1); }
private void ButtonControl() { // Exit to menu has highest priority: if (userInterface.GetMenuPressed()) { userInterface.ResetMenuButton(); ExitGame(); } // If it is the AI´s turn, disable the playbuttons, // otherwise enable the appropriate buttons for the player: if (Parameters.AIPlaying) { userInterface.buttons.DisableRoll(); userInterface.buttons.DisableBank(); } else { if (diceController.CanRoll()) { userInterface.buttons.EnableRoll(); } else { userInterface.buttons.DisableRoll(); } if (diceController.CanBank(playerScore[currentPlayer])) { userInterface.buttons.EnableBank(); } else { userInterface.buttons.DisableBank(); } } }