Terminator — 7 of 33

Matt Weiner

Release 0

Chapter 5 - Robot Movement

A robot has a number called the x-displacement. A robot has a number called the y-displacement. [position within a grid square]

To decide what number is the maximum displacement of (bot - a robot):

decide on the slowness of bot + 1.

Check a robot going (this is the robots can move horizontally rule):

unless the noun is a compass direction, stop.

Unsuccessful attempt by a robot (called bot) going when the reason the action failed is the robots can move horizontally rule: say "[Bot] can only understand orders to move in compass directions."

Check a robot (called bot) going (this is the can't move off the grid rule):

choose a row with a direction of the noun in the Table of Direction Increments;

let new x be the x-coordinate of the bot plus the x-increment entry;

let new y be the y-coordinate of the bot plus the y-increment entry;

if new x by new y is off the grid:

stop the action.

Unsuccessful attempt by a robot (called bot) going when the reason the action failed is the can't move off the grid rule:

say "[Bot] has gone as far as it can from the wrecked ship's central transmitter."

Check a robot going in the Hold of the Tiptree (this is the parked robots don't move rule): stop the action.

Unsuccessful attempt by a robot (called bot) going when the reason the action failed is the parked robots don't move rule: say "[Bot] is in the hold of the Tiptree; to make it able to move again, tell it to 'EXIT'."

The can't go that way rule is not listed in the check going rulebook.

Carry out a robot (called the bot) going a direction (called the way) (this is the robot movement rule):

debug say "Going [way] from [x-coordinate of the bot], [y-coordinate of the bot], [x-displacement of the bot], [y-displacement of the bot].";

choose a row with a direction of the way in the Table of Direction Increments;

now the x-displacement of the bot is the x-displacement of the bot plus the x-increment entry;

now the y-displacement of the bot is the y-displacement of the bot plus the y-increment entry;

if the x-displacement of the bot is at most 0:

now the x-coordinate of the bot is the x-coordinate of the bot minus 1;

now the x-displacement of the bot is the x-displacement of the bot plus slowness of the bot;

otherwise if the x-displacement of the bot is at least the maximum displacement of the bot:

now the x-coordinate of the bot is the x-coordinate of the bot plus 1;

now the x-displacement of the bot is the x-displacement of the bot minus the slowness of the bot;

if the y-displacement of the bot is at most 0:

now the y-coordinate of the bot is the y-coordinate of the bot minus 1;

now the y-displacement of the bot is the y-displacement of the bot plus slowness of the bot;

otherwise if the y-displacement of the bot is at least the maximum displacement of the bot:

now the y-coordinate of the bot is the y-coordinate of the bot plus 1;

now the y-displacement of the bot is the y-displacement of the bot minus the slowness of the bot.

The move player and vehicle rule is not listed in the carry out going rulebook.

The describe room gone into rule does nothing when the room gone to is nothing.

Report a robot going: say "[The person asked]: traveling [noun]."