def setUp(self): self.x_map = dict([(i, 'abcdefgh'[i]) for i in range(8)]) self.y_map = dict([(i, str(i + 1)) for i in range(8)]) self.squares = dict([((x, y), Square( (x, y))) for (x, y) in itertools.product(range(8), range(8))])
def test_geater_equals(self): s1 = Square('a1') s2 = Square('a2') self.assertGreaterEqual(s2, s1)
def test_less_equals(self): s1 = Square('a1') s2 = Square('a2') self.assertLess(s1, s2)
def test_not_equals(self): s1 = Square((1, 3)) s2 = Square((3, 1)) self.assertNotEqual(s1, s2)
def test_greater(self): s1 = Square('a1') s2 = Square('a2') self.assertGreater(s2, s1)
def test_parse_move_spec_13(self): move_spec = (Square('e1'), Square('e4')) expected_result = move_spec self.assertEqual(Game.parse_move_spec(move_spec), expected_result)
def test_equals(self): s1 = Square((1, 3)) s2 = Square((1, 3)) self.assertEqual(s1, s2) self.assertFalse(s1 is s2)
def test_parse_move_spec_3(self): move_spec = ((0, 0), (0, 7)) expected_result = (Square((0, 0)), Square((0, 7))) self.assertEqual(Game.parse_move_spec(move_spec), expected_result)
def test_parse_move_spec_2(self): move_spec = ('a1', 'h8') expected_result = (Square('a1'), Square('h8')) self.assertEqual(Game.parse_move_spec(move_spec), expected_result)
def moves_for_testing(piece): """ a b c d e f g h 8 | |#| |#| |#| |#| 8 7 |#| |#| |#| |#| | 7 6 | |#| |#| |#| |#| 6 5 |#| |#| |#| |#| | 5 4 | |#| |#| |#| |#| 4 3 |#| |#| |#| |#| | 3 2 | |#| |#| |#| |#| 2 1 |#| |#| |#| |#| | 1 a b c d e f g h """ moves = { (c.PieceType.pawn, c.Color.black): [ MD( move=('f7', 'f5'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('f7'), Square('f5')], ), MD( move=('b6', 'c5'), is_legal=True, is_orthogonal=False, is_diagonal=True, path=[Square('b6'), Square('c5')], ), MD( move=('g3', 'g4'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), MD( move=('e4', 'e2'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), ], (c.PieceType.pawn, c.Color.black): [ MD( move=('f7', 'f5'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('f7'), Square('f5')], ), MD( move=('b6', 'c5'), is_legal=True, is_orthogonal=False, is_diagonal=True, path=[Square('b6'), Square('c5')], ), MD( move=('g3', 'g4'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), MD( move=('e4', 'e2'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), ], (c.PieceType.pawn, c.Color.black): [ MD( move=('f7', 'f5'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('f7'), Square('f5')], ), MD( move=('b6', 'c5'), is_legal=True, is_orthogonal=False, is_diagonal=True, path=[Square('b6'), Square('c5')], ), MD( move=('g3', 'g4'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), MD( move=('e4', 'e2'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), ], (c.PieceType.pawn, c.Color.black): [ MD( move=('f7', 'f5'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('f7'), Square('f5')], ), MD( move=('b6', 'c5'), is_legal=True, is_orthogonal=False, is_diagonal=True, path=[Square('b6'), Square('c5')], ), MD( move=('g3', 'g4'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), MD( move=('e4', 'e2'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), ], (c.PieceType.pawn, c.Color.black): [ MD( move=('f7', 'f5'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('f7'), Square('f5')], ), MD( move=('b6', 'c5'), is_legal=True, is_orthogonal=False, is_diagonal=True, path=[Square('b6'), Square('c5')], ), MD( move=('g3', 'g4'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), MD( move=('e4', 'e2'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), ], (c.PieceType.pawn, c.Color.black): [ MD( move=('f7', 'f5'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('f7'), Square('f5')], ), MD( move=('b6', 'c5'), is_legal=True, is_orthogonal=False, is_diagonal=True, path=[Square('b6'), Square('c5')], ), MD( move=('g3', 'g4'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), MD( move=('e4', 'e2'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), ], (c.PieceType.pawn, c.Color.black): [ MD( move=('f7', 'f5'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('f7'), Square('f5')], ), MD( move=('b6', 'c5'), is_legal=True, is_orthogonal=False, is_diagonal=True, path=[Square('b6'), Square('c5')], ), MD( move=('g3', 'g4'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), MD( move=('e4', 'e2'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), ], (c.PieceType.pawn, c.Color.black): [ MD( move=('f7', 'f5'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('f7'), Square('f5')], ), MD( move=('b6', 'c5'), is_legal=True, is_orthogonal=False, is_diagonal=True, path=[Square('b6'), Square('c5')], ), MD( move=('g3', 'g4'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), MD( move=('e4', 'e2'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), ], (c.PieceType.knight, c.Color.black): [ MD( move=('b8', 'a6'), is_legal=True, is_orthogonal=False, is_diagonal=False, path=[Square('b8'), Square('a6')], ), MD( move=('f6', 'g4'), is_legal=True, is_orthogonal=False, is_diagonal=False, path=[Square('f6'), Square('g4')], ), MD( move=('d5', 'd3'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), MD( move=('a3', 'd6'), is_legal=False, is_orthogonal=False, is_diagonal=True, path=[], ), ], (c.PieceType.knight, c.Color.black): [ MD( move=('b8', 'a6'), is_legal=True, is_orthogonal=False, is_diagonal=False, path=[Square('b8'), Square('a6')], ), MD( move=('f6', 'g4'), is_legal=True, is_orthogonal=False, is_diagonal=False, path=[Square('f6'), Square('g4')], ), MD( move=('d5', 'd3'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), MD( move=('a3', 'd6'), is_legal=False, is_orthogonal=False, is_diagonal=True, path=[], ), ], (c.PieceType.bishop, c.Color.black): [ MD( move=('g1', 'a7'), is_legal=True, is_orthogonal=False, is_diagonal=True, path=[ Square('g1'), Square('f2'), Square('e3'), Square('d4'), Square('c5'), Square('b6'), Square('a7') ], ), MD( move=('f6', 'g5'), is_legal=True, is_orthogonal=False, is_diagonal=True, path=[Square('f6'), Square('g5')], ), MD( move=('e5', 'e3'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), MD( move=('b6', 'c3'), is_legal=False, is_orthogonal=False, is_diagonal=False, path=[], ), ], (c.PieceType.bishop, c.Color.black): [ MD( move=('g1', 'a7'), is_legal=True, is_orthogonal=False, is_diagonal=True, path=[ Square('g1'), Square('f2'), Square('e3'), Square('d4'), Square('c5'), Square('b6'), Square('a7') ], ), MD( move=('f6', 'g5'), is_legal=True, is_orthogonal=False, is_diagonal=True, path=[Square('f6'), Square('g5')], ), MD( move=('e5', 'e3'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), MD( move=('b6', 'c3'), is_legal=False, is_orthogonal=False, is_diagonal=False, path=[], ), ], (c.PieceType.rook, c.Color.black): [ MD( move=('e7', 'e3'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[ Square('e7'), Square('e6'), Square('e5'), Square('e4'), Square('e3') ], ), MD( move=('a3', 'g3'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[ Square('a3'), Square('b3'), Square('c3'), Square('d3'), Square('e3'), Square('f3'), Square('g3') ], ), MD( move=('h4', 'f7'), is_legal=False, is_orthogonal=False, is_diagonal=False, path=[], ), MD( move=('c6', 'b5'), is_legal=False, is_orthogonal=False, is_diagonal=True, path=[], ), ], (c.PieceType.rook, c.Color.black): [ MD( move=('e7', 'e3'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[ Square('e7'), Square('e6'), Square('e5'), Square('e4'), Square('e3') ], ), MD( move=('a3', 'g3'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[ Square('a3'), Square('b3'), Square('c3'), Square('d3'), Square('e3'), Square('f3'), Square('g3') ], ), MD( move=('h4', 'f7'), is_legal=False, is_orthogonal=False, is_diagonal=False, path=[], ), MD( move=('c6', 'b5'), is_legal=False, is_orthogonal=False, is_diagonal=True, path=[], ), ], (c.PieceType.queen, c.Color.black): [ MD( move=('h5', 'e8'), is_legal=True, is_orthogonal=False, is_diagonal=True, path=[Square('h5'), Square('g6'), Square('f7'), Square('e8')], ), MD( move=('b5', 'd3'), is_legal=True, is_orthogonal=False, is_diagonal=True, path=[Square('b5'), Square('c4'), Square('d3')], ), MD( move=('c7', 'f7'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('c7'), Square('d7'), Square('e7'), Square('f7')], ), MD( move=('g1', 'g5'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[ Square('g1'), Square('g2'), Square('g3'), Square('g4'), Square('g5') ], ), MD( move=('a4', 'c5'), is_legal=False, is_orthogonal=False, is_diagonal=False, path=[], ), MD( move=('b7', 'd4'), is_legal=False, is_orthogonal=False, is_diagonal=False, path=[], ), ], (c.PieceType.king, c.Color.black): [ MD( move=('e8', 'g8'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('e8'), Square('g8')], ), MD( move=('e8', 'c8'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('e8'), Square('c8')], ), MD( move=('f6', 'g5'), is_legal=True, is_orthogonal=False, is_diagonal=True, path=[Square('f6'), Square('g5')], ), MD( move=('b4', 'b3'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('b4'), Square('b3')], ), MD( move=('e7', 'd7'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('e7'), Square('d7')], ), MD( move=('g6', 'e5'), is_legal=False, is_orthogonal=False, is_diagonal=False, path=[], ), MD( move=('a6', 'c5'), is_legal=False, is_orthogonal=False, is_diagonal=False, path=[], ), ], (c.PieceType.pawn, c.Color.white): [ MD( move=('d2', 'd4'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('d2'), Square('d4')], ), MD( move=('f4', 'f5'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('f4'), Square('f5')], ), MD( move=('f7', 'f6'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), MD( move=('f4', 'f6'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), ], (c.PieceType.pawn, c.Color.white): [ MD( move=('d2', 'd4'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('d2'), Square('d4')], ), MD( move=('f4', 'f5'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('f4'), Square('f5')], ), MD( move=('f7', 'f6'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), MD( move=('f4', 'f6'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), ], (c.PieceType.pawn, c.Color.white): [ MD( move=('d2', 'd4'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('d2'), Square('d4')], ), MD( move=('f4', 'f5'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('f4'), Square('f5')], ), MD( move=('f7', 'f6'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), MD( move=('f4', 'f6'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), ], (c.PieceType.pawn, c.Color.white): [ MD( move=('d2', 'd4'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('d2'), Square('d4')], ), MD( move=('f4', 'f5'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('f4'), Square('f5')], ), MD( move=('f7', 'f6'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), MD( move=('f4', 'f6'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), ], (c.PieceType.pawn, c.Color.white): [ MD( move=('d2', 'd4'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('d2'), Square('d4')], ), MD( move=('f4', 'f5'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('f4'), Square('f5')], ), MD( move=('f7', 'f6'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), MD( move=('f4', 'f6'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), ], (c.PieceType.pawn, c.Color.white): [ MD( move=('d2', 'd4'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('d2'), Square('d4')], ), MD( move=('f4', 'f5'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('f4'), Square('f5')], ), MD( move=('f7', 'f6'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), MD( move=('f4', 'f6'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), ], (c.PieceType.pawn, c.Color.white): [ MD( move=('d2', 'd4'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('d2'), Square('d4')], ), MD( move=('f4', 'f5'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('f4'), Square('f5')], ), MD( move=('f7', 'f6'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), MD( move=('f4', 'f6'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), ], (c.PieceType.pawn, c.Color.white): [ MD( move=('d2', 'd4'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('d2'), Square('d4')], ), MD( move=('f4', 'f5'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('f4'), Square('f5')], ), MD( move=('f7', 'f6'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), MD( move=('f4', 'f6'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), ], (c.PieceType.knight, c.Color.white): [ MD( move=('g1', 'f3'), is_legal=True, is_orthogonal=False, is_diagonal=False, path=[Square('g1'), Square('f3')], ), MD( move=('c3', 'd5'), is_legal=True, is_orthogonal=False, is_diagonal=False, path=[Square('c3'), Square('d5')], ), MD( move=('f6', 'g5'), is_legal=False, is_orthogonal=False, is_diagonal=True, path=[], ), MD( move=('d4', 'b6'), is_legal=False, is_orthogonal=False, is_diagonal=True, path=[], ), ], (c.PieceType.knight, c.Color.white): [ MD( move=('g1', 'f3'), is_legal=True, is_orthogonal=False, is_diagonal=False, path=[Square('g1'), Square('f3')], ), MD( move=('c3', 'd5'), is_legal=True, is_orthogonal=False, is_diagonal=False, path=[Square('c3'), Square('d5')], ), MD( move=('f6', 'g5'), is_legal=False, is_orthogonal=False, is_diagonal=True, path=[], ), MD( move=('d4', 'b6'), is_legal=False, is_orthogonal=False, is_diagonal=True, path=[], ), ], (c.PieceType.bishop, c.Color.white): [ MD( move=('f1', 'a6'), is_legal=True, is_orthogonal=False, is_diagonal=True, path=[ Square('f1'), Square('e2'), Square('d3'), Square('c4'), Square('b5'), Square('a6') ], ), MD( move=('c2', 'd3'), is_legal=True, is_orthogonal=False, is_diagonal=True, path=[Square('c2'), Square('d3')], ), MD( move=('f6', 'd6'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), MD( move=('c4', 'e5'), is_legal=False, is_orthogonal=False, is_diagonal=False, path=[], ), ], (c.PieceType.bishop, c.Color.white): [ MD( move=('f1', 'a6'), is_legal=True, is_orthogonal=False, is_diagonal=True, path=[ Square('f1'), Square('e2'), Square('d3'), Square('c4'), Square('b5'), Square('a6') ], ), MD( move=('c2', 'd3'), is_legal=True, is_orthogonal=False, is_diagonal=True, path=[Square('c2'), Square('d3')], ), MD( move=('f6', 'd6'), is_legal=False, is_orthogonal=True, is_diagonal=False, path=[], ), MD( move=('c4', 'e5'), is_legal=False, is_orthogonal=False, is_diagonal=False, path=[], ), ], (c.PieceType.rook, c.Color.white): [ MD( move=('a1', 'a8'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[ Square('a1'), Square('a2'), Square('a3'), Square('a4'), Square('a5'), Square('a6'), Square('a7'), Square('a8') ], ), MD( move=('b4', 'c4'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('b4'), Square('c4')], ), MD( move=('f3', 'e4'), is_legal=False, is_orthogonal=False, is_diagonal=True, path=[], ), MD( move=('c4', 'e5'), is_legal=False, is_orthogonal=False, is_diagonal=False, path=[], ), ], (c.PieceType.rook, c.Color.white): [ MD( move=('a1', 'a8'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[ Square('a1'), Square('a2'), Square('a3'), Square('a4'), Square('a5'), Square('a6'), Square('a7'), Square('a8') ], ), MD( move=('b4', 'c4'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('b4'), Square('c4')], ), MD( move=('f3', 'e4'), is_legal=False, is_orthogonal=False, is_diagonal=True, path=[], ), MD( move=('c4', 'e5'), is_legal=False, is_orthogonal=False, is_diagonal=False, path=[], ), ], (c.PieceType.queen, c.Color.white): [ MD( move=('b4', 'e1'), is_legal=True, is_orthogonal=False, is_diagonal=True, path=[Square('b4'), Square('c3'), Square('d2'), Square('e1')], ), MD( move=('b2', 'g7'), is_legal=True, is_orthogonal=False, is_diagonal=True, path=[ Square('b2'), Square('c3'), Square('d4'), Square('e5'), Square('f6'), Square('g7') ], ), MD( move=('d4', 'd8'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[ Square('d4'), Square('d5'), Square('d6'), Square('d7'), Square('d8') ], ), MD( move=('e3', 'b3'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('e3'), Square('d3'), Square('c3'), Square('b3')], ), MD( move=('f2', 'd3'), is_legal=False, is_orthogonal=False, is_diagonal=False, path=[], ), MD( move=('b6', 'f7'), is_legal=False, is_orthogonal=False, is_diagonal=False, path=[], ), ], (c.PieceType.king, c.Color.white): [ MD( move=('e1', 'g1'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('e1'), Square('g1')], ), MD( move=('e1', 'c1'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('e1'), Square('c1')], ), MD( move=('g3', 'f4'), is_legal=True, is_orthogonal=False, is_diagonal=True, path=[Square('g3'), Square('f4')], ), MD( move=('c2', 'c1'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('c2'), Square('c1')], ), MD( move=('h2', 'g2'), is_legal=True, is_orthogonal=True, is_diagonal=False, path=[Square('h2'), Square('g2')], ), MD( move=('f2', 'd3'), is_legal=False, is_orthogonal=False, is_diagonal=False, path=[], ), MD( move=('b6', 'f7'), is_legal=False, is_orthogonal=False, is_diagonal=False, path=[], ), ], } return moves.get((piece.type, piece.color), [])
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)
def setUp(self): self.data = { # Rooks Square('a1'): Piece(c.PieceType.rook, c.Color.white, order=0), Square('h1'): Piece(c.PieceType.rook, c.Color.white, order=1), Square('a8'): Piece(c.PieceType.rook, c.Color.black, order=0), Square('h8'): Piece(c.PieceType.rook, c.Color.black, order=1), # Kinghts Square('b1'): Piece(c.PieceType.knight, c.Color.white, order=0), Square('g1'): Piece(c.PieceType.knight, c.Color.white, order=1), Square('b8'): Piece(c.PieceType.knight, c.Color.black, order=0), Square('g8'): Piece(c.PieceType.knight, c.Color.black, order=1), # Bishops Square('c1'): Piece(c.PieceType.bishop, c.Color.white, order=0), Square('f1'): Piece(c.PieceType.bishop, c.Color.white, order=1), Square('c8'): Piece(c.PieceType.bishop, c.Color.black, order=0), Square('f8'): Piece(c.PieceType.bishop, c.Color.black, order=1), # Queens Square('d1'): Piece(c.PieceType.queen, c.Color.white), Square('d8'): Piece(c.PieceType.queen, c.Color.black), # Kings Square('e1'): Piece(c.PieceType.king, c.Color.white), Square('e8'): Piece(c.PieceType.king, c.Color.black), # White Pawns Square('a2'): Piece(c.PieceType.pawn, c.Color.white, order=0), Square('b2'): Piece(c.PieceType.pawn, c.Color.white, order=1), Square('c2'): Piece(c.PieceType.pawn, c.Color.white, order=2), Square('d2'): Piece(c.PieceType.pawn, c.Color.white, order=3), Square('e2'): Piece(c.PieceType.pawn, c.Color.white, order=4), Square('f2'): Piece(c.PieceType.pawn, c.Color.white, order=5), Square('g2'): Piece(c.PieceType.pawn, c.Color.white, order=6), Square('h2'): Piece(c.PieceType.pawn, c.Color.white, order=7), # Black Pawns Square('a7'): Piece(c.PieceType.pawn, c.Color.black, order=0), Square('b7'): Piece(c.PieceType.pawn, c.Color.black, order=1), Square('c7'): Piece(c.PieceType.pawn, c.Color.black, order=2), Square('d7'): Piece(c.PieceType.pawn, c.Color.black, order=3), Square('e7'): Piece(c.PieceType.pawn, c.Color.black, order=4), Square('f7'): Piece(c.PieceType.pawn, c.Color.black, order=5), Square('g7'): Piece(c.PieceType.pawn, c.Color.black, order=6), Square('h7'): Piece(c.PieceType.pawn, c.Color.black, order=7), } self.reverse = {v: k for k, v in self.data.items()}