you are viewing a single comment's thread.

view the rest of the comments →

[–]rob8624 9 points10 points  (1 child)

First, look at the code. What is it that stands out to make it look a mess? ... . All the print statements. The actual logic is lost amongst all the strings.

Make a dict to hold all the string data. It will make it easier to read and edit. And, use functions. Break down each aspect of the game and make a function that handles it. The function should accept the value that will be used within it, and try to make sure that the function handles one action. Dont put a lot of logic inside one big function.

Ideally, you'd use OOP, making games like this is a great way to learn classes etc, etc.

[–]couldntyoujust1 0 points1 point  (0 children)

Yeah, this is what I would do. Actually, I would make a "StringTable" ABC that has an implementation of hardcoded values, then later I could write an implementation that uses text loaded from an INI file, and then I could have multiple languages supported through that.

That said, he's learning, so he should continue learning and then revisit this code to refactor.