# variable 'game_over' will be used to flag the end of the game.
game_over = 0
while not game_over:
# handle one turn of the game here.
.
.
# somewhere, we need to decide that the game is over.
if .....:
game_over = 1