コード例 #1
0
    def test_move_hint_2(self):
        b = Board()

        b.move(Square('e2'), Square('e4'))
        b.move(Square('d7'), Square('d5'))

        expected_hints = {
            Square('d1'): [
                (Square('e2'), None),
                (Square('f3'), None),
                (Square('g4'), None),
                (Square('h5'), None),
            ],
            Square('e4'): [
                (
                    Square('d5'),
                    Piece(c.PieceType.pawn, c.Color.black, 3),
                ),
                (Square('e5'), None),
            ],
            Square('c8'): [
                (Square('d7'), None),
                (Square('e6'), None),
                (Square('f5'), None),
                (Square('g4'), None),
                (Square('h3'), None),
            ],
        }

        for s, hints in expected_hints.items():
            self.assertEqual(b.move_hint(s), hints)
コード例 #2
0
    def test_move_hint_1(self):
        b = Board()
        expected_hints = {
            Square('e2'): [(Square('e3'), None), (Square('e4'), None)],
            Square('a7'): [(Square('a6'), None), (Square('a5'), None)],
            Square('e1'): [],
            Square('g1'): [(Square('h3'), None), (Square('f3'), None)],
        }

        for s, hints in expected_hints.items():
            self.assertEqual(b.move_hint(s), hints)