/// <summary> /// Returns a SabberStoneAction for the current state. /// Note: If this player has no available options, null is returned. /// </summary> /// <param name="state">The current game state.</param> /// <returns>SabberStoneAction or null in the case of no available options.</returns> public SabberStoneAction Act(SabberStoneState state) { // Check to make sure the player to act in the game-state matches our player. if (state.CurrentPlayer() != Player.Id) { return(null); } // Check if there are any options, otherwise return a randomly created action. return(Player.Options().IsNullOrEmpty() ? SabberStoneAction.CreateNullMove(Player) : CreateRandomAction(state)); }
/// <inheritdoc /> public SabberStoneAction Sample(SabberStoneState state) { return(SabberStoneAction.CreateNullMove(state.CurrentPlayer() == state.Player1.Id ? state.Player1 : state.Player2)); }