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':
|
if self.color=='white':
|
||||||
self.b.append('r')
|
self.b.append('r')
|
||||||
else: 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':
|
elif self.piece == 'pawn':
|
||||||
if self.color=='white':
|
if self.color=='white':
|
||||||
self.b.append('p')
|
self.b.append('p')
|
||||||
else:
|
else:
|
||||||
self.b.append('P')
|
self.b.append('P')
|
||||||
Move.calc_moves(self, self.board.boardlist[row][column].piece, row, column)
|
|
||||||
elif self.piece == 'knight':
|
elif self.piece == 'knight':
|
||||||
if self.color=='white':
|
if self.color=='white':
|
||||||
self.b.append('h')
|
self.b.append('h')
|
||||||
else:
|
else:
|
||||||
self.b.append('H')
|
self.b.append('H')
|
||||||
Move.calc_moves(self, self.board.boardlist[row][column].piece, row, column)
|
|
||||||
elif self.piece == 'bishop':
|
elif self.piece == 'bishop':
|
||||||
if self.color=='white':
|
if self.color=='white':
|
||||||
self.b.append('b')
|
self.b.append('b')
|
||||||
else:
|
else:
|
||||||
self.b.append('B')
|
self.b.append('B')
|
||||||
Move.calc_moves(self, self.board.boardlist[row][column].piece, row, column)
|
|
||||||
elif self.piece == 'queen':
|
elif self.piece == 'queen':
|
||||||
if self.color=='white':
|
if self.color=='white':
|
||||||
self.b.append('q')
|
self.b.append('q')
|
||||||
else:
|
else:
|
||||||
self.b.append('Q')
|
self.b.append('Q')
|
||||||
Move.calc_moves(self, self.board.boardlist[row][column].piece, row, column)
|
|
||||||
elif self.piece == 'king':
|
elif self.piece == 'king':
|
||||||
if self.color=='white':
|
if self.color=='white':
|
||||||
self.b.append('k')
|
self.b.append('k')
|
||||||
else:
|
else:
|
||||||
self.b.append('K')
|
self.b.append('K')
|
||||||
Move.calc_moves(self, self.board.boardlist[row][column].piece, row, column)
|
|
||||||
else:
|
else:
|
||||||
# wyswietla puste miejsca
|
# wyswietla puste miejsca
|
||||||
self.b.append(' ')
|
self.b.append(' ')
|
||||||
@ -73,8 +66,13 @@ class Game:
|
|||||||
self.b.append('7')
|
self.b.append('7')
|
||||||
print(self.b)
|
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):
|
def nextMove(self, ruch):
|
||||||
|
self.currently_available_moves()
|
||||||
if ruch == 'noone':
|
if ruch == 'noone':
|
||||||
return Board.move_boot(self, 'white')
|
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):
|
def calc_moves(self, piece, row, column):
|
||||||
# calculate possible moves for specific piece
|
# calculate possible moves for specific piece
|
||||||
if piece.name == 'rook':
|
if piece == None:
|
||||||
|
pass
|
||||||
|
elif piece.name == 'rook':
|
||||||
# piece.delete_moves()
|
# piece.delete_moves()
|
||||||
Move.straightline_moves(self, piece, column, row, True)
|
Move.straightline_moves(self, piece, column, row, True)
|
||||||
elif piece.name == 'pawn':
|
elif piece.name == 'pawn':
|
||||||
|
Loading…
Reference in New Issue
Block a user