_ _ _ _____ _ | |
/ \ | |__ ___ _ _ | |_ |_ _|| |__ ___ | |
/ _ \ | '_ \ / _ \ | | | || __| | | | '_ \ / _ \ | |
/ ___ \ | |_) || (_) || |_| || |_ | | | | | || __/ | |
/_/ \_\|_.__/ \___/ \__,_| \__| |_| |_| |_| \___| | |
____ _ __ __ | |
/ ___| ___ _ __ | |__ ___ _ __ | \/ | __ _ ____ ___ | |
| | _ / _ \ | '_ \ | '_ \ / _ \| '__|| |\/| | / _` ||_ // _ \ | |
| |_| || (_) || |_) || | | || __/| | | | | || (_| | / /| __/ | |
\____| \___/ | .__/ |_| |_| \___||_| |_| |_| \__,_|/___|\___| | |
|_| | |
The GopherMaze is a project I made during the tilde.club Weekly | |
Webpage Workshop #5, to play with and learn more about the Gopher | |
protocol. | |
Gopher, being primarily a text-based interface, tends to remind me | |
of various text-based adventure games, which frequently required | |
you to move around a map by specifying cardinal directions (north, | |
south, east and west). | |
Accordingly, I figured it would be fun to make a simple maze as a | |
Gopher site, with the path through the maze being represented by | |
the directory hierarchy. | |
Play the Game | |
__ __ _ __ _ __ __ | |
/ // /___ _ __ (_)/ /_ | | /| / /___ ____ / /__ ___ | |
/ _ // _ \| |/|/ / / // __/ | |/ |/ // _ \ / __// '_/(_-< | |
/_//_/ \___/|__,__/ /_/ \__/ |__/|__/ \___//_/ /_/\_\/___/ | |
The first thing I needed was to generate a maze, so I headed over | |
to Wikipedia to remind myself of some simple maze algorithms, and | |
ended up using a randomized Prim's algorithm to generate the maze. | |
I chose not to use an algorithm which would include loops to | |
simplify generating the navigation links on each page, and also | |
because I didn't want to spend too long on this project! | |
I then hacked up some code to render the maze out to ASCII text, | |
with the ability to mark the start, finish and a specific location | |
within the maze, which would represent the position of the player. | |
This would be displayed on each of the individual pages. | |
I considered using the grid location of each cell in the maze to | |
encode the URL. This would have removed the requirement for | |
subdirectories, but would mean anyone could cheat to jump to the | |
end of the maze. By using subdirectories, it forces the correct | |
solution to the maze to be discovered. After all, this is serious | |
business -- no cheating allowed! | |
I also hacked in some very ugly code to make sure the maze was | |
hard enough -- as it's randomly generated, some of the mazes are | |
particularly easy. This involves checking to make sure you can | |
always go both directions from the start square, that you have to | |
go in every direction at least once to get to the finish, and | |
that there's a minimum number of steps required. | |
The result is a total of 160 gophermap files, one for each cell, | |
in 159 subdirectories. | |
____ ___ ____ | |
/ __// _ | / __ \ | |
/ _/ / __ |/ /_/ / | |
/_/ /_/ |_|\___\_\ | |
Q. I can't find my way out! | |
A. Try drawing on your screen with a Sharpie, it really does make | |
things easier. However, if you still can't find your way out, | |
here is the complete set of steps required: | |
E, S, S, S, S, S, S, S, E, S, E, N, E, N, E, E, E, N, N, N, N, | |
N, N, E, E, E, E, E, E, S, S, E, S, S, E, S, S, W, S, S, S, E | |
____ | |
/ _/___ ___ __ __ ___ ___ | |
_/ / (_-< (_-</ // // -_)(_-< | |
/___//___//___/\_,_/ \__//___/ | |
I originally started using relative links to go 'back' in the maze, | |
so for example, if you went east from the start location, then the | |
west direction would load '../', the previous directory. | |
This worked perfectly in the web proxy, but when attempting to | |
navigate to these relative links from the shell in Lynx, I would | |
get an error. | |
I'm not sure if this was me doing something wrong, or if there is | |
no official ability to specify the parent directory in a gopher | |
link. |