Ex35 functions order and regexp

  1. Why are the functions written in this order?
    I inverted the order and it also works.
    I did: start, bear_room, gold_room, dead, cthulhu_room. I would have written it this way.
    I could invert bear_room and cthulhu_room, dead could go wherever, but I would definitely write start at the beginning.
  2. Now the gold_room logic…
    I need the user to enter a number equal or greater than 0, right?
    Did this in the most simple way and it works. Why use =~?
    I read about it in ruby docs and I found a few examples.
    What I needed /[0-9]/ was better explained under .match.
    I could use if /[0-9]/ =~ choice, but I just used if choice >= "0" and it works.
    Using to_i under it converts anything to integer so…
    If I write rose 45 as an answer it converts it to 45.
    Is using =~ better? Or it doesn’t matter and I could just use >= 0?
    If =~ is better, why?

Hey, sorry I totally missed this question. The default notifications on this are set such that you really don’t see anything when it’s posted. Anyway I think you’re way past this but if you still have questions go ahead and bug me.

Hey @Toby, can you please repost this for me and clean it up? First up, use [code] [/code] around your code to make it nicer:

[code]
# hi I am code
[/code]

Then, start a new topic. Don’t resurrect an old one (this one is a year old). Finally, write up a long description and don’t post all of you code. Try to narrow it down to just what is causing you problems. It’s important to list everything you’ve tried as well.

When you’re done, please delete this and I can help on your new post.