TankMaster.mesa
last modified by: John Maxwell on: March 16, 1983 9:06 am
DIRECTORY
PupTypes USING [PupHostID, PupNetID],
Rope USING [ROPE];
TankMaster: DEFINITIONS =
BEGIN OPEN Rope;
WorldState: TYPE = REF WorldStateRec;
WorldStateRec: TYPE = RECORD[ -- should be less than 256 words total (one packet)
players: [0..maxPlayers] ← 0,
tank: ARRAY [0..maxPlayers) OF Tank ← ALL[],
torp: ARRAY [0..maxPlayers) OF Torp ← ALL[],
score: ARRAY [0..maxPlayers) OF INTEGERALL[0],
address: ARRAY [0..maxPlayers) OF Machine ← ALL[[[0], [0]]]];
Machine: TYPE = MACHINE DEPENDENT RECORD[
-- Unambiguous name of a host
net: PupTypes.PupNetID,
host: PupTypes.PupHostID ];
maxPlayers: CARDINAL = 7;
Tank: TYPE = RECORD[
dead, playing: BOOLEANFALSE,
angle: [0..512) ← 500, -- 500 => out of the game, 400 => unitialized
x, y: INTEGER ← 0];
Torp: TYPE = MACHINE DEPENDENT RECORD[
state: CARDINAL ← 0, -- < 4 => exploding
x, y: INTEGER ← 0];
AddPlayer: PROCEDURE[name: ROPE, address: Machine] RETURNS[ok: BOOLEAN, id: CARDINAL];
IF ok = FALSE then the player can't enter the game.
RemovePlayer: PROCEDURE[id: CARDINAL];
GetPlayer: PROCEDURE[id: CARDINAL] RETURNS[name: ROPE, address: Machine, score: INTEGER];
Update: PROCEDURE[id: CARDINAL, tank: Tank, torp: Torp] RETURNS[WorldStateRec];
the user passes in his state and gets back everyone elses.
ScoreHit: PROCEDURE[torp, target: CARDINAL];
END..