while True:
game_info(player_1, player_2, wins_1, wins_2)
wins_1, wins_2 = move(board, wins_1, wins_2) # move() sætter et 'tegn' på board og returner win1/win2
if wins_1 or wins_2 == 1:
new_round = input("Do you want to play again?\nType yes or no: ").lower()
if new_round == "yes" or new_round == "y": # hvis skal spille igen clear board.
board = [ ['| ', '| ', '| '], ['| ', '| ', '| '], ['| ', '| ', '| '] ]
print("_____________________________________________________________\n" \
"player_2: %s is going to start, with the sign: %s|" % (player_2, sign))
elif new_round == "no" or new_round == "n": # hvis ikke: print hvem der vandt flest runder
pass
else:
"""HERE I WANT IT TO REPEAT IT ALL EXCEPT FOR THE TWO FIRST "game_info", and "move" """
在else语句中,它应该重复整个"而True"除了第一个" game_info"和"移动"功能。哪个应该被跳过。 这种方式在else语句之后立即结束,并要求玩家进行另一轮。
答案 0 :(得分:1)
我想你只是在循环外添加一个名为skip(或任何)的布尔值设置为false,并在else的情况下更改它。
然后将要排除的函数移动到
中if not skip:
#Functions that might be skipped
应该以低成本和干净的方式完成工作。