Exemplo n.º 1
0
        public static void TestUndoOnNewGame()
        {
            const string           initialBoard = "8/8/3k4/8/8/4K3/8/Q6R w - - 0 1";
            KingOfTheHillChessGame game         = new KingOfTheHillChessGame(initialBoard);

            Assert.False(game.Undo());
        }
Exemplo n.º 2
0
        public static void TestUndoZeroMove()
        {
            const string           initialBoard = "8/8/3k4/8/8/4K3/8/Q6R w - - 0 1";
            KingOfTheHillChessGame game         = new KingOfTheHillChessGame(initialBoard);

            Assert.AreEqual(0, game.Undo(0));
            Assert.AreEqual(initialBoard, game.GetFen());
        }
Exemplo n.º 3
0
        public static void TestUndoCaptureWhite()
        {
            const string           initialBoard = "rnbqk1nr/pppp1ppp/8/4p3/1b6/2PP4/PP2PPPP/RNBQKBNR w KQkq - 1 3";
            KingOfTheHillChessGame game         = new KingOfTheHillChessGame(initialBoard);

            game.MakeMove(new Move("c3", "b2", Player.White), true);
            game.Undo();
            Assert.AreEqual(initialBoard, game.GetFen());
        }
Exemplo n.º 4
0
        public static void TestUndoOneMove()
        {
            const string           initialBoard = "8/8/3k4/8/8/4K3/8/Q6R w - - 0 1";
            KingOfTheHillChessGame game         = new KingOfTheHillChessGame(initialBoard);

            game.MakeMove(new Move("a1", "h8", Player.White), true);
            Assert.AreEqual(1, game.Undo(1));
            Assert.AreEqual(initialBoard, game.GetFen());
        }
Exemplo n.º 5
0
        public static void TestUndoLastBlackMove()
        {
            const string           initialBoard = "8/8/3k4/8/8/4K3/8/Q6R b - - 0 1";
            KingOfTheHillChessGame game         = new KingOfTheHillChessGame(initialBoard);

            game.MakeMove(new Move("d6", "d7", Player.Black), true);
            Assert.True(game.Undo());
            Assert.AreEqual(initialBoard, game.GetFen());
        }
Exemplo n.º 6
0
        public static void TestUndoEnPassantBlack()
        {
            const string           initialBoard = "8/1k2P3/8/8/4pP2/8/1K6/8 b - f3 0 1";
            KingOfTheHillChessGame game         = new KingOfTheHillChessGame(initialBoard);

            game.MakeMove(new Move("e4", "f3", Player.Black), true);
            game.Undo();
            Assert.AreEqual(initialBoard, game.GetFen());
        }
Exemplo n.º 7
0
        public static void TestUndoEnPassantWhite()
        {
            const string           initialBoard = "8/1k6/8/3pP3/8/8/1K6/8 w - d6 0 2";
            KingOfTheHillChessGame game         = new KingOfTheHillChessGame(initialBoard);

            game.MakeMove(new Move("e5", "d6", Player.White), true);
            game.Undo();
            Assert.AreEqual(initialBoard, game.GetFen());
        }
Exemplo n.º 8
0
        public static void TestUndoPromotionBlack()
        {
            const string           initialBoard = "8/1k2P3/8/8/8/8/1K2p3/8 b - - 0 1";
            KingOfTheHillChessGame game         = new KingOfTheHillChessGame(initialBoard);

            game.MakeMove(new Move("e2", "e1", Player.Black, 'N'), true);
            game.Undo();
            Assert.AreEqual(initialBoard, game.GetFen());
        }
Exemplo n.º 9
0
        public static void TestUndoPromotionWhite()
        {
            const string           initialBoard = "8/1k2P3/8/8/8/8/1K2p3/8 w - - 0 1";
            KingOfTheHillChessGame game         = new KingOfTheHillChessGame(initialBoard);

            game.MakeMove(new Move("e7", "e8", Player.White, 'q'), true);
            game.Undo();
            Assert.AreEqual(initialBoard, game.GetFen());
        }
Exemplo n.º 10
0
        public static void TestUndoCaptureBlack()
        {
            const string           initialBoard = "rnbqkbnr/pppp1ppp/4p3/8/8/BP6/P1PPPPPP/RN1QKBNR b KQkq - 1 2";
            KingOfTheHillChessGame game         = new KingOfTheHillChessGame(initialBoard);

            game.MakeMove(new Move("f8", "a3", Player.Black), true);
            game.Undo();
            Assert.AreEqual(initialBoard, game.GetFen());
        }