Archive for the ‘Books’ Category

Discovering Ruby With Ruby Warrior

Thursday, May 14th, 2009
Code from Level 6

Code from Level 6

Thanks to the FV.rb last night I discovered Ruby Warrior, a neat and fun way of learning ruby.  It goes like this….

First, head to http://github.com/ryanb/ruby-warrior/tree/master and download the tree by using “git clone“, then simply run “bin/rubywarrior” out of the main ruby-warrior directory that the git clone command creates.  The first run will create a profile and set up the initial part of the “game”.

The “game” is a bit like the old adventure text games, with a simple ASCII “dungeon” that you see your guy move through, and as the levels progress you will encounter monsters, harder monsters, captives to rescue, and so on as you move from one side of the dungeon to the stairs on the other side.  The system is turn based, so you are basically creating yourself a little state machine.  You basically check to see if there’s something in front of you and if not walk, if it’s an enemy, attack, etc.

To do this you end up doing something like this:

  1. You look at the README file in the ruby-warrior/beginner-tower/level-001/ directory.  You may have “intermediate-tower” instead of beginner depending on the level you chose during the initial setup.
  2. Follow what the README file says and edit the file ruby-warrior/beginner-tower/level-001/player.rb adding code to make your warrior move and fight.
  3. Run bin/rubywarrior and see how well your warrior moves and fights.  It will either succeed and allow you to continue to the next level (in which case go to step 1, substituting the right number in the “level-00N” directory), or you will fail, in which case, re-edit the warrior.rb file and try again.

The game isn’t for complete and total programming n00bs, but might be a bit simple for people who know programming, but not ruby :)   It starts out with simple commands and simple if/then/else control structures.  However, it does make it cool and interesting enough that it has kept my interest for at least until now.

Bought 2 Rails Books

Monday, May 11th, 2009

Got a couple of Ruby on Rails books out at the local Chapters today. After hearing a bunch of reviews, I picked up “Head First Rails”. This has a very unique way of teaching, obvious not only from the front page of the book (which immediately said to me “get rid of this and go onto the next book, this is crap”) to the inside and first chapter I’m going through. However, give it a shot and read through the introduction chapter and give it a shot. It’s different for sure, but in a good way.  One of the biggest things for me was the first chapter wasn’t a “how to install rails” section.  It really gets right down to business, which is a nice change.

Also, on a whim I grabbed “Advanced Rails Recipes”. The latter one I had seen before, but the idea of just having a book full of “how to do random thing X” was fairly appealing.  I don’t technically need this just yet, but it’ll be nice to have a paper copy for when I do reach that stage :)