RobotDefs.mesa
Created Saturday, June 2, 1984 1:31 pm PDT
Lasted edited by Eric Nickell, July 9, 1985 5:01:46 pm PDT
This module contains the basic definitions of what a Robot looks like.
DIRECTORY
BasicTime USING [GMT, nullGMT],
Rope USING [ROPE];
RobotDefs:
CEDAR
DEFINITIONS ~ {
Robot: TYPE ~ REF RobotRec;
RobotRec:
TYPE ~
RECORD [
version: REAL, --Version of RobotAssembler
timeOfSource: BasicTime.GMT ← BasicTime.nullGMT, --Timestamp of source
creator: Rope.ROPE ← NIL, --Credit where it's due
code: Memory, --The actual program
pic: RobotPic --What it looks like on-screen
];
N.B.: The difference between code and memory is that memory is used to run in, while code remains a clean initial image.
MemoryIndex: TYPE ~ [0..256);
Memory: TYPE ~ ARRAY MemoryIndex OF INTEGER ← ALL[0];
MemoryMap: TYPE ~ REF MemoryMapRep;
MemoryMapRep:
TYPE ~
PACKED
ARRAY MemoryIndex
OF
BOOLEAN ←
ALL[
FALSE];
RobotPic:
TYPE ~
ARRAY [0..16)
OF
PACKED
ARRAY [0..16)
OF
BOOLEAN;
RobotIndex: TYPE ~ [1..5]; --Legal robot numbers
Robots: TYPE ~ ARRAY RobotIndex OF Robot; --Set of robots on the field of battle
maxDamage: INT ~ 5;
RobotState: TYPE ~ REF RobotStateRec;
RobotStateRec:
TYPE ~
RECORD [
memory: REF Memory,
x, y: REAL ← 50.0,
damage: INT ← 0,
temperature: INT ← 0
];
RobotStates:
TYPE ~
ARRAY RobotIndex
OF RobotState;
Instruction:
TYPE ~
MACHINE
DEPENDENT
RECORD [
immediate, indirect, indexed: BOOLEAN,
opNum: [0 .. 31],
tag: [0 .. 255]
];
}.