Mary Dickson Diaz

Code, Life, Learning

diving into the oh heck

This is a process post. Or, how I think through possible courses of action when I hit a roadblock.

Screen Shot 2015-08-16 at 8.41.12 PM

I’ve been making my way through Ruby the Hard Way bit by bit and I had a lot of fun this weekend with exercise 45, “you make a game.” This book and the Python version are both great learning tools for the language, and now that I’m getting to the end I see it’s a great tool for learning the basics of web deployment as well. *More than once* I have gone off on a side tangent and scoured the internet for a solution to my problem, only to be redirected back to the book and find that it addresses my question several exercises later.

I like my game, a simple text adventure based on Adrienne Rich’s poem ‘Diving into the Wreck,’ so much that I want to share it on the web with you, and that kicked off the latest rabbit hole. I still haven’t found a solution to this, so if any of you out there know enough to help me out, I would greatly appreciate it!

Here’s where I’m at:

I have a working console game here that relies on several classes that are subclasses of parent class Scene. It uses “puts” to display text, takes in player input via the console, applies logic to that input and returns a string that matches a map and creates new instances of the next subclass to move the narrative forward.

example:

Start –> Deck  –> Ladder –> Water –> Wreck

where each of the above is a subclass of “Scene.” You have to do some stuff before you can advance from one subclass to the next.

Later in the book, the author walks through the process of deploying this type of game via Sinatra. However, the example he uses is a static generation of one class, “Room,” where the only variables passed are the room name and description. The player gives a command, and depending on the value passed either proceeds to the next Room (generated as a new instance) or dies. So, there’s no room for all the awesome logic we wrote up in the earlier game. The author acknowledges that fact, and is like, “figure it out,” which– that is totally his prerogative, but I spent on a day trying and all I have to show for it is a headache.

If you don’t fully understand the above, that’s ok, really I want to share what my options are from here:

1. Try to refigure my game to fit the format that’s currently working (where everything is a ‘Room’ class and you go from one to the next).

2. Try to refigure the app to understand and navigate through subclasses.

Screen Shot 2015-08-18 at 2.46.50 PM

Well that didn’t work.

3. Use a different platform altogether, like Twine, which is perfect for this sort of thing but has its own programing language to learn (the more advanced concepts are currently eluding me).

Screen Shot 2015-08-18 at 4.05.45 PM

4. Release the game as a single Ruby file and tell you how to install and run it on the console.

5. Release the game as a repl.it link and tell you how to run it (and tell you to ignore the code on the left because it will spoil the game).

6. Give up.

For now, I’m focusing on 1) making the Twine game, since that seems to be the most interesting platform for the narrative, and I have faith that I can figure out the programing kinks; and 2) waiting until I can find someone to walk me through either of the Sinatra options. I’m really excited for class to start so that I’ll have a natural pool of people to ask for help on these things. I feel guilty asking for help over and over, but, I need it. I can only google my way to understanding so far.

Some days it feels like I’m staring at the solution and I *just can’t see it*.

.
.
.

^^I was going to end with this and then I realized I am sort of leaving you hanging, here. If you’d like to play the game in its current iteration, the easiest way is to use this repl.it link:

Diving into the Wreck, the console game

Follow the directions on the left (hit “run” to start) and minimize that code window please. 🙂

1 Comment

  1. I like it! Unfortunately, I don’t know anything about Ruby or Sinatra, so I can’t be of any immediate help. If I get a chance later (when I’m not at work), I’ll take a closer look.

Leave a Reply

© 2017 Mary Dickson Diaz

Theme by Anders NorenUp ↑