TEXT ADVENTURE LOL
Today is the antepenultimate day of NaCreSoMo! I do love that word, though it will be a little sad for the month to end.
Getting away from the stories, today’s post is a tiny tiny little text adventure, inspired by a project for the class I TAed back in college.
Lab
There are lots of computers here. [up, code]
? up
Soda Hall
The home of Computer Science at UC Berkeley. [down, out]
? out
The Outside World
It's bright. You are likely to be eaten by a flyerer. [in]
?
But to give it an extra twist, I wrote it in Lolcode.
BTW explore!
I HAS A direction, I HAS A destination
IM IN YR head, BTW infinite loop
VISIBLE player'Z location'Z name
VISIBLE player'Z location'Z description
VISIBLE "", BTW blank line
VISIBLE "? " !
GIMMEH direction
BOTH SAEM direction AN "", O RLY?
YA RLY
GTFO head, BTW break!
OIC
player'Z location IZ going direction, destination R IT
BOTH SAEM destination AN NOOB, O RLY?
YA RLY
VISIBLE "HA HA NOOB U CANT GO THAT WAY"
VISIBLE ""
NO WAI
player'Z location R destination
OIC
KTHX
(view the whole thing as a Gist on Github1)
Lolcode is a language that started out as a joke but rapidly acquired a community to make it a real thing…which then disintegrated about a year later. Semantically, it’s very much like JavaScript (weak typing and prototype-based inheritance), while also managing to look ridiculous.
(BTW is the syntax for comments, BTW.)
This particular code is intended for use with my own Lolcode interpreter, written in Ruby. (I did not just do this tonight…it was a spare time project I hacked together last year.)
If you’re interested in learning Ruby, there’s an easy, interactive tutorial at tryruby.org.
And if you’re interested in actually getting this working on your machine, you can:
-
Learn how to run Ruby on your machine.
-
Install the
treetopgem. (What is a gem?)gem install treetop # if you need admin privileges sudo gem install treetop -
Download my Lolcode implementation from Github.
-
Download
adventure.lolandpairs.lolfrom the Gist above. Make sure they’re in the same folder. -
lolcode-rb/bin/lolcode adventure.lol
Esoteric programming languages are a lot of fun. Some of them are minimalistic:
>+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.>>>++++++++[<++++>-]
<.>>>++++++++++[<+++++++++>-]<---.<<<<.+++.------.--------.>>+.
Some of them are artistic:
0 91+ -01p>0 91+ -11p>01g11g:#v_ v
>!#@_01p ^ >/02p01g11g%12p02g11g*12g+:22p01g-#v_ v
^- +19 :+1g10$< v,+19.g22.g21.g20.g11.g10<
11g1+: 91+ -!#^_11p ^ > >
And some of them are pretty useless:
++9q
(Other interesting adjectives: invisible and evil.)
-
Only adventure.lol was written today; I dug pairs.lol out of my past project. ↩︎