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?
txwooley
0
Junior Poster in Training
Recommended Answers
Jump to Postjust 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".
Jump to PostWhich Linux distro are you using? Regardless, if you want a visual editor for wxPython, I'd suggest wxGlade. It generates nice code but it may take a little getting used to using. I …
All 7 Replies
sillyboy
43
Practically a Master Poster
txwooley
commented:
Thanks
+1
txwooley
0
Junior Poster in Training
sillyboy
43
Practically a Master Poster
shadwickman
159
Posting Pro in Training
txwooley
0
Junior Poster in Training
shadwickman
159
Posting Pro in Training
txwooley
0
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.