def _finish(won=False): IOUtils.clear() if won: print "You won!" answer = "" while (answer.lower() != "y") and (answer.lower() != "n"): answer = raw_input("Would you like to play again? y/N: ") if answer.lower() == "y": return True elif (answer == "") or (answer.lower() == "n"): return False
def _loop(): while _running: # Drawing IOUtils.clear() board.draw() # Updating updateVal = _update(IOUtils.getch()) if updateVal != None: return updateVal if _hasWon(): return _finish(True)