Make your own free website on Tripod.com

How to Build Symbol Maps

Main  |   Random Names  |   Name Builder  |   Symbol Map Editor  |   Coding

What's a Symbol Map?

A symbol map is input text that the RandMap generator uses to generate random text.
It's like a template that tells the generator how to create a piece of text.
Here is a simple symbol map:

<root>   D<vowel>g
<vowel>      i
<vowel>      o
<vowel>      u

This map will possibly generate the words Dig, Dog, or Dug.
To customize the output of Randmap, all you have to do is write a new symbol map.
All the details are explained below.

Writing Maps

Writing symbol maps isnt hard but coming up with one that generates good random names might take a few tries and some creativity / imagination

On the Symbol Map Editor page you can type (or paste in) a symbol map, then click Generate to generate text using that map.
If you want to save a symbol map to your hard drive you have to copy and paste the text into a text editor like Textpad, Simpletext or Notepad.

The Symbol Map Editor Page Controls

On the Symbol Map Editor page, the main edit box is where you can type in a symbol map. Here's what the other controls do:

Here's some unicode codes you can put into the From Code box.
The basic ASCII/Unicode codes 32 to 127 will also work

Basics

A symbol map is based on the simple idea of replacing one thing (a symbol) with another thing (a replacement expression).
Here's a simple symbol map:

<root>   left
<root>   right

When the generator runs this map, half the time it'll output "left" and half the time "right".
You can copy and paste this or any of the other example maps into the editor and click Generate to see what they do

Replacement Lines

Each replacement line in a symbol map tells the generator one possible way to replace a symbol.
A line is made up of either two or three parts that must be in this order:

1) Source Symbol - a symbol is between <   > and is replaced by text when the generator generates output

2) Replacement Expression - this tells the generator what to replace the symbol with

3) Weight - an optional number that affects how often the source symbol will be replaced by this particular replacement expression

A line always starts out with a symbol.
The first symbol on a line is a source symbol whatever comes after it (except for the weight at the end) is the replacement expression.
So in the line <root>   left , <root> is the source symbol and "left" is the replacement expression.
This line tells the generator: replace <root> with left
And the second line in the above map tells the generator: replace <root> with right
Since there's two possible replacements for <root>, the generator will choose between them randomly.
There can be any number of lines with the same source symbol.
Normally each replacement line has an equal chance of being picked as a replacement for the source symbol,
but weights can be used to change this behavior.

Symbols

A symbol starts with < and ends with >
Between the two angle brackets is the symbol's name, which can be any numbers, letters or other characters you want except the characters < or > .
The symbol <root> is a special symbol. Root is the very first symbol that the generator starts out with when it begins generating a line of text.
This also means that every symbol map needs to have at least one line that begins with the <root> symbol.
Take a look at this map which simulates a coin flip:

<root>   <coin>

<coin>   heads
<coin>   tails

When the generator runs this map, it starts out by looking at <root> (because it always starts with root).
This map only gives the generator one possible replacement for root: the symbol <coin>
So next the generator goes to <coin>.
The generator sees two possible replacements for the symbol <coin>: 'heads' and 'tails'
So the generator picks one of the replacement expressions randomly and outputs the text: either "heads" or "tails".

Weights

By putting a weight at the end of a line, you can control how often a replacement expression will be used.
In the coin map above, the lines for 'heads' and 'tails' don't have a weight specified, so the generator gives each of them a default weight of 10.
Since each of these lines has an equal weight of 10, they'll be used equally as often -- 'heads' 50% of the time and 'tails' 50%.
If you gave the lines weights like this:

<root>  <coin>

<coin>   heads    2
<coin>   tails    1

Then <coin> would be replaced by 'heads' more often than by 'tails'.
The sum of the weights is now 1 + 2 = 3 so 'heads' would be used an average of 2 out of 3 times and 'tails' would be used 1 out of 3 times.
And if you used two numbers like 75 and 25 that added to 100, you'd get 75% chance and 25% chance.
You could add a third line like this:

