public void DetectNull()
        {
            var tokenA = new Token(0, 'x');
            var tokenB = new Token(1, 'y');

            var state = new Connect4State(2, 2, tokenA, tokenB);

            state.PlayMove(new Connect4Move()
                {
                    Token = tokenA,
                    X = 0
                }
            );

            Assert.IsFalse(state.IsGameOver());

            state.PlayMove(new Connect4Move()
                {
                    Token = tokenA,
                    X = 0
                }
            );

            Assert.IsFalse(state.IsGameOver());

            state.PlayMove(new Connect4Move()
                {
                    Token = tokenA,
                    X = 1
                }
            );

            Assert.IsFalse(state.IsGameOver());

            state.PlayMove(new Connect4Move()
                {
                    Token = tokenA,
                    X = 1
                }
            );

            Assert.IsTrue(state.IsGameOver());
        }
        public static IGame GetGame(GameType gameType)
        {
            IGame game = null;

            switch (gameType)
            {
                case GameType.TicTacToe:

                    IPlayer humanPlayer = PlayerFactory.GetHumanPlayer(GameType.TicTacToe, 0);
                    IPlayer iaPlayer = PlayerFactory.GetAiPlayer(GameType.TicTacToe, 1, 4);
                    var gameBoard = new OptimizeGameBoard(4, 4, humanPlayer.Token, iaPlayer.Token);

                    IState initialState = new TicTacTocState(gameBoard);

                    game = new GameManager2P()
                    {
                        GameState = initialState,
                        PlayerA = humanPlayer,
                        PlayerB = iaPlayer
                    };

                    break;

                case GameType.Connect4:
                    humanPlayer = PlayerFactory.GetHumanPlayer(GameType.Connect4, 0);
                    iaPlayer = PlayerFactory.GetAiPlayer(GameType.Connect4, 1, 6);
                    gameBoard = new OptimizeGameBoard(5, 4, humanPlayer.Token, iaPlayer.Token);

                    initialState = new Connect4State(gameBoard);

                    game = new GameManager2P()
                    {
                        GameState = initialState,
                        PlayerA = humanPlayer,
                        PlayerB = iaPlayer
                    };
                    break;
            }

            return game;
        }
        public void Detect_Diagonale1()
        {
            var tokenA = new Token(0, 'x');
            var tokenB = new Token(1, 'y');

            var state = new Connect4State(7, 6, tokenA, tokenB);

            state.PlayMove(new Connect4Move()
            {
                Token = tokenA,
                X = 0
            }
            );

            Assert.IsFalse(state.IsGameOver());

            state.PlayMove(new Connect4Move()
            {
                Token = tokenB,
                X = 1
            }
            );

            Assert.IsFalse(state.IsGameOver());

            state.PlayMove(new Connect4Move()
            {
                Token = tokenA,
                X = 1
            }
            );

            Assert.IsFalse(state.IsGameOver());

            state.PlayMove(new Connect4Move()
            {
                Token = tokenB,
                X = 2
            }
            );

            Assert.IsFalse(state.IsGameOver());

            state.PlayMove(new Connect4Move()
            {
                Token = tokenA,
                X = 2
            }
            );

            Assert.IsFalse(state.IsGameOver());

            state.PlayMove(new Connect4Move()
            {
                Token = tokenA,
                X = 2
            }
            );

            Assert.IsFalse(state.IsGameOver());

            state.PlayMove(new Connect4Move()
            {
                Token = tokenB,
                X = 3
            }
            );

            Assert.IsFalse(state.IsGameOver());

            state.PlayMove(new Connect4Move()
            {
                Token = tokenA,
                X = 3
            }
            );

            Assert.IsFalse(state.IsGameOver());

            state.PlayMove(new Connect4Move()
            {
                Token = tokenA,
                X = 3
            }
            );

            Assert.IsFalse(state.IsGameOver());

            state.PlayMove(new Connect4Move()
            {
                Token = tokenA,
                X = 3
            }
            );

            Assert.IsTrue(state.IsGameOver());
        }
        public void DoesNotCountTheOpponent()
        {
            var tokenA = new Token(0, 'x');
            var tokenB = new Token(1, 'y');

            var state = new Connect4State(7, 6, tokenA, tokenB);

            state.PlayMove(new Connect4Move()
            {
                Token = tokenA,
                X = 0
            }
            );

            Assert.IsFalse(state.IsGameOver());

            state.PlayMove(new Connect4Move()
            {
                Token = tokenA,
                X = 0
            }
            );

            Assert.IsFalse(state.IsGameOver());

            state.PlayMove(new Connect4Move()
            {
                Token = tokenA,
                X = 0
            }
            );

            Assert.IsFalse(state.IsGameOver());

            state.PlayMove(new Connect4Move()
            {
                Token = tokenB,
                X = 0
            }
            );

            Assert.IsFalse(state.IsGameOver());
        }