Exemple #1
0
    /// <summary>
    /// Starts a game with the given player taking the
    /// first turn
    /// </summary>
    /// <param name="firstPlayer">player taking first turn</param>
    /// <param name="player1Difficulty">difficulty for player 1</param>
    /// <param name="player2Difficulty">difficulty for player 2</param>
    void StartGame(PlayerName firstPlayer, Difficulty player1Difficulty,
                   Difficulty player2Difficulty)
    {
        // set player difficulties
        player1.Difficulty = player1Difficulty;
        player2.Difficulty = player2Difficulty;

        // create new board
        board.CreateNewBoard();
        takeTurnEvent.Invoke(firstPlayer, board.Configuration);
    }
    /// <summary>
    /// Starts a game with the given player taking the
    /// first turn
    /// </summary>
    /// <param name="firstPlayer">player taking first turn</param>
    /// <param name="player1Difficulty">difficulty for player 1</param>
    /// <param name="player2Difficulty">difficulty for player 2</param>
    void StartGame(PlayerName firstPlayer, Difficulties difficulties)
    {
        gameCounter++;

        // set player difficulties
        player1.Difficulty = difficulties.DifficultyP1;
        player2.Difficulty = difficulties.DifficultyP2;

        // create new board
        board.CreateNewBoard();

        // take the current turn
        takeTurnEvent.Invoke(firstPlayer,
                             board.Configuration);
    }
    /// <summary>
    /// Starts a game with the given player taking the
    /// first turn
    /// </summary>
    /// <param name="firstPlayer">player taking first turn</param>
    void StartGame(PlayerName firstPlayer)
    {
        // Change difficulty if 100 games have been played
        if (gamesPlayed % 100 == 0)
        {
            SwitchDifficulty(gamesPlayed / 100);
        }
        gamesPlayed++;

        // Invoke game start event
        gameStartEvent.Invoke();

        // set player difficulties
        player1.Difficulty = player1Diff;
        player2.Difficulty = player2Diff;

        // create new board
        board.CreateNewBoard();
        takeTurnEvent.Invoke(firstPlayer,
                             board.Configuration);
    }