Exercise 43, kinda stuck...I need some help

Hi, I have been reading and studying Learn Python 3 The Hard Way for about a month now, and I am at exercise 43. I think I have a pretty clear understanding of concepts regarding classes and objects, but I am not sure how I can utilize classes. I am trying to make the game like Zed tells me to, but I don’t have any idea where to start, or what to do. Plus, having made another simple game before using if-elis-else, it just feels weird to use classes at this moment. Am I just overthinking this, or is there still something I am missing out, or is it something else? Should I really try to make the game myself, or should I try to understand how Zed solved the problem?

Please help me.

So, best thing to do is this:

  1. Don’t make your own game, make a copy of mine first.
  2. When you make the copy, start with the “shell” or structure of the game. Don’t add in any of the text, just get a simple 1 room little game going with the Engine and Map working.
  3. Then slowly add in each room, but without the long text.
  4. Then add the text, the whole time testing and running repeatedly after each change.

Once you get that working, then rip out my text and put in your own text. Don’t change the structure, or what rooms go to where, but just change the story to be your own.

Then, try adding some new rooms, add some new features like hit points, and keep changing it until it’s nothing like mine.

If you want to push further, then start over from scratch and make your own from nothing, but try to do it like this:

  1. Study my version as much as possible and take very good notes.
  2. Using only your notes, attempt to make your own version from nothing.
  3. If you get stuck and have to look at mine then update your notes with what was missing.
  4. Keep doing this until you’ve got your own game.

Try that and let me know what you come up with.

This is exactly what I was looking for Zed, thanks. I felt as if I was told a problem existed while reading ex43, but there was no clear statement of what the “problem” was.

E: Started forward and realized I had absolutely no idea what anything was doing. This is easily the most frustratingly difficult thing I have done in many, many years.

1 Like

Programming is very frustrating, I’d say more than almost anything I do. Part of the frustration at your level is that you simply don’t have all the tricks and experience yet, so you get lost. In that situation just copy something someone else wrote. Copy, copy, copy. After you’ve made a ton of copies of other people’s things you’ll have a better idea of how to make your own things.

The other part of the frustration (which is still my main frustration) is that a lot of the tech you use is written by other people who really don’t care what you think, and use their positions of power to force their code on you. For example, if you want to do something in a browser then you’re stuck using whatever Mozilla and Google decide is allowed, even if it’s terrible. I think a big part of programming is simply learning to either accept or route around other people’s bad ideas.

Which brings me to another suggestion for possible projects: When you make your copy, try to do it with less code and modern techniques. Too often people see code written that’s working and just assume it’s well done, but many times the tools have advanced that can make a lot of the code written 5-10 years ago obsolete. Try copying but make it smaller.

Finally, even if programming is frustrating, there’s a massive psychological payoff when you get something working. It’s a dramatic intellectual activity where you spend days being frustrated, isolated, and down because nothing’s working then suddenly you figure it out and YOU ARE A GOODDDDDDD! You can anything! Yes! And then two hours later it sucks again and you have to figure out what’s going on.

Pretty much everyone who codes lives for this rush.

1 Like

My interest in coding sparked at the age of 34 for two primary reasons:

  • I’m exceptionally good at my job (within information technology) to the point I’m bored with it and honestly, without learning to code I’m not going anywhere else.
  • I recently found myself amongst a group of individuals around the continental US who are extremely deep into info sec. After about 3 hours listening to some of the banter it made me realize even further “I don’t know a damn thing about this industry.”

The rush of figuring things out that made absolutely no sense before is probably the reason my ADHD ridden brain has been able to keep moving forwards with your book. It is also structured in a way that forces me to figure it out chasing the ah-hah moments.

I ended up walking away from ex 43 to a uDemy course. I’m going to work my way through this uDemy course (thanks uDemy for business) until I get to the point of this exercise and return to it.

Blockquote Part of the frustration at your level is that you simply don’t have all the tricks and experience yet, so you get lost.

This is exactly right. Yet, as you mentioned later, make the code shorter. Two of these program builds on uDemy so far I have built the code in 1-4 lines, where they built it in 8-12. Regardless, it’s reinforcing the areas I’m having trouble with.

Sounds like you’ve got the right idea.