Exemple #1
0
        private void NewGame(Player firstPlayer, Player secondPlayer, int difficulty)
        {
            _game.NewGame();
            _game.Difficulty = difficulty;

            _players[0] = firstPlayer;
            _players[1] = secondPlayer;

            _players[0].Name = _players[0].ColorPlayer == 1 ? "Black" : "White";
            _players[1].Name = _players[1].ColorPlayer == 1 ? "Black" : "White";

            for (int i = 0; i < 8; i++)
            {
                for (int j = 0; j < 8; j++)
                {
                    tabPictureBox[i, j].Image = Resources.Background;
                }
            }

            switch (_game.Difficulty)
            {
            case 1:
                levelPic.Image = Resources.LevelEasy;
                break;

            case 2:
                levelPic.Image = Resources.LevelMedium;
                break;

            case 3:
                levelPic.Image = Resources.LevelHard;
                break;
            }

            if (_players[0].GetType() == typeof(AIPlayer))
            {
                levelPic.Top = tbPlayer1.Top - 2;
            }
            else
            {
                levelPic.Top = tbPlayer2.Top - 2;
            }

            lbPastHistory.Items.Clear();

            DrawBoard();
        }
 /// <summary>
 /// Reset the game.
 /// </summary>
 private void NewGame()
 {
     game.NewGame();
     DrawBoard();
 }