forked from marcusbuffett/command-line-chess
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRook.py
More file actions
29 lines (17 loc) · 651 Bytes
/
Rook.py
File metadata and controls
29 lines (17 loc) · 651 Bytes
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
from Piece import Piece
from Coordinate import Coordinate as C
WHITE = True
BLACK = False
class Rook (Piece) :
stringRep = 'R'
value = 5
def __init__(self, board, side, position, movesMade=0) :
super(Rook, self).__init__(board, side, position)
self.movesMade = movesMade
def getPossibleMoves(self) :
board = self.board
currentPosition = self.position
directions = [C(0, 1), C(0, -1), C(1, 0), C(-1, 0)]
for direction in directions :
for move in self.movesInDirectionFromPos(currentPosition, direction, self.side) :
yield move