printboard
This commit is contained in:
parent
be58e3b9d9
commit
a37c688eef
12
game.py
12
game.py
@ -25,38 +25,31 @@ class Game:
|
||||
if self.color=='white':
|
||||
self.b.append('r')
|
||||
else: self.b.append('R')
|
||||
|
||||
Move.calc_moves(self, self.board.boardlist[row][column].piece, row, column)
|
||||
elif self.piece == 'pawn':
|
||||
if self.color=='white':
|
||||
self.b.append('p')
|
||||
else:
|
||||
self.b.append('P')
|
||||
Move.calc_moves(self, self.board.boardlist[row][column].piece, row, column)
|
||||
elif self.piece == 'knight':
|
||||
if self.color=='white':
|
||||
self.b.append('h')
|
||||
else:
|
||||
self.b.append('H')
|
||||
Move.calc_moves(self, self.board.boardlist[row][column].piece, row, column)
|
||||
elif self.piece == 'bishop':
|
||||
if self.color=='white':
|
||||
self.b.append('b')
|
||||
else:
|
||||
self.b.append('B')
|
||||
Move.calc_moves(self, self.board.boardlist[row][column].piece, row, column)
|
||||
elif self.piece == 'queen':
|
||||
if self.color=='white':
|
||||
self.b.append('q')
|
||||
else:
|
||||
self.b.append('Q')
|
||||
Move.calc_moves(self, self.board.boardlist[row][column].piece, row, column)
|
||||
elif self.piece == 'king':
|
||||
if self.color=='white':
|
||||
self.b.append('k')
|
||||
else:
|
||||
self.b.append('K')
|
||||
Move.calc_moves(self, self.board.boardlist[row][column].piece, row, column)
|
||||
else:
|
||||
# wyswietla puste miejsca
|
||||
self.b.append(' ')
|
||||
@ -73,8 +66,13 @@ class Game:
|
||||
self.b.append('7')
|
||||
print(self.b)
|
||||
|
||||
def currently_available_moves(self):
|
||||
for row in range(8):
|
||||
for column in range(8):
|
||||
Move.calc_moves(self, self.board.boardlist[row][column].piece, row, column)
|
||||
|
||||
def nextMove(self, ruch):
|
||||
self.currently_available_moves()
|
||||
if ruch == 'noone':
|
||||
return Board.move_boot(self, 'white')
|
||||
|
||||
|
4
move.py
4
move.py
@ -124,7 +124,9 @@ class Move:
|
||||
|
||||
def calc_moves(self, piece, row, column):
|
||||
# calculate possible moves for specific piece
|
||||
if piece.name == 'rook':
|
||||
if piece == None:
|
||||
pass
|
||||
elif piece.name == 'rook':
|
||||
# piece.delete_moves()
|
||||
Move.straightline_moves(self, piece, column, row, True)
|
||||
elif piece.name == 'pawn':
|
||||
|
Loading…
Reference in New Issue
Block a user