RCRPG/Ruby: Difference between revisions
m
Fixed syntax highlighting.
(Created page with '{{collection|RCRPG}} This Ruby version of RCRPG implements a text interface. ==Language Idioms== This program illustrates some of the interesting aspects of Ruby: * obj…') |
m (Fixed syntax highlighting.) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 2:
This [[Ruby]] version of [[RCRPG]] implements a text interface.
===Language Idioms===
This program illustrates some of the interesting aspects of Ruby:
Line 11:
* higher-order functions like map and select, using blocks
==
The objective of the game is to find your way to the exit (which is located at 1, 1, 5).
===Commands===
Direction commands:<pre>north, south, east, west, up, down</pre>Type these in order to go in a certain direction. There must be a hole in the wall in that direction. All directions are aliased by their first letter (ie. you can go south by just typing s). In order to go up, you must have a ladder in your current room. In order to go down, the room below you must have a ladder in it.
Attack:<pre>attack <
Take/Drop:<pre>take <
drop <
View Inventory:<pre>inventory</pre>
Equip an item:<pre>equip <
Create an alias:<pre>alias <
===Code===
<
class Vector
Line 265:
print "> "
process_cmd gets.chop.downcase
end</
|