Exemple #1
0
    def run(self):
        from chess import Board

        b = Board("8/8/8/8/4K3/8/8/8 b KQkq - 0 1")

        assert b.attacked_fields(0) == 0
        assert b.attacked_fields(1) == (int('00011100', 2) << 32) | int('00010100', 2) << 24 | int('00011100', 2) << 16

        b.from_fen("8/8/8/8/8/8/8/7k b KQkq - 0 1")
        assert b.attacked_fields(1) == 0
        assert b.attacked_fields(0) == (int('00000010', 2)) | int('00000011', 2) << 8
Exemple #2
0
    def run(self):
        from chess import Board

        b = Board("P7/8/8/4P3/3p4/8/8/7p b KQkq - 0 1")
        assert b.attacked_fields(0) == int('00101000', 2) << 16
        assert b.attacked_fields(1) == int('00010100', 2) << 40
Exemple #3
0
    def run(self):
        from chess import Board

        b = Board("8/8/8/8/3N4/8/8/8 b KQkq - 0 1")
        assert b.attacked_fields(1) == 44272527353856
Exemple #4
0
    def run(self):
        from chess import Board

        b = Board("8/8/8/8/3b4/8/8/8 b KQkq - 0 1")
        assert b.attacked_fields(0) == 108724279602332802
Exemple #5
0
    def run(self):
        from chess import Board

        b = Board("8/8/8/8/3Q4/8/8/8 b KQkq - 0 1")
        assert b.attacked_fields(1) == 1266167048752878738