Fix #7. Recoded check and checkmates warnings

This commit is contained in:
spla 2020-11-23 11:42:04 +01:00
pare 3253f95d5f
commit c7b17abe18

Veure arxiu

@ -1055,9 +1055,7 @@ if __name__ == '__main__':
board.push(chess.Move.from_uci(moving))
if board.is_check() == True:
toot_text = "@"+playing_user + ": " + "@"+username + " t'ha fet escac!"
if bool(board.is_check()):
if username == white_user:
@ -1073,16 +1071,28 @@ if __name__ == '__main__':
game_moves = board.ply()
toot_text += "\nEscac i mat! (en " + str(game_moves) + " moviments)" + "\n\nEl guanyador és: " + "@"+username + '\n'
close_game()
checkmate = True
else:
checkmate = False
if check == True and checkmate == False:
toot_text = "@"+playing_user + " " + username + " t'ha fet escac!\n"
elif check == True and checkmate == True:
toot_text = "\nEscac i mat! (en " + str(game_moves) + " moviments)" + "\n\nEl guanyador és: " + "@"+username + '\n'
toot_text += "\n@"+playing_user + ": ben jugat!" + "\n"
close_game()
toot_text += "\nPartides guanyades:" + "\n"
played_games, wins = get_stats(username)
toot_text += "\nPartides guanyades" + "\n"
toot_text += username + ": " + str(wins) + " de " + str(played_games) + "\n"
played_games, wins = get_stats(playing_user)
@ -1091,11 +1101,11 @@ if __name__ == '__main__':
else:
toot_text = "@"+playing_user + ' el teu torn.'+ '\n'
toot_text = "@"+playing_user + ' el teu torn.'+ '\n'
if capture:
if capture == True and checkmate == False:
toot_text += "\n* has perdut " + piece_name + "!\n"
toot_text += "\n* has perdut " + piece_name + "!\n"
toot_text += '\n#escacs' + '\n'