Exemplo n.º 1
0
        public void InitiateGameResources()
        {
            _squares = new GameSquare[3][];
            for (int i = 0; i < 3; i++)
            {
                _squares[i] = new GameSquare[3];
                for (int j = 0; j < 3; j++)
                {
                    _squares[i][j] = new GameSquare();
                }
            }

            _board = new GameBoard(_squares);

            _playerOne = new GamePlayer("Alice");

            _players = new List <IGamePlayer>()
            {
                _playerOne,
                new GamePlayer("Bob")
            };
            var playerOneToken = NoughtCrossToken.X;

            _victoryCalculator = new GameVictoryCalculator(GameWinStates.GetStates());
            _Game = new GameEngine(_players, _board, _playerOne.Id, playerOneToken, _victoryCalculator);
            _playerOne.SetPlayerToken(playerOneToken);
        }
Exemplo n.º 2
0
 public void InitiateBoardResources()
 {
     _squares = new GameSquare[3][];
     for (int i = 0; i < 3; i++)
     {
         _squares[i] = new GameSquare[3];
         for (int j = 0; j < 3; j++)
         {
             _squares[i][j] = new GameSquare();
         }
     }
     _victoryCalculator = new GameVictoryCalculator(GameWinStates.GetStates());
 }
        public ConsoleGameBuilder(IConsoleUI ui) : base(ui)
        {
            ui.DisplayStartScreen();
            bool startGame = false;

            while (startGame == false)
            {
                startGame = ui.DisplayReadyScreen();
            }
            List <IGamePlayer> players = ui.DisplayEnterPlayersScreen();
            NoughtCrossToken   token   = ui.DisplayEnterPlayerOneTokenScreen();

            IGameSquare[][] squares = new GameSquare[3][];
            for (int i = 0; i < 3; i++)
            {
                squares[i] = new GameSquare[3];
                for (int j = 0; j < 3; j++)
                {
                    squares[i][j] = new GameSquare();
                }
            }
            IGameBoard board = new GameBoard(squares);

            _gameEngine = new GameEngine(players, board, players[0].Id, token, new GameVictoryCalculator(GameWinStates.GetStates()));
        }