<* M2EXTENSIONS + *> <* STORAGE + *> <* WOFF + *> MODULE PACS; FROM IO IMPORT WrStr, WrChar, WrLn, WrCard, WrInt, WrReal, WrBool, RdKey; FROM PACSInterface IMPORT StringAr, ObjectEn, ElEn, PlTypeEn, DirEn, CampEn, PosRc, PropRc, GetPoints, WrCampEn; FROM PACSInterface IMPORT GameModeRc, GameConfRc, TeamRc; FROM PACSInterface IMPORT PlayPACS; (* Import all the teams *) FROM JJRandomPl IMPORT JJRandoms; (* players move randomly & stupidly around *) FROM JJSimplePl IMPORT JJSimples; (* players move according to very simple rules: if they see something they like, they go to it, but if they see an enemy around, they run from it *) FROM JJMoveInDir IMPORT JJMoveInDirs; (* They move according to a complex mechanism: every direction get points according to targets the direction with the most points is executed *) VAR smallArena, bigArena, midArena: GameConfRc; mode: GameModeRc; i: CARDINAL; camp: CampEn; points: ARRAY CampEn OF CARDINAL; c: CHAR; BEGIN (* Game configuration *) (* The arenas *) smallArena.arenaHeight := 8; smallArena.arenaWidth := 10; smallArena.arena[0] := "+-+-+-+-+-+-+-+-+-+-+"; (* put players & elements in the Arena: *) smallArena.arena[1] := "|E g| | H|"; (* set mode.plElFromInput to TRUE *) smallArena.arena[2] := "+ + + + + + + + + + +"; (* E: WHITE EATER for each player *) smallArena.arena[3] := "| a a | | |"; (* H: WHITE HUNTER that you put in *) smallArena.arena[4] := "+ + + + +-+ + + + + +"; (* X: WHITE EXPLORER the Arena, you *) smallArena.arena[5] := "|g b a b |b b|"; (* G: WHITE GHOST must specify a *) smallArena.arena[6] := "+ + +-+-+ +-+-+ + + +"; (* e: BLACK EATER behaviour proc! *) smallArena.arena[7] := "|G |b b b b b b b|"; (* h: BLACK HUNTER *) smallArena.arena[8] := "+ + + + + + + + + + +"; (* x: BLACK EXPLORER *) smallArena.arena[9] := "|e x| X |m m |"; (* g: BLACK GHOST *) smallArena.arena[10] :="+ + + + +-+ + + + + +"; (* a: APPLE *) smallArena.arena[11] :="| a | m m |"; (* b: BONUS *) smallArena.arena[12] :="+ + + + + + + + + + +"; (* m: MINE *) smallArena.arena[13] :="| | h | a|"; smallArena.arena[14] :="+ + + + + + + + + + +"; smallArena.arena[15] :="|g | | |"; smallArena.arena[16]:= "+-+-+-+-+-+-+-+-+-+-+"; smallArena.plElFromInput := FALSE; (* when TRUE: PACS uses the players & elements as specified on the arena *) smallArena.gameNbr := 34; (* game number (0 to 96) *) midArena.arenaHeight := 9; midArena.arenaWidth := 15; midArena.arena[0] := "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"; midArena.arena[1] := "| |a | |"; midArena.arena[2] := "+ + + +-+-+ + +-+-+ + +-+-+ + +"; midArena.arena[3] := "| | | | a | | G |"; midArena.arena[4] := "+ + + + +-+ +-+-+ + +-+-+ + +-+"; midArena.arena[5] := "| |G | | |"; midArena.arena[6] := "+ +-+-+-+-+-+ +-+-+-+-+ + + + +"; midArena.arena[7] := "| | a |E | |e| |"; midArena.arena[8] := "+ + + +-+-+ + +-+ + + + + + +-+"; midArena.arena[9] := "| | a | x | | | | |"; midArena.arena[10] :="+ + +-+-+ + +-+-+ + + +-+-+-+ +"; midArena.arena[11] :="| | | | | | | |"; midArena.arena[12] :="+ + + + + +-+ +-+-+ + +-+ +-+ +"; midArena.arena[13] :="| | G| |a a | |G | | |"; midArena.arena[14] :="+ + + + + + + + + + +-+ + + + +"; midArena.arena[15] :="| a | | | | | |"; midArena.arena[16] :="+ + +-+ +-+ +-+ +-+-+-+ + + + +"; midArena.arena[17] :="| | |"; midArena.arena[18] :="+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"; midArena.plElFromInput := FALSE; midArena.gameNbr := 46; bigArena.arenaHeight := 10; (* this is another arena you can use *) bigArena.arenaWidth := 20; bigArena.arena[0] := "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"; bigArena.arena[1] := "| | | | |"; bigArena.arena[2] := "+ + + + + + + + + + + + + + + + + + + + +"; bigArena.arena[3] := "| | E m| |"; bigArena.arena[4] := "+ + + + +-+ + + + + + + + + +-+-+ + + + +"; bigArena.arena[5] := "| | b | m m| |"; bigArena.arena[6] := "+ + +-+-+ + + + +-+ + + + + + +-+-+ + + +"; bigArena.arena[7] := "| | | |m m |"; bigArena.arena[8] := "+ + + + + + + +-+ + + + +-+-+ + + + + + +"; bigArena.arena[9] := "| | | G e |"; bigArena.arena[10] :="+ + + + +-+ + + + + + + + +-+-+-+ + + + +"; bigArena.arena[11] :="| a | x |"; bigArena.arena[12] :="+ + + + + + + +-+-+ + + + + + + + + + + +"; bigArena.arena[13] :="| | | a |"; bigArena.arena[14] :="+ + + + + + + + + + + + + + + + +-+-+ + +"; bigArena.arena[15] :="| | | |"; bigArena.arena[16] :="+ + + + +-+-+ + + + + + + + + + + + + + +"; bigArena.arena[17] :="| | X | | |"; bigArena.arena[18] :="+ + + + +-+ + + + + + + + + + + + +-+ + +"; bigArena.arena[19] :="|g b b b b b b b |"; bigArena.arena[20]:= "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"; bigArena.plElFromInput := FALSE; (* when TRUE: PACS uses the players & elements as specified on the arena *) bigArena.gameNbr := 27; (* game number (0 to 96) *) (* Game mode keys to change mode (toggle) *) mode.pushEnterToContinue := FALSE; (* 'e' user has to press ENTER after each turn *) mode.showPlByPl := FALSE; (* 'l' show player by player (press ENTER to continue) *) mode.showDetails := FALSE; (* 'd' show detailed explanation, if FALSE only explanation when players score points *) mode.dontShowGUI := FALSE; (* Make this TRUE if you do not want to see the GUI *) mode.onlyShowStatistics := FALSE; (* 's' don't show player animation in GUI, only statistics. This is faster. *) mode.GUI_RefreshInterval := 0.2; (* '+' & '-' Speed of GUI animation: interval in seconds between 2 movements of a player *) mode.realRandom := FALSE; (* default = pseudorandom, every run gives the same random numbers *) mode.playInteractively[WHITE][EATER] := FALSE; (* 'i' Set to TRUE to play yourself with the arrows *) mode.playInteractively[WHITE][GHOST] := FALSE; (* START PACS *) PlayPACS(smallArena, mode, JJMoveInDirs, JJSimples); (* massive code TESTING *) (* points[WHITE] := 0; points[BLACK] := 0; FOR i := 1 TO 100 DO mode.dontShowGUI := TRUE; (* Make this TRUE if you do not want to see the GUI *) mode.realRandom := TRUE; (* default = pseudorandom, every run gives the same random numbers *) mode.dontPushEnterToFinish := TRUE; (* user has not to push ENTER to finish the game, use this for massive testing *) CASE (i MOD 3) OF 0: PlayPACS(smallArena, mode, JJMoveInDirs, JJSimples); |1: PlayPACS(midArena, mode, JJMoveInDirs, JJSimples); |2: PlayPACS(bigArena, mode, JJMoveInDirs, JJSimples); END; PlayPACS(bigArena, mode, JJMoveInDirs, JJSimples); (* count the points *) FOR camp := WHITE TO BLACK DO points[camp] := points[camp] + GetPoints(camp); END; END; (* write the points *) FOR camp := WHITE TO BLACK DO WrStr("TOTAL Points for ");WrCampEn(camp);WrStr(": ");WrCard(points[camp], 0);WrLn; END; *) END PACS.