CLIAdventure

From XPUB & Lens-Based wiki

Command-line Adventure

Created in the 1970's, the text-based game Colossal Cave Adventure (also known as simpy adventure, or by it's original command name "advent") came to define an entire genre of text-based interactive fiction. (Games of this genre, which continue to be produced today, were sometimes referred to as "adventure" games.) The game reflects and has had a deep impact on computer culture. Adventure precedes the perhaps better-known game Zork.

A Historical Perspective on the game

A taste of Adventure

The original adventure game has been recreated many times, and can be experienced on Linux (and other platforms) via emulation. Emulation software simulates the workings of particular (often historical) computer platforms allowing old programs to be run more or less as they did in the past.

You need to install frotz, a "z-machine" emulator.

sudo apt-get install frotz


You can now start frotz by typing it at the Terminal, but we need the actual Adventure program as well. You can download a version of "adventure" written for the z-machine from the command-line using wget:

wget http://www.ifarchive.org/if-archive/games/infocom/Advent.z5


Finally, start the game by typing:

frotz Advent.z5


Additional links

Filesystem adventure

When you start the Terminal program, you are running a special program called the shell. Similar to in the adventure game, one can think of the shell as a place to explore the files on your computer.

|| physical metaphor || shell command || || Moving from room to room || cd || || Moving "upward" in the hierarchy || .. || || Looking around || ls || || Looking more carefully || ls -l, ls -a ||

|| Looking for specific things || Filtering with wildcards: *, ?, abc || || Getting help || man || || Feeling in front of you with your hands || TAB key || || Teleportation || Absolute paths (/...), and ~ || || Creating a new room || mkdir || || Removing an (empty) room || rmdir || || Renaming and moving a room || mv || || Duplicating an item || cp || || Duplicating a room and its contents || cp -r || || Killing items dead || rm (kind of dangerous) || || Killing rooms & items "deeply" || rm -r (really dangerous!) ||

Seeing the forest through the tree

From the shell you can also start other programs. The tree command is a useful tool to get a bit more of an overview of the structure of your files. Most likely it's not already installed on your system, to get it, you type:

sudo apt-get install tree


Check out the tree's man page for useful options.

Filesystem Treemaps

A Treemap is sometimes a useful visualisation for understanding how much space files are using on your computer. The baobab command (aka "Disk Usage Analyzer" in the Applications->Utilties menu) offers a treemap view of files. The FSView plugin of the Konqueror web & file browser also has a treemap view.

Exercise

Create a "gamespace" using file commands (for instance, a city, a forest). Note that unlike the "adventure" world, the filesystem is organized in a hierarchy, with rooms (directories) placed inside other rooms. So, for instance, you might create a "city" folder with "neighborhoods" inside it, and so on. You should create a structure with at least 3 levels of "depth".

Once your structure is set, use the cd, ls, and tree commands to move around it.

Try moving items around in your space (using mv).

Trying making copies of items (using cp and cp -r)