The three rules of Ruby Quiz:
1. Please do not post any solutions or spoiler discussion for this quiz until
48 hours have passed from the time on this message.
2. Support Ruby Quiz by submitting ideas as often as you can:
3. Enjoy!
···
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Sy has been searching for a Ruby scriptable MUD client via Ruby Talk and so far,
there hasn't been many helpful answers posted. Let's generate some.
This week's Ruby Quiz is to create a basic MUD client that must be scriptable in
the Ruby programming language. That's pretty vague, so let me see if I can
answer the questions I'm sure at least some of you still have.
What is a MUD?
MUD stands for Multi-User Dungeon/Dimension, depending on who you ask. They are
old text-based game servers with many role playing game elements to them.
Here's a fictional example of MUD playing:
> look
Sacred Grove
You are standing in the legendary resting place of The Dagger in The Stone.
Many have tried to free the mystical blade before, but none were worthy.
You can see the Castle of Evil to the west.
What's here:
The Dagger in The Stone
>look dagger
The all-powerful blade begs to be stolen!
>get dagger
You take the dagger. (Well, that was easy, wasn't it?)
>equip dagger
You are now the most dangerous warrior in the kingdom!
>west
The Gates of Castle of Evil
A very big, very black, very evil castle.
You can enter the castle to the north, or return to the Sacred Grove in
the east.
What's here:
Grog, Castle Guardian
>north
Grog move's in front of the gate and laughs mercilessly at you.
>kill grog
You slice Grog with the mighty dagger for 5 points of damage.
Grog chews off your left ear for 15 points of damage.
You swing at Grog and miss.
Grog breaks the little finger on your right hand for 10 points of damage.
...
If you would like to find some MUDs to play on, try a listing service like:
That siteh also has a MUD FAQ that probably answers a lot more questions than
this short introduction:
http://www.mudconnect.com/mudfaq/index.html
What is a MUD client?
While there are some advanced MUD protocols, the truth is that most of them talk
to any Telnet client just fine. We will focus on that for this quiz, to keep
things simple. Our goal is to create a Ruby scriptable Telnet client, more or
less.
What would we want to script?
Different people would have different requests I'm sure, but I'll give a few
examples. One idea is that you may want your client to recognize certain
commands commands and expand them into many MUD actions:
> prep for battle
> equip Vorpal Sword
You ready your weapon of choice.
> equip Diamond Armor
You protect yourself and still manage to look good.
> wear Ring of Invisibility
Where did you go?
...
Another interesting possibility is to have functionality where you can execute
code when certain output is seen from the server. Here's an example:
> kill grog
You slash Grog with the dagger for 2 points of damage.
Grog disarms you!
>get dagger
You take up the dagger.
You punch Grog in the mouth for 2 points of damage.
Grog sings. You take 25 points of damage to the ear drums.
>equip dagger
You're now armed and dangerous.
You slash Grog with the dagger for 5 points of damage.
Grog slugs you for 12 points of damage.
...
Here the idea is that the client noticed you were disarmed and automatically
retrieved and equipped your weapon. This saved you from having to quickly type
these commands in the middle of combat.
There are many other possibilities for scripting, but that gives us a starting
point.