I have written a poker game in Python and have it fairly well finished. My hang-up now is an option to play again. Most of the game is in a function called playHand() which re-runs as long as you still have money, but if you lose all of your money, or the computer characters all lose theirs, I want to give an option to 'play again'. This would require basically re-running the entire program from the beginning. I have seen others use something like "if name == __main__:" but I'm not sure how that works or if that is what I need. How do I re-start the entire program so you could re-play the game as if you just started it?
Jump to Post
just move the entry/start point of your game into a function, and then at the end of that function (even after) you can give the use the option to "play again".
All 7 Replies
We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.