forked from 905t/Python-Chess
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpieces.py
106 lines (72 loc) · 2.55 KB
/
pieces.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
class Piece:
"""A chess piece located on the chess board.
=== Public Attributes ===
colour:
The colour of the chess piece. Can either be 'B' or 'W'.
"""
colour: str
def __init__(self, colour: str) -> None:
"""Initialize a new Piece with a given colour.
"""
self.colour = colour
class Pawn(Piece):
"""A chess pawn located on the chess board.
=== Public Attributes ===
start:
True if the pawn has yet to make a move, False if it has moved.
=== Inherited Attributes ===
colour:
The colour of the chess piece. Can either be 'B' or 'W'.
"""
colour: str
start: bool
def __init__(self, colour: str) -> None:
Piece.__init__(self, colour)
self.start = True
def made_first_move(self) -> None:
self.start = False
class Knight(Piece):
"""A chess knight located on the chess board.
=== Inherited Attributes ===
colour:
The colour of the chess piece. Can either be 'B' or 'W'.
"""
colour: str
def __init__(self, colour: str) -> None:
Piece.__init__(self, colour)
class Rook(Piece):
"""A chess rook located on the chess board.
=== Inherited Attributes ===
colour:
The colour of the chess piece. Can either be 'B' or 'W'.
"""
colour: str
def __init__(self, colour: str) -> None:
Piece.__init__(self, colour)
class Bishop(Piece):
"""A chess bishop located on the chess board.
=== Inherited Attributes ===
colour:
The colour of the chess piece. Can either be 'B' or 'W'.
"""
colour: str
def __init__(self, colour: str) -> None:
Piece.__init__(self, colour)
class Queen(Piece):
"""A chess queen located on the chess board.
=== Inherited Attributes ===
colour:
The colour of the chess piece. Can either be 'B' or 'W'.
"""
colour: str
def __init__(self, colour: str) -> None:
Piece.__init__(self, colour)
class King(Piece):
"""A chess king located on the chess board.
=== Inherited Attributes ===
colour:
The colour of the chess piece. Can either be 'B' or 'W'.
"""
colour: str
def __init__(self, colour: str) -> None:
Piece.__init__(self, colour)