public static IPlayer GetAiPlayer(GameFactory.GameType gameType, int team, int depth)
        {
            IPlayer player = null;

            player = new IAPlayer(new Token(team, 'O'), team)
            {
                Strateger = StrategyResolver.GetStrateger(depth)
            };

            return player;
        }
        public void TestDiagonaleWithOponent()
        {
            var state = new TicTacTocState(3);
            Assert.IsFalse(state.IsGameOver());

            IToken tokenX = new Token(1, 'X');
            ITeamIdentifier opponent = new IAPlayer(tokenX, 1);

            IToken tokenO = new Token(2, 'O');
            ITeamIdentifier player = new IAPlayer(tokenO, 2);

            state.PlayMove(new TicTacToeMove()
            {
                X = 2,
                Y = 0,
                Token = tokenX
            });
            Assert.IsFalse(state.IsGameOver());

            state.PlayMove(new TicTacToeMove()
            {
                X = 0,
                Y = 2,
                Token = tokenX
            });
            Assert.IsFalse(state.IsGameOver());

            state.PlayMove(new TicTacToeMove()
            {
                X = 0,
                Y = 0,
                Token = tokenO
            });
            state.PlayMove(new TicTacToeMove()
            {
                X = 2,
                Y = 2,
                Token = tokenO
            });

            state.PlayMove(new TicTacToeMove()
            {
                X = 1,
                Y = 1,
                Token = tokenX
            });
            Assert.IsTrue(state.IsGameOver());
            Assert.AreEqual(1, state.GetValueFor(opponent));
            Assert.AreEqual(-1, state.GetValueFor(player));
        }
        public void NotLoosingTest()
        {
            var state = new TicTacTocState(3);

            IToken tokenY = new Token(2, 'Y');
            ITeamIdentifier player = new IAPlayer(tokenY, 2);

            IToken tokenX = new Token(1, 'X');
            ITeamIdentifier opponent = new IAPlayer(tokenX, 1);

            var solver = GetStrateger();

            state.PlayMove(new TicTacToeMove()
            {
                X = 0,
                Y = 0,
                Token = tokenX
            });
            Assert.IsFalse(state.IsGameOver());

            state.PlayMove(new TicTacToeMove()
            {
                X = 1,
                Y = 1,
                Token = tokenX
            });
            Assert.IsFalse(state.IsGameOver());

            state.PlayMove(new TicTacToeMove()
            {
                X = 0,
                Y = 1,
                Token = tokenX
            });
            Assert.IsFalse(state.IsGameOver());

            state.PlayMove(new TicTacToeMove()
            {
                X = 0,
                Y = 2,
                Token = tokenY
            });
            Assert.IsFalse(state.IsGameOver());

            state.PlayMove(new TicTacToeMove()
            {
                X = 2,
                Y = 1,
                Token = tokenY
            });
            Assert.IsFalse(state.IsGameOver());

            state.Display();
            var move = solver.FindBestMove(state, player, opponent) as TicTacToeMove;
            Assert.IsNotNull(move);
            Assert.IsFalse(state.IsGameOver());
            Assert.AreEqual(2, move.X);
            Assert.AreEqual(2, move.Y);
        }