public TicTacToeConsoleRunner(Board board, TicTacToeBoardDrawer ticTacToeBoardDrawer, ConsoleIO consoleIO,
     Player player1, Player player2)
 {
     this.board = board;
     this.ticTacToeBoardDrawer = ticTacToeBoardDrawer;
     this.consoleIO = consoleIO;
     Players = new Player[2] { player1, player2 };
     this.State = new AskingForPlayerState(this);
 }
Esempio n. 2
0
        static void Main(string[] args)
        {
            var ticTacToeBoardDrawer = new TicTacToeBoardDrawer();
            var consoleIO = new ConsoleIO();
            var board = new Board();

            var strategies = new List<TicTacToeStrategy>
            {
                new WinStrategy('O', 'X'),
                new BlockStrategy('O', 'X'),
                new ForkStrategy('O', 'X'),
                new BlockForkStrategy('O', 'X'),
                new CenterStrategy('O', 'X'),
                new OppositeCornerStrategy('O', 'X'),
                new FreeCornerStrategy('O', 'X'),
                new FreeSideStrategy('O', 'X')
            };

            var ticTacToeConsoleRunner = new TicTacToeConsoleRunner(board, ticTacToeBoardDrawer,
                consoleIO, new AIPlayer(consoleIO, strategies, 'O'), new HumanPlayer(consoleIO, 'X'));

            ticTacToeConsoleRunner.Run();
        }