DEFINITION MODULE Conquest2; IMPORT DosD; CONST maxTurns =200; bdsize =15; investCost = 3; maxVelocity =(bdsize*15)/10; maxWeapons =20; maxRange =(bdsize*15)/10; resCostFactor =1.35; initunit =35; initmoney =30; mbCost = 8; cruiserCost =16; scoutCost = 6; ambCost =35; battleShipCost =70; cruiserGuns = 7; battleShipGuns =40; scoutDefend = 2; transportDefend= 1; nstars =21; initvel = 1; initrange = 1; initweap = 1; iuRatio = 2; blankLine = " "; tExploreProb =10.0; tExploreVar = 5; sExploreProb =70.0; sExploreVar =10; cExploreProb =90.0; cExploreVar =10; bExploreProb =97.0; bExploreVar = 3; initgrowthenemy= 0.7; initgrowthplayer=0.4; TYPE IntType=LONGINT; Team=(ENEMY,player,none); Attribute=ARRAY Team OF IntType; TaskForce= RECORD x: IntType; y: IntType; xf: IntType; yf: IntType; s: IntType; t: IntType; c: IntType; b: IntType; dest: IntType; eta: IntType; origeta: IntType; blasting: BOOLEAN; withdrew: BOOLEAN; END; PlanetPtr=POINTER TO Planet; Planet= RECORD number: IntType; capacity: IntType; pSeeCapacity: IntType; team: Team; inhabitants: IntType; iu: IntType; mb: IntType; amb: IntType; conquered: BOOLEAN; underAttack: BOOLEAN; eSeeTeam: Team; (* the team when the enemy last saw it *) eSeeDefend: IntType; (* the mbs when enemy last saw it *) pstar: IntType; next: PlanetPtr; END; Star= RECORD x: IntType; y: IntType; firstPlanet: PlanetPtr; visit: ARRAY Team OF BOOLEAN; END; TFArray=ARRAY Team,[0..27] OF TaskForce; StarArray=ARRAY[0..nstars+1] OF Star; Line=ARRAY[0..81] OF CHAR; StarList=ARRAY[0..nstars+1] OF IntType; RealStarList=ARRAY[0..nstars+1] OF LONGREAL; BoolStarList=ARRAY[0..nstars+1] OF BOOLEAN; Option=(right,left,both); TYPE BoardType= RECORD enemy: CHAR; star: CHAR; tf: CHAR; END; TYPE Cursor= RECORD x: IntType; y: IntType; END; VAR distance: ARRAY[0..nstars+1],[0..nstars+1] OF IntType; tfStars: ARRAY[0..nstars+1],Team OF IntType; colStars: ARRAY[0..nstars+1],Team OF IntType; enemyResearch: CHAR; board: ARRAY[0..bdsize+1],[0..bdsize+1] OF BoardType; stars: StarArray; tf: TFArray; growthRate: ARRAY Team OF LONGREAL; vel: Attribute; curRange: Attribute; (* current range *) weapons: Attribute; weaponResearch: Attribute; rangeResearch: Attribute; velocityResearch: Attribute; weaponRequired: ARRAY[0..maxWeapons+1] OF IntType; rangeRequired: ARRAY[0..maxRange+1] OF IntType; velocityRequired: ARRAY[0..maxVelocity+1] OF IntType; turn: IntType; prodYear: IntType; enemyArrival: BoolStarList; enemyDepart: BoolStarList; playerArrival: BoolStarList; gameOver: BOOLEAN; bottomField: IntType; cursor: Cursor; rawFile: DosD.FileHandlePtr; PROCEDURE PrintPlanet(p: PlanetPtr; see: BOOLEAN); PROCEDURE SetCursorPos(col,row: IntType); PROCEDURE GetChar(VAR c: CHAR); PROCEDURE GetLine(VAR iline: Line; VAR ind: IntType; onech: BOOLEAN); PROCEDURE min(x,y: IntType): IntType; PROCEDURE fmin(a,b: LONGREAL): LONGREAL; PROCEDURE ClearScreen; PROCEDURE PrintMap; PROCEDURE ClearLeft; PROCEDURE GetToken(VAR line: Line; VAR index,value: IntType; VAR token: CHAR); PROCEDURE ResearchSummary; PROCEDURE NewResearch; PROCEDURE DoResearch(team: Team; field: CHAR; amt: IntType); PROCEDURE AnyWarShip(team: Team; starnum: IntType): BOOLEAN; PROCEDURE FindBestPlan(starnum: IntType; VAR size: IntType; VAR team: Team); PROCEDURE CheckGameOver; PROCEDURE UpdateBoard(x,y: IntType; option: Option); PROCEDURE ZeroTF(tm: Team; tfNum: IntType); PROCEDURE ClearField; PROCEDURE JOWDispTF(num: IntType; name: CHAR); PROCEDURE DisplayTF(taskf: TaskForce); PROCEDURE Pause; PROCEDURE PrintStar(stnum: IntType); PROCEDURE DisplayForces(ennum,plnum: IntType; VAR enodds,plodds: LONGREAL; VAR battle: BOOLEAN); PROCEDURE OnBoard(x,y: IntType); PROCEDURE Lose(VAR ships: IntType; VAR loseNone: BOOLEAN; typ: CHAR; percent: LONGREAL); PROCEDURE FireSalvo( attackTeam: Team; VAR task: TaskForce; tfnum: IntType; planet: PlanetPtr; firstTime: BOOLEAN); PROCEDURE Revolt(starnum: IntType); PROCEDURE EnemyAttack(starnum: IntType); PROCEDURE GetTF(tm: Team; VAR i: IntType; starnum: IntType); PROCEDURE JoinSilent(team: Team; VAR parent,child: TaskForce); PROCEDURE ErrorMessage; PROCEDURE PlayerSalvo(starnum: IntType; VAR battle: BOOLEAN); PROCEDURE PrintColony; PROCEDURE StarSummary; PROCEDURE PrintTF(i: IntType); PROCEDURE TFSummary; PROCEDURE Help(which: IntType); PROCEDURE SplitTF(VAR tfNum,newTF: IntType); PROCEDURE MakeTF; PROCEDURE JoinTF; PROCEDURE PlayerAttack(starnum: IntType); PROCEDURE SetDestination(tfNum: IntType; VAR error: BOOLEAN); PROCEDURE WithDraw(starnum,plnum: IntType); PROCEDURE PutStr(a: ARRAY OF CHAR); PROCEDURE PutCh(c: CHAR); PROCEDURE PutInt(n,w: LONGINT); PROCEDURE PutReal(r: LONGREAL; w,d: LONGINT); PROCEDURE CursorOff; PROCEDURE CursorOn; PROCEDURE TFBattle(starnum: IntType); PROCEDURE GetStars(sStar: IntType; VAR slist: RealStarList; VAR count: IntType); END Conquest2.