Now check's square is marked with red color!

This commit is contained in:
spla 2020-11-18 12:54:49 +01:00
pare 7e8bfbdb63
commit efbe4c8f46

Veure arxiu

@ -883,6 +883,8 @@ if __name__ == '__main__':
else: else:
check = False
playing_user = next_move(username) playing_user = next_move(username)
board.push(chess.Move.from_uci(moving)) board.push(chess.Move.from_uci(moving))
@ -891,6 +893,16 @@ if __name__ == '__main__':
toot_text = "@"+username + " t'ha fet escac!" 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: if board.is_game_over() == True:
toot_text += "\nEscac i mat! \nEl guanyador és: " + "@"+username + '\n' toot_text += "\nEscac i mat! \nEl guanyador és: " + "@"+username + '\n'
@ -907,8 +919,20 @@ if __name__ == '__main__':
if username == white_user: if username == white_user:
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)) svgfile = chess.svg.board(board=board, orientation=chess.BLACK, lastmove=chess.Move.from_uci(moving))
else:
if check == True:
svgfile = chess.svg.board(board=board, orientation=chess.WHITE, lastmove=chess.Move.from_uci(moving), check=board.king(chess.WHITE))
else: else:
svgfile = chess.svg.board(board=board, orientation=chess.WHITE, lastmove=chess.Move.from_uci(moving)) svgfile = chess.svg.board(board=board, orientation=chess.WHITE, lastmove=chess.Move.from_uci(moving))