/// <summary>
 /// Constructor
 /// </summary>
 /// <param name="player1"></param>
 /// <param name="player2"></param>
 /// <param name="gameLogic"></param>
 public TicTacToeBoard(Player player1, Player player2, TicTacToeLogic gameLogic)
 {
     this.player1 = player1;
     this.player2 = player2;
     this.gameLogic = gameLogic;
 }
Esempio n. 2
0
        /// <summary>
        /// Form load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmOnePlayer_Load(object sender, EventArgs e)
        {
            String[] users = new String[2];
            users[0] = "You";
            users[1] = "Computer";

            Random rand = new Random();
            int random_index = rand.Next(1);
            humanPlayer = new Player(users[random_index]);
            random_index = ( random_index == 1 ? 0 : 1 );
            computerPlayer = new Player(users[random_index]);
            gameLogic = new TicTacToeLogic();
            gameBoard = new TicTacToeBoard(humanPlayer, computerPlayer, gameLogic);
        }