There are many ways you can earn points on a level.ĭefeat an enemy to add his max health to your score Your objective is to not only reach the stairs, but to get the highest score you can. Alter the player.rb file and run rubywarrior again to play the next level. Once you pass a level (by reaching the stairs), the profile README will be updated for the next level. You are not punished by this, you simply need to go back to your player.rb, improve your code, and try again. Losing all of your health will cause you to fail the level. You must take into account everything that may happen on that level and give your warrior the proper instructions from the start.
#Ruby download version for beginners code
You cannot change your code in the middle of a level. On each one, your “play_turn” method is called along with any enemy's. The play happens through a series of turns. Once you are done editing player.rb, save the file and run the “rubywarrior” command again to start playing the level. Here is a simple example which will instruct the warrior to attack if he feels an enemy, otherwise he will walk forward. See the README in your profile's directory for details on what abilities your warrior has available on the current level. With each level your abilities will grow along with the difficulty. Your objective is to fill this “play_turn” method with commands to instruct the warrior what to do. This will create a rubywarrior directory in your current location where you will find a player.rb file in your profile's directory containing this: class Player def play_turn( warrior) Then run the “rubywarrior” command to setup your profile.
#Ruby download version for beginners install
Getting Started ¶ ↑įirst install the gem. If you have an old profile using the “level-00*” structure then move the contents of the last level into the parent directory. NOTE: The player directory structure changed on July 18, 2009. You must give the Warrior enough artificial intelligence up-front to find his own way.
You have some idea of what each floor contains, but you never know for certain what will happen. On each floor you need to write a Ruby script to instruct the warrior to battle enemies, rescue captives, and reach the stairs. You play as a warrior climbing a tall tower to reach the precious Ruby at the top level. This is a game designed to teach the Ruby language and artificial intelligence in a fun, interactive way.