Now check's square is marked with red color!
This commit is contained in:
pare
7e8bfbdb63
commit
efbe4c8f46
S'han modificat 1 arxius amb 26 adicions i 2 eliminacions
|
@ -883,6 +883,8 @@ if __name__ == '__main__':
|
|||
|
||||
else:
|
||||
|
||||
check = False
|
||||
|
||||
playing_user = next_move(username)
|
||||
|
||||
board.push(chess.Move.from_uci(moving))
|
||||
|
@ -891,6 +893,16 @@ if __name__ == '__main__':
|
|||
|
||||
toot_text = "@"+username + " t'ha fet escac!"
|
||||
|
||||
if username == white_user:
|
||||
|
||||
king_square = board.king(chess.BLACK)
|
||||
check = True
|
||||
|
||||
else:
|
||||
|
||||
king_square = board.king(chess.WHITE)
|
||||
check = True
|
||||
|
||||
if board.is_game_over() == True:
|
||||
|
||||
toot_text += "\nEscac i mat! \nEl guanyador és: " + "@"+username + '\n'
|
||||
|
@ -907,11 +919,23 @@ if __name__ == '__main__':
|
|||
|
||||
if username == white_user:
|
||||
|
||||
svgfile = chess.svg.board(board=board, orientation=chess.BLACK, lastmove=chess.Move.from_uci(moving))
|
||||
if check == True:
|
||||
|
||||
svgfile = chess.svg.board(board=board, orientation=chess.BLACK, lastmove=chess.Move.from_uci(moving), check=board.king(chess.BLACK))
|
||||
|
||||
else:
|
||||
|
||||
svgfile = chess.svg.board(board=board, orientation=chess.BLACK, lastmove=chess.Move.from_uci(moving))
|
||||
|
||||
else:
|
||||
|
||||
svgfile = chess.svg.board(board=board, orientation=chess.WHITE, lastmove=chess.Move.from_uci(moving))
|
||||
if check == True:
|
||||
|
||||
svgfile = chess.svg.board(board=board, orientation=chess.WHITE, lastmove=chess.Move.from_uci(moving), check=board.king(chess.WHITE))
|
||||
|
||||
else:
|
||||
|
||||
svgfile = chess.svg.board(board=board, orientation=chess.WHITE, lastmove=chess.Move.from_uci(moving))
|
||||
|
||||
board_file = 'games/' + str(game_id) + '_board.png'
|
||||
|
||||
|
|
Loading…
Referencia en una nova incidència