From: Henry Maddocks Date: 2012-09-21T07:02:40+09:00 Subject: Re: still learning by doing - connecting rooms in a game On 21/09/2012, at 5:11 AM, "Sebastjan H." wrote: > > I am doing this as a task in the book learning ruby the hard way by Zed. This book is considered harmful. > Maybe I've made a mistake for trying to put everything in the room > classes and not just the room descriptions. > > Anyway, I maintain the code here: > https://code.launchpad.net/~sebastjan-hribar/zombies/trunk > > I would appreciate any pointers. I am stuck. I still have a lot of work > to do with various descriptions and particular activities in rooms, but > the main problem is this room connection. I wouldn't have written the code this way, but I don't know if you are following the book or not. To start with I would have… One Room class that takes a name and description and a visited attribute. Not a class for each room as you have done. Create a Map structure that defines the room layout. Something like [ {:room => :kitchen, :next_rooms => {:north => :living_room, :south => :basement}}, {:room => : living_room, :next_rooms => {:north => :bathroom, :south => :kitchen}}, ... ] Henry