From: MikkelFJ Date: 2001-07-20T19:35:16+09:00 Subject: [ruby-talk:18183] Re: Looking for Ruby programming exercises "Wayne Vucenic" wrote in message news:6Aw57.36700$d4.1501433@e420r-atl1.usenetserver.com... > I've been learning Ruby, mostly with the Pickaxe book, and it's going > well. > > But I realize that what I really need are some Ruby programming > exercises... the kind that often appear at the end of each chapter I wrote an online text adventure game as an excercise. It wasn't a multiuser game, but it allowed multiple users to connect simultanously via telnet. It wouldn't have been difficult to add a feature to allow multiple users in the same game. It weighed in at about approx. 400 lines. Of course the game was rather basic, but you could move around, examine things and solve a simple problem. Ruby is perfect for the job because it is really brilliantly simple to handle the adventure infrastructure and command parsing. It is also perfect for setting up a socket server. This is a good excercise because it is already working as a game after 10 lines. The you get hooked and new problems arrive automatically. The most difficult part was actually to emulate telnet such that backspace would work, because Ruby doesn't have a telnet server. Although the game play was fairly limited, it also proved an excellent way to demonstrate Ruby to my co-workers - particularly because they could play it without having to install Ruby, and then later I could show how compact and easily understood the code were. I would never have been able to do something similar that fast with so little code. Mikkel