Mutagen Demo: A Gorey Fate

Hide this explanation

Mutagen is a simple Javascript library for generating pseudorandom strings of text, according to a grammar.

By "pseudorandom", we mean that if you put in a number, you'll get out an apparently arbitrary string. That's what happens when you hit the button on this page: it picks a number and displays the string that comes out. If you keep hitting the button, you see different numbers, and thus different strings. But if you paste in a particular number, you'll get the specific string generated by that number. A given number always generates the same string.

(For example, 1 produces "Chloe, a girl, tumbled into a hole one afternoon last month." The number 2 is "Last Wednesday, Emmett melted." Try it.)

What good is this? I used this sort of technique in my game Hunter, in Darkness. I built a maze where each room was completely described by a single integer -- I generated the room description, the exits, and the numbers of the adjacent rooms from that seed number. So if two different players mapped the maze, or if one player returned to a room he'd been in previously, the location would be consistent.

(It's also used in the "cave" index of my web site.)

This is a simple demo of the idea, written in Javascript. The source code is freely available:

Press the to discover an uncomfortable fate.

Requires Javascript.

Seed value:


Last updated April 17, 2015.

Zarfhome (map) (down)