You can make a table whose first column is numbers and whose second column is table names. Then choose a row in it with (whatever you decide to call the first column) of the theory, extract the table name entry, and do what you need to it. An important thing to note is that when you want to talk about a table in some variable fashion, the kind you’re using is actually called “table name.”

Here’s a possibly somewhat opaque example of how it might work. (I just hacked the moving action to redirect it from moving from one position to another, so I didn’t have to define a new action.)

[code]“Les Tables of Tables”

The theory is a number that varies. The theory is 1.

Chessatorium is a room. “You see the board here in position [theory]. The allowable moves are [allowable moves].”

Table of first position

move result

north 2

west 3

Table of second position

move result

east 1

south 4

Table of third position

move result

north 1

east 2

Table of fourth position

move result

east 1

west 3

Table of theory tables

position corresponding table

1 Table of first position

2 Table of second position

3 Table of third position

4 Table of fourth position

To decide which table name is the corresponding table of (N - a number):

unless there is a position of N in the table of theory tables:

decide on table of first position; [this should never happen, it’s a failsafe]

choose a row with position of N in the table of theory tables;

decide on the corresponding table entry.

To say allowable moves:

Let L be a list of directions;

repeat through the corresponding table of the theory:

add the move entry to L;

say L.

Instead of going in Chessatorium: [note that the noun is the direction you’re going]

unless there is a move of the noun in the corresponding table of the theory:

say “That is not an acceptable move.”;

stop the action;

choose a row with move of the noun in the corresponding table of the theory;

now the theory is the result entry;

say “You move [noun] to position [theory]. You can now move [allowable moves].”[/code]

Of course this will get fairly annoying with fifty positions, but not as much as a giant if statement. And you could dispense with the first column, since you can always choose row N in the table of theory tables, but that seems like it’d be harder to read and more vulnerable to typos.

EDIT: By the way, in this old thread, I’m pretty sure the code I was trying to remember and couldn’t was

`Understand "pawn" as a pawn.`

And if you want to try out the code I posted above, follow the instructions for copy-pasting in that thread, because you want to keep those tab stops.