Example #1
0
        public static void TestFenGeneration()
        {
            ThreeCheckChessGame game = new ThreeCheckChessGame("rnb1kb1Q/pppp1p1p/5np1/8/8/8/PPPPKPPP/RNB3NR w q - 1 7 +1+2");

            game.MakeMove(new Move("H8", "F8", Player.White), true);
            Assert.AreEqual("rnb1kQ2/pppp1p1p/5np1/8/8/8/PPPPKPPP/RNB3NR b q - 0 7 +2+2", game.GetFen());
        }
Example #2
0
        public static void TestUndoChecks()
        {
            ThreeCheckChessGame game = new ThreeCheckChessGame();
            string initial           = game.GetFen();

            game.MakeMove(new Move("E2", "E4", Player.White), true);
            game.MakeMove(new Move("D7", "D5", Player.Black), true);
            game.MakeMove(new Move("F1", "B5", Player.White), true);

            /*
             * Assert.AreEqual(1, game.ChecksByWhite);
             * Assert.True(game.Undo());
             * Assert.AreEqual(0, game.ChecksByWhite);
             * game.Undo(2);
             * Assert.AreEqual(initial, game.GetFen());*/
            Assert.Throws <NotImplementedException>(() => game.Undo());
        }
Example #3
0
        public static void TestRecordedChecks()
        {
            ThreeCheckChessGame game = new ThreeCheckChessGame();

            game.MakeMove(new Move("E2", "E4", Player.White), true);
            game.MakeMove(new Move("E7", "E5", Player.Black), true);
            game.MakeMove(new Move("D1", "H5", Player.White), true);
            game.MakeMove(new Move("G7", "G6", Player.Black), true);
            game.MakeMove(new Move("H5", "E5", Player.White), true);
            Assert.AreEqual(1, game.ChecksByWhite);
            Assert.AreEqual(0, game.ChecksByBlack);
            game.MakeMove(new Move("D8", "E7", Player.Black), true);
            game.MakeMove(new Move("E5", "H8", Player.White), true);
            game.MakeMove(new Move("E7", "E4", Player.Black), true);
            Assert.AreEqual(1, game.ChecksByWhite);
            Assert.AreEqual(1, game.ChecksByBlack);
            game.MakeMove(new Move("F1", "E2", Player.White), true);
            game.MakeMove(new Move("F8", "G7", Player.Black), true);
            game.MakeMove(new Move("H8", "G8", Player.White), true);
            Assert.AreEqual(2, game.ChecksByWhite);
            game.MakeMove(new Move("E8", "E7", Player.Black), true);
            game.MakeMove(new Move("G8", "E8", Player.White), true);
            Assert.AreEqual(3, game.ChecksByWhite);
            Assert.True(game.IsWinner(Player.White));
        }