<root>   <coin>

<coin>   heads    2
<coin>   tails    2
<coin>   edge     1

Now one in every five coins will land on edge.
Also, setting a line's weight to 0 will prevent that line from ever being picked as a replacement.
And remember that whenever a line doesn't have a weight specified at the end, it will automatically be given a weight of 10.
So the first line on the previous map is treated exactly as if it said: <root> <coin> 10

Comments

Comments just let you add notes to a map and have no effect on what the map generates.
There are two ways to write comments. Here is an example:

/* Magic Eight ball map
 Ask it a question,
 it knows all answers */
<root>   yeah
<root>   maybe   20
<root>   nah
<root>   "why not?"
<root>   sorta   //trust the eight ball!

The first way is to put /* before the comment and */ after a comment.
These comments can go accross more than one line.
The second way is to write // and everything after the slashes until the end of the line will be a comment.

More Complicated Replacement Expressions

The replacement expression that comes after a source symbol can be made up of 3 basic elements: bare characters, strings, and symbols.

<root>   bareCharacters
<root>   "this is a string!!"    //a string is always enclosed in double quotes
<root>   <symbol>

<symbol>   day
<symbol>   night

/* you can put many of these elements next to each other */
<root>   "It rained for 30 " <symbol> s

Bare characters are the capital and lowercase letters A to Z. They are called 'bare' because they dont need to be inside quotes.
If you want to use spaces, punctuation, digits, characters like é or any characters besides a to z and A to Z, you have to put them inside double quotes " "
A replacement expression can be made up of any number of these elements next to each other.
Here's an example of the same symbol being used twice in one line. Each time the symbol appears it'll be replaced randomly.

<root>  "You roll 2 dice and get a " <die> " and a " <die> 
<root>  "You flip 2 coins and get " <coin>s " and " <coin>s

<die>   "1"
<die>   "2"
<die>   "3"
<die>   "4"
<die>   "5"
<die>   "6"

<coin> head
<coin> tail

One simple but effective way to generate names is to use multiple symbols next to each other,
where each symbol is replaced by part of a name like this:

<root>	<1><2><3>

<1>	Ga
<1>	Ce
<1>	E

<2>	ri
<2>	ro
<2>	dri

<3>	ad
<3>	el
<3>	wyn
<3>	eth
<3>	ck

If you want a double quote " to appear in the generated text, write \" inside of double quotes like this:

<root>	"Thag the caveman says \"" <word> "\""
<word>	"uga! " <word>   5
<word>	"uga!"           2

You can also use two quotes with nothing inside "" if you want a symbol to possibly produce no text.

Recursion

Another thing - the <word> symbol above can be considered "recursive" because there's a possibility a <word> will be replaced by another <word>
Some recursive symbols look like they will actually go on forever like this one:

<root>         Mwa<recursive>"!"
<recursive>    ha<recursive>

This tells the generator to replace a <recursive> with 2 characters and another <recursive>,
But then it'll replace the new <recursive> with 2 characters and yet another <recursive>... And there's no end to it.
The generator, however, will only replace a preset maximum number of symbols each time it generates text.
This means a map like the above one won't actually produce an endless line of text.

Constants

Constants are a new feature in Randmap version 2.
You can now choose to make a symbol "constant". The only difference between a regular symbol and a constant one is that a constant symbol will
produce the same text each time it is encountered by the generator, while a normal symbol will be randomly evaluated each time its encountered.
To make the symbol <xyz> a constant, for example, you just need to add the line <xyz> (const) to the symbol map.
Here's an example symbol map using a constant symbol. Running it a few times should make the difference between constant and normal symbols clear.

<root> "constant: " <c><c><c> " normal: " <n><n><n>

<c> (const)
<c> a
<c> b
<c> c

<n> a
<n> b
<n> c

The End

Main  |   Random Names  |   Name Builder  |   Symbol Map Editor  |   Coding