letters to numbers
This commit is contained in:
parent
157aa82794
commit
73bef9f806
Binary file not shown.
12
board.py
12
board.py
@ -182,32 +182,20 @@ class Board:
|
||||
if self.board.boardlist[r][c].piece != None:
|
||||
if self.board.boardlist[r][c].piece.color != color:
|
||||
self.boot_piece.append(self.board.boardlist[r][c])
|
||||
#random piece
|
||||
|
||||
self.value = random.randrange(0, len(self.boot_piece))
|
||||
self.initial = self.boot_piece[self.value]
|
||||
while len(self.initial.piece.valid_moves) == 0:
|
||||
#print('xddd')
|
||||
#print(self.initial.piece)
|
||||
#print(self.initial.piece.valid_moves)
|
||||
self.value = random.randrange(0, len(self.boot_piece))
|
||||
self.initial = self.boot_piece[self.value]
|
||||
self.initial_row=self.initial.row
|
||||
self.initial_column = self.initial.column
|
||||
#print(self.initial)
|
||||
#random move
|
||||
self.value = random.randrange(0, len(self.initial.piece.valid_moves))
|
||||
self.final = self.initial.piece.valid_moves[self.value]
|
||||
self.final_row = self.final[0]
|
||||
self.final_column = self.final[1]
|
||||
#print(self.final)
|
||||
#print(self.final_row)
|
||||
#update
|
||||
self.x = self.board.boardlist[self.initial_row][self.initial_column].piece
|
||||
#print(self.board.boardlist[self.initial_row][self.initial_column].piece.name)
|
||||
#print(self.initial_row, self.initial_column)
|
||||
self.board.boardlist[self.initial_row][self.initial_column].piece = None
|
||||
#print(self.final_row, self.final_column)
|
||||
if (self.board.boardlist[self.final_row][self.final_column].has_piece()):
|
||||
if (self.board.boardlist[self.final_row][self.final_column].piece.name== 'king'):
|
||||
self.board.boardlist[self.final_row][self.final_column].piece = self.x
|
||||
|
Loading…
Reference in New Issue
Block a user