Since you have to program the players, you need some information about the game. And you need this information inside your program! For this reason we have developped what is called an Application Programmer Interface. This API consists of a series of Modula-2 procedures, type and constants that you can use inside your program. And it is using these procedures (constants and types) that you will be able to make a player.
In order to structure the files that make up PACS the API has been put in one file. This file is called PACSInterface.def. As you can see this is a (XDS) definition file. It only contains procedure headings, type definitions and constants. You can (or have to) use all of these to build your program. You can do this by IMPORTing the elements that you need in your file(s). Let us take short look at some of the element of the API.
Here is an example of three types available to you (there are more!!):
DirEn = (UP, RIGHT, DOWN, LEFT); CampEn = (WHITE, BLACK); PropRc = RECORD (* properties of a player *) camp: CampEn; plType: PlTypeEn; id: CARDINAL; pos: PosRc; nbrMoves: [0..MAX_NBR_MOVES]; nbrApples: [0..MAX_NBR_APPLES_EATER_CAN_CARRY]; wasKilled: BOOLEAN; END;
We now look at a few procedure you could use in your program. Again, you find these and more in PACSInterface.def. Some procedures are provided for your convenience. There are for example, quite some procedure to print the variable of different types in a human readable way on screen (see WrDirEn and WrCampEn).
PROCEDURE WrDirEn(dir: DirEn); PROCEDURE WrCampEn(camp: CampEn); PROCEDURE OppositeDir(dir: DirEn): DirEn; PROCEDURE IsHome(pos: PosRc): BOOLEAN; PROCEDURE IsWall(pos: PosRc; dir: DirEn): BOOLEAN;