Ejemplo n.º 1
0
        public static void CapturePromotedPiece()
        {
            CrazyhouseChessGame game = new CrazyhouseChessGame("3r4/1P6/4k3/8/8/8/8/4K3 w - - 0 1");

            game.ApplyMove(new Move("B7", "B8", Player.White, 'Q'), true);
            game.ApplyMove(new Move("D8", "B8", Player.Black), true);
            Assert.AreEqual(1, game.BlackPocket.Count);
            Assert.AreEqual(0, game.WhitePocket.Count);
            Assert.AreEqual('p', game.BlackPocket[0].GetFenCharacter());
        }
Ejemplo n.º 2
0
        public static void TestApplyMove_AddToPocketIfCapture_AndFenGeneration_AndApplyDrop()
        {
            CrazyhouseChessGame game = new CrazyhouseChessGame();

            game.ApplyMove(new Move("E2", "E4", Player.White), true);
            game.ApplyMove(new Move("D7", "D5", Player.Black), true);
            game.ApplyMove(new Move("E4", "D5", Player.White), true);
            Assert.AreEqual(new Pawn(Player.White), game.WhitePocket[0]);
            Assert.AreEqual("rnbqkbnr/ppp1pppp/8/3P4/8/8/PPPP1PPP/RNBQKBNR/P b KQkq - 0 2", game.GetFen());

            game.ApplyMove(new Move("A7", "A5", Player.Black), true);
            Assert.True(game.ApplyDrop(new Drop(new Pawn(Player.White), new Position("H3"), Player.White), false));
            Assert.AreEqual("rnbqkbnr/1pp1pppp/8/p2P4/8/7P/PPPP1PPP/RNBQKBNR b KQkq - 1 3", game.GetFen());
            Assert.AreEqual(0, game.WhitePocket.Count);
        }
Ejemplo n.º 3
0
        public static void TestFenTilde()
        {
            CrazyhouseChessGame game = new CrazyhouseChessGame("rnbqkb1r/pP3ppp/5n2/4p3/8/8/PPPP1PPP/RNBQKBNR/PPP w KQkq - 8 5");

            game.ApplyMove(new Move("B7", "A8", Player.White, 'Q'), true);
            Assert.AreEqual("Q~nbqkb1r/p4ppp/5n2/4p3/8/8/PPPP1PPP/RNBQKBNR/PPPR b KQk - 0 5", game.GetFen());

            game = new CrazyhouseChessGame("Q~n1qkb1r/pb3ppp/5n2/4p3/8/2N5/PPPP1PPP/R1BQKBNR/RPPP b KQk - 11 6");
            game.ApplyMove(new Move("B7", "A8", Player.Black), true);
            Assert.AreEqual('p', game.BlackPocket[0].GetFenCharacter());
        }