Problem with LPTHW Exercise 52

Hello Everyone,

I am trying to do the exercise 52 in LP3THW and I am kind of stuck. The problem is not that I don’t know how to do it, but rather what exactly to do.

The gothon game is linear. This means in each room there are two options: either die, or choose the right option and go forward/go to the next room. This exercise asks us to make it possible for the game to shuffle the planisphere around, but I don’t see the point of this because of the reason I explained above.

I had the same problem the first time around too. I didn’t understand why Mr. Shaw created engine and map for the game, instead of just making different functions. This would also make it possible for the player to jump around the map, would it not?

Can someone give me a clue as to how the game is supposed to work, so I can hopefully get a foothold in and start working on the problem, please?

Thank you in advance.

Honestly, if you’ve made it thus far, I don’t think it’s important that you do it “the right way”. Just get your creative juices going, come up with a more interesting game plan and implement it in whatever way that works (maybe even in different ways).

And sure, you don’t need the structure from the book, functions alone would probably work just fine.

Thank you for the answer.

While creating my own game, or refactoring the one I created from around the middle of the book is a good idea, I don’t think it would be intellectually honest. I feel like I am missing something here, and I would like to finish this book completely. If I could just have a clear goal, an idea of what exactly I should fix, that would help a lot. Because without knowing the “why”, it’s really hard for me to wrap my head around the “how”.

Hopefully Mr. @zedshaw can shed some light on this.

Have a look at this post and how @leonvdb solved ex52. He did it in a very creative way. Here is his post:

and here the direct link:
http://www.davidsimulator.com/

One problem you may have is, that it is in german rather than in english. But you should get the point.

  1. In theory you should be able to restructure the map as people move in, but you can probably just skip this or interpret it how you want. One way is to add state to certain rooms, like something new shows up in it after something happens in another room.

  2. You should totally try to rewrite the engine and map to see if your ideas are better. I’d say, take the Gothon game, CHANGE NOTHING IN IT, then try your idea with just replacing the engine code to see if it works.

Thank you for the answer, @zedshaw.

As far as I understand, the game is still supposed to stay linear, right? It’s still supposed to start with central corridor and end in the escape pod.

Enter this room, there are a couple of choices, pick the right one, move to the next room, rinse and repeat. Would refactoring the game you wrote in exercise 43 to work on web be enough? Would that be cheating? If I implement state to rooms, can I also change the story a bit?

I apologize if I am asking too many questions, but I have been reluctantly putting off learning python for a few days now because I felt very lost.

Yeah I’d say go ahead and refactor that version of the game instead. Whatever works actually. The point is to just get the idea that you can make rooms into data rather than code, and that the reason you might do that is so you can rework it easier.

After my last post I have made a lot of progress actually. I got the first room working and improved from there. I have gotten most of the game working, although I have not even started writing the unit testing. I am not sure if I am doing the things the way you intended the reader to do, but the game seems to be working well.

Most of the time it feels like my solutions are unnecessarily complicated because I don’t know a better way to do them, but still the process is very enjoyable.

I think at this point in your learning any progress that gets you through a project is good progress. Don’t worry about it until the end and then review it.