IMD 1.18: 22/01/1996 7:35:48 micro cornucopia kaypro user group disk 30 games with source in turbo pascal   åååååååååå  30-DISK DOC$ARTILLRYCHN ARTILLRYPAS CRC COMCRCKLISTCRC D COMGAMEMENUCHNGAMEMENUPAS GAMES CHNGAMES COM? !"GAMES PAS#KISMET CHN,$%&'()KISMET PASZ*+,-./012345LANDER CHN6789LANDER PASJ:;<=>?@ABCLANDINSTDAT DEååThis is a disk of games with source in Turbo Pascal. To play GAMES type "GAMES" after the A>. Turbo Pascal's "Chain" procedure allows you to chain to another program compiled as a .CHN file. Such a file contains only program code, and uses the Pascal library already present in memory (loaded with the first program - GAMES). GAMES chains to GAMEMENU which chains to the game you choose to play. At the end of the game it chains back to GAMEMENU. I wrote GAMEMENU so all the gaNUMCNVRTCHN FGNUMCNVRTPAS&HIJKLOVERUNDRCHNMNOVERUNDRPASOPQRPASCAL CHNSPASCAL PASTUVPLIFE CHNWXYZPLIFE PASC[\]^_`abcREADNUM PASdSNAKE CHNefghSNAKE PAS:ijklmnopSTARS CHNqrstSTARS PAScuvwxyz{|}~€�TELEPHONCHN ‚ƒTELEPHONPAS&„…†‡ˆTWINKLE CHN‰ååmes could be distributed in executable form without including the run time module with every game: thus saving 8K of disk space per program. These programs were put together by a beginning Pascal programmer and should help others new to Turbo. They function fairly well as games. Instructions are provided by each program, and a brief description of each follows. ARTILLRY.PAS This is a typical cannon shooting game. You pick an angle at which tTWINKLE PASŠ‹WUMPUS CHNŒ�Ž�WUMPUS PASC�‘’“”•–—˜ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå  o fire the cannon. If you get close enough you hit the enemy. KISMET.PAS This game is very similar to Yahtzee. Variations are added by the introduction of color on the dice and an extra roll. The game ends after six turns by each player. LANDER.PAS This a game where you try to land on a planet. The planet is unspecified and changes each game. Thus the gravity changes, as well as fuel suppliege the default initial board. Answer "N" to get the same board each time you play. Type 0 to quit. Have fun! SNAKE.PAS In this game, you try to get the treasure before the snake roaming the screen can get you. The snake will ignore you for a while, but will get REAL interested as you build up a cash supply. Your object is to get the cash and get out the door. Use the U, N, H, and J keys to go up, down, left and righates. Setting coordinates outside the basic colony will end the input phase. The colony will cycle until one of three things happen; 1) the colony dies out, 2) the colony stabilizes (no births or deaths), or 3) a key on the keyboard is pressed. STARS.PAS If you like brain teasers then you're in for some fun. The object of this puzzle is to solve a 3 X 3 matrix such that *s appear in all positions except in the center whi1!€¯¸ÿÍ�!&+¯ͲÃî"Ã3 !å!ˆHÙáÍÑÍÄ ÅÕå!v¯ÍüÍP ÙáÑÁÍÄ ÅÕå!†ÌÌÌÌÙáÑÁÍÉ Ù!3¯Í¡!3¯ÍüÉ!ˆHÅÕå!v¯ÍüÍH ÙáÑÁÍÄ ÅÕåÍêÙáÑÁÍÄ Í™"=¯*=¯ÉÍí!då!èå!dÑë·íRÍÑ"t¯ÍRÍ� The enemy is *t¯å!ÍöÍ� feet away!!!Í�Íb! }2q¯ÍRÍ� What angle? Íb!v¯Í+ÍÍ_Íb!v¯ÍüÅÕå!‚Ü€ÏIÙáÑÁÍÄ ÅÕå!ˆ4ÙáÑÁÍÉ Ù!v¯Í¡*t¯åÍçÑë·íRÍJå!Ñ͇}2o¯*o¯&ËEÊ"*r¯å!Ñ"r¯ÍRÍ�You hit him!!!Í�ÍbÍRÍ� It took you ! å*q¯&Ñë·íRå!ÍöÍ� shots.Í�Íb*r¯å!ÑÍNËEÊÔ!ÍRÍ�You have killed one enems, speed, and starting height. In addition there are meteor swarms to contend with. The file LANDINST.DAT contains instructions for this game. LANDINST.DAT The instructions for LANDER.PAS. NUMCNVRT.PAS This program lets you practice converting numbers from one base to another. OVERUNDR.PAS This is a dice betting game. You pick a number from 2 to 12 and roll two dice. Yout. TELEPHON.PAS This program generates letter patterns out of telephone numbers. (Telephon uses a recursive subroutine) TWINKLE.PAS This program fills the screen with stars then erases them in an interesting pattern. WUMPUS.PAS This is a typical game of Hunt the Wumpus. ch will be ' '. The positions on the matrix board are referred to as follows: 7 8 9 4 5 6 1 2 3 -- just like your numeric keypad. When a * is made a ' ', its immediate neighbors change state, that is: *s become ' 's and vice versa. In addition, changing a corner position also changes the center position; changing the center position also changes the outside middle positions. You will be asked if you want to chany.Í�ÍbÃ"ÍRÍ�You have now destroyed *r¯å!ÍöÍ� enemies of democracy.Í�ÍbÙ"*q¯&å!Ñë·íR}2q¯Íçå*t¯ÑÍ›ËEÊ^"ÍRÍ�You overshot by ÍbÃz"ÍRÍ�You under shot by ÍbÍR*t¯åÍçÑë·íRÍJå!ÍöÍ�Íb*q¯&å!ÑÍNå*o¯&Ñ}³oËEʽ *q¯&å!ÑÍNËEÊí"ÍRÍ�You have run out of ammo.Í�ÍbÉÍRÍ�Welcome to artilleryÍ�ÍbÍRÍ�ÍbÍRÍ�>You are in the middle of a war (depressing, no?) and are beingÍ�ÍbÍRÍ� charged by thousands of enemies.Í�ÍbÍRÍ�AYour job is to destroy their ouytposts. You have a win (four to one) if the roll matches the number picked, or (even money) if both the bet and the roll are over or under seven. PASCAL.PAS This program prints out Pascal triangles. PLIFE.PAS This is a version of LIFE, the classic computer game. You enter the coordinates of each starting cell until the initial pattern is set. You can erase a set cell by re-entering the cell's coordin  t your disposalÍ�ÍbÍRÍ� enemy then write('You overshot by ') else write('You under shot by '); writeln(abs(enemy-dist)) en; (* how far away the enemy is *) killed : integer; (* how many we have hit *) shots : 0..numshells; (* number of shells left *) ch : char; (* used to answer questions *) hit : boolean; (* whether the enemy has been hit *) dummy : file; (* * dist * returns how far the shell went *) function dist:integer; (* * timeinair * figures out how long the shell * stays in the air *) function timeinair:real; begin timeinair := (2*velocity  enemy.'); assign(dummy,'gamemenu.chn'); chain(dummy) end. Í� of the enemy.Í�Íb!?¯åÍ gamemenu.chnÍ=!?¯Í´ÍbÃÅRÍ�ÍbÃ%*p¯&Í(å!YÑÍaËEÊ‚$ÍRÍ�ÍbÍRÍ� You killed *r¯å!Íöd until (shots = 0) or hit; if shots = 0 then writeln('You have run out of ammo.') end; begin writeln('Welcome to artillery'); writeln; writeln('You are in the middle of a war (depressing, no?) and are being'); writeln('charged by thousands of enemies.'); writeln('Your job is to destroy their ouytposts. You have at your disposal'); writeln('a cannon, which you can shoot at any angle. As this is war,'); writeln('supplies are short, so you only have ',numshells,* sin(angle))/gravity end; begin dist := round((velocity * cos(angle))*timeinair) end; (* * fire * the user fires at enemy *) procedure fire; begin randomize; enemy := mindist + random(maxdist-mindist); writeln('The enemy is ',enemy:3,' feet away!!!'); shots := numshells; repeat write('What angle? '); readln(angle); angle := (angle * pi)/180.0; hit := abs(enemy-dist) <= 1; if hit then begin killed := killed + 1; (* * artillery * fire a shell at an enemy outpost *) program artillery (input, output); const numshells = 10; (* allowed 10 shells per target *) mindist = 100; (* minimum distance for a target *) maxdist = 1000; (* maximum distance for a target *) velocity = 200.0; (* initial velocity of 200 ft/sec^2 *) gravity = 32.2; (* gravity of 32.2 ft/sec^2 *) pi = 3.14159; var angle : real; (* angle to shoot at *) enemy : integer' per target.'); writeln; killed := 0; repeat writeln('*******************************************'); fire; write('I see another one, care to shoot again? '); read(trm,ch); writeln; while not (ch in ['y','n','Y','N']) do begin writeln('Please answer yes or no'); write('Want to try again? '); read(trm,ch); writeln end until upcase(ch) <> 'Y'; writeln; writeln('You killed ',killed,' of the  Ã#CRC.COM 5.0 6/18/82CRCKFILE???!9"‡ 1‡ ÍM Í@ CRC Ver 5.0 CTL-S pauses, CTL-C aborts :]þ ÂOÍ@ ++Searching for CRCKLIST file++ÍÊÇÍ@ Now searching for "CRCKFILE" file++ ! Í ÍÂ1‡ Í.Â) F!×  ÍñÂÍ¡Â]ÍñÂ͸Â!â ÍýÃÇÍ”ÃÇÃ0CRCKLIST???CRCKFILE???!9"‡ ‰ M à*,ë*.}“|šÚ‰!".ë*,{•zœÒ{**ëÍ Í·Âu€*.".ÃG*.",€Í!".ë**ë*,}´>È*.#".ɯ22)! ",". Í<ÂÙ ÇÍÃî NO FILECRC FILE$! × Í >.Í ¯Í@ Checking wi match - :® ̓ :¯ ·ÊJ ÍM Í@ Quantity of lines failed parse test - :¯ ̓ :° ·Ê~ ÍM Í@ Quantity of file(s) not found - :° ̓ *‡ ùÉdÍ”  Í” Æ0ÃT ÿ �Ò– €Wy³Ê© ö0ÍT 0zÉtiil*‚#"‚ɯ2i2}! "€!"‚]Í]Í<ÂS ;ÍÃî NO DIR SPACE: CRCFILE$1‡ >2Ò Ís Ò :· ·Ê~Í# ++FILE NOT FOUND++$:± þFÂ*‚}æÂ’"€>õ͇ñ†]Í<ÂÊ ³ÍÃÊ CANNOT CLOSE CRCFILE$ÃîCRCKLISTCRCSK FULL: CRCFILE$€ÍÍà å w# ÂþÑÍÉ!]ÍÍùÍ� DONE$!eÍ ÊS!]QÍ !eZÍ Í@ --> FILE: XXXXXXXX.XXX CRC = ÍoÊSÃ) \Í<‘Í@ ++OPEN FAILED++à !"² !"Ó *Ó |þÊÈ Í·Ê¹ÍþÊ) \Í·ÂÖ!€~2¶ #"Ó Í Ã�þÂî:³ Í) > ÍT :² Í) ¯ÉÍ@ ++FILE READ E3C --> FILE: KISMET .PAS CRC = 6D 38 --> FILE: STARS .PAS CRC = EB 21 --> FILE: 30-DISK .DOC CRC = 6B BE --> FILE: LANDER .PAS CRC = 37 0D --> FILE: LANDINST.DAT CRC = 24 E2 --> FILE: D .COM CRC = 66 48 --> FILE: GAMES .CHN CRC = C2 51th file - !× ~·ÊÍT #ÃÍM ÍM ¯2­ 2® 2¯ 2° É!× >2Õ åÍ3áþÂo:Õ ·Â�:¸ ·ÊÍ@ ***No CRC Files found***$>·Éæþ ʉþ ʉw#:Õ <2Õ þPÚ6:Õ ·Ê.6¯ÉÍ@ Can not parse string !× ~·Ê½ÍT #ñÍM !× ÊÕ> ¾ÊÐ6 #ÂÈ6^#6!× ~·ÊéÍT #ÃÝ!¯ 4ÍM ɾÀ#x¹ÈÃñå]Í #eÍ ¯wá~·Ê ÍT #Ã>2· Í@ - Ís ÒMÍ@ File not found !° 4à >2Ò ÍoÀ:µ G:² ¸Â„:´ G:³ ¸Â„Í@ *Match* ¯2¸ !­ 4¯ÉÍ@ <-- is, was --> :´ Í) > ÍT :µ Í) ÍM ¯2¸ !® 4¯<ÉÍÀ2´ ~#þ ÊëÍ@ Not a space between CRC values¯<ÉÍÀ2µ G¯É-CATALOG??? --> FILE: WUMPUS .CHN CRC = A9 A6 --> FILE: WUMPUS .PAS CRC = 8C D7 --> FILE: GAMEMENU.CHN CRC = DB 8B --> FILE: GAMES .PAS CRC = 30 83 --> FILE: GAMES .COM CRC = A0 8E --> FILE: ARTILLRY.CHN CRC = EF 6E --> FILE: ARTILLRY.PAS CRC = C1 54 --> FILE: GAMEMENU.PAS CRC = 8B 61 --> FILE: KISMET .CHN CRC = 0E 58 --> FILE: PLIFE .PAS CRC = 13 87 --> FILE: LANDER .CHN CRC = CB 78 --> FILE: CRC .COM CRC = B2 07 --> FILE: NUMCNVRT.CHN CRC = 54 73 --> FILE: STARSRROR++ ¯<É*² |æ€õ):¶ …oñÊ% |î g}î—o"² ÉõÍ2 ñæþ Ú; ÆÆ0ÃT ã~ÍT #~·ÂA ãÉ> ÍT > ÅÕåæ_ÕÍh ÑÍáÑÁÉ:± þFÀ{͇ɀͯ2h2|:· ·Ê² !\º  Í :\2Æ !º \ Í \ÍÃÚ !Æ \ Í \Í!º \ Í \Í<7È=懇‡‡‡Æ�o&åÇ  Í á] Í ¯2h2|2· ÉÍ ÀÍ À~æþ$#É~# x±Â ÉÑ Í:± þFÂ} *‚}æÂ= "€>õ͇ñÂ1 ]Í<Âu  ^ ÍÃu CANNOT CLOSE CRCFILE$]ÍÍ� ++ABORTED++$Ñ Í:Ò ·Ê~ ¯2± ÍM Í@ Quantity of file CRC that matched - :­ ̓ :® ·Ê ÍM Í@ Quantity of file CRC that did notÍ@ ++ Now searching for "-CATALOG" file++ !õ Í ÍÂ) Í.Â) !× Íå”>.¾Â”#Íô”Í͔͡”ÍÍ›Íø›ÍøÊtþK›ÍÍ›͸›*« ÍýÃ=:¸ ·Â=Í”Ã="« Í ÀÍ ʳþ À ª~#þ.ÀÍ ÊÈþ À ¿É~þ ÊÖþ À#~þ ÊÖþ ÊÖ¿ÉÍôÀÍøÈþ.À+¿ÉÍøÀ~#þ0Úþ:Ò¿Éþ0É~#þ!ÚþÒ¿ÉþAÉÍ.ÀOÍ.ÀGy°¿É~#þ0ÚMÖ0þ ÚKæÖþ ÚMþÒM¿É·É:m2± þFÂSÄCRCKLIST$$$›Íø›ÍøÊtþK›‰, ݈ õ*€ë*‚}“|šÚù!"‚ë*€{•zœÒë*~ëÍ]Í·ÂÊ€*‚"‚Ü ÖÍñÃî DISK FULL: CRCFILE$€Í!"‚ë*~ëñ .CHN CRC = 78 F5 --> FILE: OVERUNDR.CHN CRC = 5B 73 --> FILE: OVERUNDR.PAS CRC = FE 93 --> FILE: PASCAL .CHN CRC = 47 72 --> FILE: PASCAL .PAS CRC = B2 B8 --> FILE: PLIFE .CHN CRC = 5D 8F --> FILE: SNAKE .CHN CRC = 2E 9D --> FILE: SNAKE .PAS CRC = 74 73 --> FILE: TELEPHON.CHN CRC = D2 93 --> FILE: TELEPHON.PAS CRC = D3 22 --> FILE: TWINKLE .CHN CRC = A3 3E --> FILE: TWINKLE .PAS CRC = 34 CD --> FILE: READNUM .PAS CRC = 5F C3 --> FILE: NUMCNVRT.PAS CRC = 87   Ãÿ Hit Space: ÍKÃK : k Used: /k Not used: k ë*% ÍÔ DMÃf : remain on 1 !9" !Ñ ùÍJÍú> Í# µÊ->! Í. Ò*ͪÍe> Í# µÊ<Í×Í * ùÉv ÍK É ÍK  ÍK É!B r+s+p+qA ? Í Úp*A É*? É:]þ$ÂŽ Ål]ÍQ !]6 !E 6!C 6 :C Í Ú*C &l ~2D þU¼:E 2 :D þSÂÊ:E 2:D þFÂØ:E 2:D þVÂæ:E 2:D þPÂô:E 2 :D ÖNÆÿŸ2E ! É_{•ozœgÉO{‘oz˜gÉi`N#F‘o˜gÉo&•oœgÉ_{–_z#žWëÉà þÈÅOÍK ÁÃ= YÃáã -ÂS Éáã{-Â_ É!¨ s+p+q*¦ å« ͼ 2ª <2© :¨ !© ¾Ú—  ÍK !© 4Ã� !© 6:ª =!© ¾Ú» *© &« NÍK !© 4œ Éáã>õ3ÊÕ Íá Æ0õ3}´ÂÄ Z;ñÂ× {ÉÅ ¯)¹Úî ‘#Âæ ÁÉÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇ^#Vë"; *; ˆ ͪ  å*; Áq#pÃ�Ãn*„ " É!‹ p+q*Š )ë*= ^#Vë"; !Œ 6> !Œ ¾Úi*Œ &ë*; >¦OÍK :Œ <2Œ ÂE:/ÒÖ *; ^#V*% ÍÔ DMÍf kÍK :ÒÖ *; NÍf ÍE*; ~þ€Ú»WÍK þÍE *; ~þ€ÚÓSÍK ÃÖÍEÉ Í= !— 6:!— ¾Ú':/Ò :Ò –Í= !:— ¾Ò‰Í= :— <2— Ââ* "• !"‘ >!• Í. Ò *• ë*&͵ ë"( *• ë*&͵ >Í µÊj*( #"( *DM*( ëÍV"( !"� ( � Í ÒúÍK!"� }2— :— <2— O:¹Úð*� ë*� å*‘ Á "“  “ Í Úâ>!— ¾ÒÓÀÍ= *“ DMÍ**• +"• *( ë*� "� Ø*� #"� Ã*&ëprogram GameMenu; (* Menu for games by Bruce Berryhill 10Jan85 *) var Answer: char; ChnFile: file; begin write('Hit any key to continue'); read(trm,Answer); repeat clrscr; writeln ('a Artillery'); writeln ('b Kismet'); writeln ('c Lander'); writeln ('d Convert numbers from one base to another'); writeln ('e Over Under'); writeln ('f Draw Pascal Triangles'); writeln ('g Life'); writelC 4Ø:Ò!4Ã:Ò!5É( Í µÖŸ! ¦ÒI3Í= ÿÍ: [Í= ÉÍt:\þÊa:\=_Í: :]þ Ât Å?]Í\ : Òƒ! 6?ÃŽÿ Í: 2  Å ]ÍQ  Å?\Í\ ÅÍ: DM, ÍQ !Ñ "= *3 ##)ë*= "; */ &#Íì "! *3 #"#  !! Íò "% >ÿ!1 Í. Ÿ2' É\Í: 2 : þÿÊ©: 懇‡‡‡Æ€o&"* ~þåÊ›*# +"# ** DMÍY Ò›** DMÍ  å*; Áq#p* " . å** #DM*; ëá -Âe**  å*; Ñw* #" )ë*= å*; ëás#r*; "; Í: 2 ÃÉ!S 6!"V * "n >!S ¾Òd*S &T ) ^#Vë"K O!l ^#Vë"M :S =2S M K Í Òa*K "G *1!€¯¸ÿÍ�!©#K¯ͲÍRÍ�Hit any key to continueÍb!»Í8!{¯ÍÛÍbÍcÍRÍ� a ArtilleryÍ�ÍbÍRÍ� b KismetÍ�ÍbÍRÍ� c LanderÍ�ÍbÍRÍ�+d Convert numbers from one base to anotherÍ�ÍbÍRÍ� e Over UnderÍ�ÍbÍRÍ�f Draw Pascal TrianglesÍ�ÍbÍRÍ�g LifeÍ�ÍbÍRÍ�h SnakeÍ�ÍbÍRÍ� i TelephoneÍ�ÍbÍRÍ� j TwinkleÍ�ÍbÍRÍ� k WumpusÍ�ÍbÍRÍ�l StarsÍ�ÍbÍRÍ�ÍbÍRÍ�7Which game would you like to play? [a-l] to quit Íb!»Í8!{¯ÍÛÍb*{¯&Í(}2{¯*{¯&åÍQ!Aå*( ÍÔ ë*‘ "‘ Í Ã3É*1 #"ž "  "¢ *5 "œ >œ Í# µÊR :œ ÒB *ž +"ž !œ Íò ë+s#rÃ( !¤ 6Í: "š *š ~2¥ *¢ #"˜ *˜ +"˜ >Í µÊ¶ :¥ 2¥ Ò’ *  +"  :¤ <2¤ O>¹Ò³ !¤ 6*š #"š *š ~2¥ Ãp ̓Í: ÆAOÍK �Í= *ž Ͱ�Í= * Í·›Í= * Ͱ�Í= *# Í·›Í= *  Ͱ¬Í= ÉÉ. æg æ”ÂS -ÂA É>ÿØ>É!  ~þ?Êl W æº>À#Â^ :·À /æÉ!:' ·Â—  ·Ê‘ #‹ É W ²Ê¢ #™ Éi`N#F�oˆgÉDM!>õ)ë—)ë�‘o|˜gÒÎ ñ=¼ ÉDM!>)ë)ëÒã =ÂÛ É^#Vë) Âì É^#Vë|·g}o Âön ('h Snake'); writeln ('i Telephone'); writeln ('j Twinkle'); writeln ('k Wumpus'); writeln ('l Stars'); writeln; write ('Which game would you like to play? [a-l] to quit '); read (trm,Answer); Answer := upcase(Answer); until (Answer in ['A' .. 'L']) or (answer = ^M); case Answer of 'A' : assign(ChnFile,'artillry.chn'); 'B' : assign(ChnFile,'kismet.chn'); 'C' : assign(ChnFile,'lander.chn'M "I ë*K Íö )ë*= ^#Vë"O I G Í ÚÇ*G )ë*= N#F*O ëÍ? þÿÂJ*G #"G Ã(*I )ë*= ^#V*O DMÍ? þÿÂm*I +"I ÃJI G Í ÚÄ*G )ë*= ^#Vë"Q *I )ë*= å*G )ë*= ãN#Fáq#p*I )ë*= å*Q ëás#r*G #"G *I +"I ÃK I Í G M åÍ ÑÍ Ò!M G Í Ò:S <2S O!T å*G ëás#r*S &l ) å*M ëás#r*I "M Ã^I K Í ÒX:S <2S O!T å*K ëás#r*S &l ) å*I ëás#r*G "K ÃíûÉ!"„ "†  † Í Ò#*† #"† )ë*= å*„ #"„ )ë*= ãN#Fáq#p † Í Ÿõ*„ )ë*= å*† ) ë*= ^#VáN#FÍ? ÖÖŸÁH¡Ò *† #"† )ë*= ^#Vë";  *; ^#Vë"ˆ *„ )ë*= !LÍkÍå*{¯&å! ÑÍNÑ}³oËEÊ *{¯&A·íRÂ"!K¯åÍ artillry.chnÍ=È#B·íRÂ3"!K¯åÍ kismet.chnÍ=È#C·íRÂU"!K¯åÍ lander.chnÍ=È#D·íRÂy"!K¯åÍ numcnvrt.chnÍ=È#E·íRÂ�"!K¯åÍ overundr.chnÍ=È#F·íR¿"!K¯åÍ pascal.chnÍ=È#G·íRÂà"!K¯åÍ plife.chnÍ=È#H·íRÂ#!K¯åÍ snake.chnÍ=È#I·íRÂ%#!K¯åÍ telephon.chnÍ=È#J·íRÂH#!K¯åÍ twinkle.chnÍ=È#K·íRÂj#!K¯åÍ wumpus.chnÍ=È#L·íRˆ#!K¯åÍ stars.chnÍ=Íc*{¯&å! ÑÍaËEʦ#!K¯Í´ÍbÃÅ·íRÂJ!K¯åÍ twinkle.chnÍ=Ã-#  ); 'D' : assign(ChnFile,'numcnvrt.chn'); 'E' : assign(ChnFile,'overundr.chn'); 'F' : assign(ChnFile,'pascal.chn'); 'G' : assign(ChnFile,'plife.chn'); 'H' : assign(ChnFile,'snake.chn'); 'I' : assign(ChnFile,'telephon.chn'); 'J' : assign(ChnFile,'twinkle.chn'); 'K' : assign(ChnFile,'wumpus.chn'); 'L' : assign(ChnFile,'stars.chn'); end; clrscr; if answer <> ^M then chain(ChnFile); end. !ð ë!›45(É!.+/ –0ü†õyþ0(ñíÉ d!kÃZ!{ÃZ͈æ͈o&Éô  áÁå:á·(yþ ÕÅÍ |µ(Íþ ÍþÊÅÁÑ*é"ÛÕx2áy·( >Ã28!?"9!É í°!á¸í°áí°>2گà Ã:ÃDÃ]ÃSÃXÃNÃ]ÃDÿ í[Ûþ (ú!eÍ}Í„þA8þQ0Gþ: xÖ@¯!\w# ( þ  ÍyÍVþ. ÍV!h6#ûÉ (þ*(þ.(þ!8þ}(þ*(Í„w#ßÉ>?> w#üÉþaØþ{ÐÖ É|Í’}õÍ›ñæÆ�'Î@'Ãè¯7Ë|À|·}È>ÿÉ"ÍíCß"í6#ûëÑùü "Ïë"ÕÍ�Í©éå*Ï·íB"Ïí[Í·íRëáÚ5í°É*Ïí°"ÏÙÉ^#V#xñW^‘8/ÃwÍÖ Ð>ÃuÍJ õÍuÍ` íÙ}·Ù>(è; àÙËxÙÂQ Ù}·ÙÈÙÅÕåÙ}· Ù˸TÅËø¯ÙËø}Ù•(0íD=ÙÍC ,= ù(Ùñæ€ Í[ 0%ÍD ·, 7 Í� ?õ(8ÙÍu Ëx ÍO - öÍ; ñ8˸·ÙáÑÁÙÉÙËxÙÂÝ ÍX ÍÝ Ø,-Èxî€GÉÙ}·ÙÊ; }·ÈÙ…ÙÍ ÅÕåÝ9Í; Ù.Ù>Ý#ÝnË0Í[ ÍD = ñÙ-Ù åÝnûËx ÍP ,-(-ñññ·ñÙÁáÙÝá˸°G,-Ì; É}·ÈÙ•Ù?Í åååÝ9Ù.Ù>Í� 8Íu ?Ë= ÝuÝ+Ù-Ù(>ÍO 0ßÍu ·áÍO 8Õ^#V#N#FáÉÝáëO/o&ÿ9ùëí°ÝéÑO/o&ÿ9ùëí°éÝáë!àÿ9ùëÅ(¯üí°Á> �‘(G¯üÝéÝá!àÿ9ù ¯w#üÝéÝáEÍŠ¶wÝéÝáÑ}“8÷�Ãu·íR·íB0 É>‘î·íRëê@ðøÉÕë·íRëáë·íR!È+Éͨ õÍz ð·íR!À+Éͨ õÍz ðÍ<!Ð+Éͨ õÍz ðÍ<!ÈØ+Éͨ ôÍz ïÍ<!ÈØ#Éͨ ôÍz ïÍ<!Ø+Éͨ õÍz ðT]KBë!z·> S>)ë)ë0 = öÉ|ªõÍJëÍJëDM¯go>íjíB0 7?ËË= ðÃÉÍ«Copyright (C) 1984 BORLAND Inc‚A KAYPRO II-84d IVctedP=  ERC1B1~·7È#õå~Íáñ=ÈóÍ% ÉÅÕåÝåýåõo&åͦñýáÝááÑÁÉoåͦÉþ€Ü�Ô©æîÅÕåÝåýåÍ£}Ùå!å!"8áãõÅÕ~#·(åÍáôÑÁñãÉ}´È:$‡‡‡ããããÅÒÁ= ô+èÍÐØ*ÎßõÅÕå!¨ÍZ!¢ÍÐ*ºÔBáÑÁñÉõÅÕå!´éõÅÕå!®àõ:¼·(ÅÕå=2¼!ÈÍZáÑÁñÉõ:¼· ÷ÅÕå<2¼!ÂåõÅÕå!¼ÛõÅÕååð!‹í°Ñ:žO:œ‚ÕÍÑ:ŸO:�ƒÍ!ðÍÐ* ÍBáÑÁñÉÍ� ?áÑÁËx ÍP š, —7•8Æ€8Æ€8oÝãÙåÅxËøÙ¨æ€õËøÝåÝ!ÉáØ¯oGOW_gÉ·ËËËËËÉ·ËËËËËÉ|Ù„Ùg{Ù‹Ù_zÙŠÙWyÙ‰ÙOxÙˆÙGÉ|Ù”Ùg{Ù›Ù_zÙšÙWyÙ™ÙOxÙ˜ÙGÉxÙ¸ÙÀyÙ¹ÙÀzÙºÙÀ{Ù»ÙÀ|Ù¼ÙÉÙxÙ¨ò² xÉËx(ͼ È?É}Ù½ÙÀ·ÈÃ� }Ö�Ú; <þ(ÐÙÅÕåÍ; 7ÍD = ùÙ|Ù¤Ùg{Ù£Ù_zÙ¢ÙWyÙ¡ÙOxÙ ÙGÃD ÙÅÕåÙÍuÙÍÆ ÙÍJ ë}·ÈËx>ÂuÍu}Æ€Ë/Æ€oÖõÙÅÕå; ÍÖ -ÅÕåÍJ }áÑÁÙáÑÁã¼ã0ãñÙÉÙÍW-ÍJ ÙÍW,Ù}þlØÅ˸ͨ Á8 ; Íý Í` Ëx(ÍÖ Ù-Ùͨ õ8ÍJ Ù-Ùͨ 8Ù,ÍJ }þl8;Ùª*ªª!ªÍ` ÝåÝ!Ð >ÍýÝáÍuÍ` Í` ÅÕåÙÍu--Ù-ÍÖ ÙáÑÁÙÍJ ,,ñ,-ÈØxî€GÉgª?+2×n¶*ï8t Ð Ðzˆˆˆˆ~«ªªªª,->ÊuËxÂu1!€¯¸ÿÍ�! L¯Ͳ!L¯åÍ gamemenu.chnÍ=!L¯Í´ÍbÃÅëñðHåÍ\Ë<ËÑëÍÞëËzÈ5Í+È)ýÉÍ+ÈË<ËúÉëz· {þ0G·É¯goÉë|ª|úHºÀ}»ÉÉË|È|/g}/o#É}æo&ÉíKÓí[ÑÅÕxAJSËËËËáëáíJDM!éb"Ñë!6íJ"ÓDMÉ'ͬèͬdͬ ͬ} ¯<íR0û= ÈÆ0ÝwÝ#ÉÝ~Ö$O! Ý#Ý~Í„Ö08)þ 8 !Öþ 8þ0T])Ø)Ø T]Ø)Ø_ØËy·È|‡ÉÝááå}&#9N�8wë!DíB9ùëåí°ëá+Oí¸ë#ùÝé>ÃwÝáͦWáͧ _áå}“8(º8J`9{‚T]=o`9yí¸ë ¯ÍýÝá,ÙÍk-ÙÍÖ ñÅÕåo&0%ÍÑÙ,Í` ÙáÑÁÍÖ }þgÚ; É}Š�؉}颋.:}Žã8Žc~I’$I~ÍÌÌÌL«ªªª*ÙÍkÙ·Ëxõ˸; }þˆ0GÅÕå,Í™åË<Ë}áõÍÑ,-(-ÙñáÑÁõÍJ ÝåÝ!Ù >ÍÝáñ0 õÙÍaÙÍ` ñ…o8 ñÈÙÍOþ á>Ãum.`1pF,þåt6|‰„!wS<ÿÃ.zÒ}[•|%¸FXc~üïýu€Ò÷r1}·ÈÝåÙÍOÙ¯Ëx(<˸õͨ 8Ù; ñËÿõÙÏŽé!~JÙͨ 0Í÷OÝ!—>ÙÝÍ<Ùͨ 8 = ìÙ ÝÙÙÍ7ËøÍÖ ÅÕåÍ<Í` ÙÍOÍÖ ÙáÑÁ; ÝåÍ÷ÝáÙÍ7ÍÖ ñ0 õÙÍW-ÍJ ñÝáËOÈËøÉçÏÌTöô¢0 jÁ‘ €µžŠoD€‚,:Í€jÁ‘ �€!¢ÚI}袋.º}Žã8Žc~I’$I’~ÍÌÌÌL«ªªªªÝ!Ó>ÅÕå ÌáñJ= ÍB== ͯ}8= ͵}/Í­ !*â###å~Æ-_~áþ(4òQ6*âËÖ>™2Ù>*â##wáÑÁÉ:Ù·>Àå*â##~áÉå*â#~þÿ(EÍÌÍ[þ ( þ (þ (þ ÍÖè!]Í[þ (þ (þ (þ(w#(ÍÖãÍÂÌÖ6áÉÝ!]Ý~·Èþ-ÀÝ#É8Ý~·È>7à ëÍ Í[ÃÖÍÖÉ>¯OÅÍkÁͼÈÅåÍÁÑÁÍÎØÌMës #rëÉÍkͼÈÅåÍpÙáÁÍÎØÙÌX ÙáåÍÌÍ[þ ÍÖôÍ[þ (þ( #w(ÍÖêÍÂÌÖáqÉ*â#~þÊáÍ[þ (þÈÍÖñÍ ÍÖþ ÀÃÖ*â##~þÈ6ÉÅÕåÍœáÑÁÉOÍ$*â#~þ(08áÅå·Ê¦=ʦ==Ê©=ʬò+ËÞ###å~Æ-_qá4ð6Í¡È>ðà *æ:è¾È4^qÉ}Ã’ÁÑÅÝ*ÛË|(Í ¦w#ùãýáÝá!9ë! E9ýéÝá!!9~·(¯+FÍŠ¦!"9ù!(#Ýé>¯2æýá*ÛͲ¯á"âýå|·>"Ê :æ·( ͆ *â6#wÉÍ÷*â6#6 ë!\$í°É!¶Ååí[Ûþ (úÍ„–( áÁã·É#ëÁÁþ:À~ÉCONTRMKBDLSTAUXUSR>¯2æÍîÍ$*â#~þ ͶÍ$*â:æ·> >w###6ÀÃÖþ þ #6++pÉ>¯2æíSäÍ-Í$Ͷ:Ù·À*â6###ww#w$w#wÖÿ:æ· åÍôá##N#F*ä·íBÈ>�à å¯w#w#í[äs#ráÃó>¯2æÍSÍ$ͶÍ$*â6å ë#Íá-¯Nw#FwÖÿq#p#6€#w#w#wÉÍß*â ë:æ·( ÕÍÑñÅÍÁ<Àxà *â6#ûÉ"â#~+þ 2ËN(>Í’ÝåÑ*ës#rÑ*ôs#rÉÝåá"Í*ò ÝåÁ Ú5íKÏíB!Úð>ÿÃuëáã~#fo{æü_ë"ò*íåÝá·íR0RÝnÝfå·íR0ÝáðáÕýáíKòýqýpýuýtÝsÝrÝåáÝNÝFÍÄ( Ý^ÝVÕÝáÝåáÝNÝFÝ^ÝV*ííSíÕÝáÝuÝtíKòÝqÝpë ·íRÀÕýá*Í·íR(ý~Ýwý~Ýwýnýf ÝuÝt¯ÉÝåá"Í6#ûÉÍ *öÉÍ *øÉ!"ö"øÝ*íÝNÝFy°(*ö "ö*ø·íB0íCøÝnÝfåÝáØ*Ïûÿ í[Í·íRØë*ö"ö*ø·íRÐíSøÉí[Ís#rÉ^#VíSÍÉ>¯O"æ¯w2Ùx2è!ê"âá"äá ÍöÍ@*äé>¯2ê"æ!ê"âá"äá"è!\Ͳ¯*è:ê· ÍîÍ!Ù~6·go(Ýåá\íRë*æs#r¯ÿí_2ÔÉëÝáÁáx±( s x±õÍuÍ` ñÍÙáÑÁÃ` õÙÍ7õÙÅÕåÍ7ÍÖ ÙáÑÁÙÍ` ñ= éÙÍOÃÖ ÝÝnÝfÝ^ÝVÝNÝFÉ!�DLT\ÉI¢Ú!‚!É53ó!�úÉr1÷!€ÒÉÅÕåÙáÑÁÉÍ\!€> Ëx Ë#ËËË-= ðo˸ÉËxÙÍO(Ëø-ÍÖ ·Ë}(ËxËø>�½8(ÍC ,óÍC `iÈÃM!É>’Ãu|µÊ; Ë|ÍJ>�Ë| )=Ë|(úDMboÀ˸Éͦë8þ8ͦÙËxÙ(’0¯þ 8> ÕÍMÑËx(>-ͲË{(aËy(Ͱͦ ò\z·(>.Ͳ (Ͱ ÷ú~ͦ÷Ë{È>EͲ>+Ë|(|íDg>-Ͳ|/Ö 0ûÆ:ÝpÝ# ý~ý#· ý+>0ÝwÝ#Éýå,-  ý60ý#ø¯ÃJÅ˸}ÙÖ€oŸgMÍÄ|þÙ <ýwíDÍ }þ�0Í€ý5Ëø>„•.ÍMëëË|( ÍMÝ6-Ý#ÕÍ�áͦí[ÛÝåá·íRë“8 (G> Í’ùCÈ~Í’#÷ÁÑÙáÑÁÙÅÝ*ÛÕÍôÇÁÑÅͦËC!h Ç!lÀTRUEFALSEͦ!9^#Í(ÑùÕÉá~#·(G~Í’#ùé> Í’> Ã’ "âËF!ÈÍ[¸(þÀ#ÉåÍRë·íRá0Íô*â4À#4É>™Ã åÍR·íR *â4 #4(áÍóÒ>òÜ>¯2çÍ$ë*âËV(/Ë–:ç·(#~+· x· y·ú2ÅÕ!͵ÑÁ( =(þ X:ç·(R*â:ç·(ËÞ###~Æ-Õ_ÑÖ-ÍŒí âX<òN=<ÍŒ*â###æw ÅÕåÍŸáÑÁ Õ*Ñ4 #4x±ÂüëÉ>™>ðà õ:ç·(ëñÉ"âÍŸÈè"*âËÖË^ÈËž*âËVÈË–åÅ0ëÍÁá ëÍ·ÉÁÑíSâÅåÍRÑ·íR8A*â N#F#s#rÍ$ 0}æ)ëíjëS\:Ù· *âË^ îËFÈ*âå ëÍá< >ÿ2Ù6É"â~æÈÍŸ*â-¯w#wÕÿw#ÍóÍŸÀ"â~æÈ·ÍÀ ëÍ<À@ýá*ÛͲ¯áýåÍÀåÍ÷áåë!\ í°á åëÍÑ<Ê®!\$í°É>à >¯2æÍÀ*ß|µ>! ë*â \$í°\Í<(Ï!ý€í°:æ· í[1Ã�ÿÕÍ\ÍÑ!€ë·(éf"âÍÂÈ> 2ÙÉ:Ù·ÈñÉÝáÝåå!ÊÍ<áÉÝáÝå"âËF( #~þÀ#6Ãe>Îå!ÊÍ[áÉ"âËNÀ>ë!Ú~þ€8>O6*Û"ÝÍwþ (=þ(&þ("þ(þ :á·(ßÃNþ 8Øyº(Ô~#ÍèÌúx+Í% (½ï6Éå*â#~þáÉÍÂÈÍ[þÈÅÕå*â#~· *Ý~þ(h#"Ýb= Íõþ 8Íèþ(T]í°ÝéDMÝáÑá·íR0ð ë ëí¸ÝéÑÁÕ-a%ÃÆ}Í„oÉ*é!Ù~6o&ÉÍ |µÈÍ£}þÀÝáÍ%^C User break1:Ù·ÈÝáõÍ% I/OÝáÍ% Run-timeÍ% error Í’Í%, PC=Ýåáí[Õ·íR"×Í�Í% Program aborted*ßé1!€¯¸ÿÍ�! L¯Ͳ!L¯åÍ gamemenu.chnÍ=!L¯Í´ÍbÃÅ error Í’Í%, PC=Ýåáí[Õ·íR"×Í�Í% Program aborted*ßé1!€¯¸¸Í�!��Ͳ!L¯åÍ gamemenu.chnÍ=!L¯Í´(ÍC Ë= øý~õ> xæÆ0ýwý#xæGÅÕåË%ÍP Ë%ÍP ëãÑãíZëáãíJDMáË%ÍP = ÈñÁýáÉýåá_~6þ5Øúi+~¨¥Ôh¶¿ÉìÅëx-ÐÍÎÂSÞùx9?ë+¨­ÅøÉ{Η@}·ÈËøÅÕ|ÍC ÍC „gãíZëáãíJDMá0ÍD ,7È}Æo˸ÉÍ ¾ #øyîO!@9ùi&ÝéÍ  ë¶¾ â#÷ÚÍ ¶w#ùëùÝéÍ /¦w#øï*â###w* N#Fë·íB ÈÕåÍŸÑár+sÉ>‘à ÕÙáÙ!T]>)ëíjëÙ)Ù0 0= ïÉÍU·íR!À#ÉÍUëÉ*â^#V#ÕN#F#^#VáÉ>">!2çDMÝáÑáÝå"â~æÊóx±(LÅÕÍ*â ë:çOÍÑÁ·(o:çþ" C}=(þ ?ÅÕ*â-N#Fp+qÛÿq#pÑÁ!€ë °*â F+N+++V+^ë·íBÐëq#pÉ>™>ð>à ÁÑíSâÅåÍRÑ·íRÚ*â s#r$ s#rÉ"äíSæëá"â! N#Fë·íB(^x± *â 6#ûí[âÍ<(H*â! íKäq#p##ëíKæÅÕÍí[â!Í· *â! 4 #4Ñ!€ëÁ x± Õ*â$ éÝ*â>ðÃw"òëáã"ô{æü_!í"ëÝ*íÝnÝf}´(HíR0ÝnÝfåÝ"ëÝáã Ý^ÝVÝåMDÝnÝfÝåÝÝuÝtÝqÝp  program games; (* Loader for game chain by Bruce Berryhill 10Jan85 *) var dummy: file; begin assign(dummy,'gamemenu.chn'); chain(dummy) end. &ÑÍNå!r¯å*á«+)Ñn&å!r¯å*ß«+)Ñn&ÑÍNÑ}£oËEÊ &!}2Ñ«*ß«#ÑÃ�%*á«#ÑÃ%*ã«#ÑÃ`%*Ñ«&ÉÍQ!Ç«Íâ!å!ÑÍ5z³Ê€&Õ"ã«!Ç«Í-ÍQ!r¯å*ã«+)Ñn&ÍaÍå!Ç«Íâ*ã«#ÑÃA&!Ç«Í-ÍQ!Ía!Ía!Ía!Ía!ÍaÍ®å!Ç«Í-ÍQ!Ía!Ía!Ía!Ía!ÍaÍ®Ñ}³o}2Ì«*Ì«&É!}2Æ«!å!å!Ñë·íRÑÍ5z³ÊI'Õ"ã«!r¯å*ã«+)Ñn&å!r¯å*ã«å!Ñ+)Ñn&ÑÍaËEÊ@'!}2Æ«*ã«#ÑÃ'*Æ«&ÉÃ+(!å!ÑÍ5z³Ê€'Õ"ã«!²«å*ã«+Ñå!ëás*ã«#ÑÃ]'!å!ÑÍ5z³ÊÜ'Õ"ã«!²«å!r¯å*ã«+)Ñn&+Ñå!²«å!r¯å*ã«+)Ñn&+Ñn&ded of *¬å!ÍöÍ�ÍbÍRÍ�Grand total for basic section *¬å*¬Ñå!ÍöÍ�ÍbÍRÍ�Íb*¬å*¬Ñ"¬!å!ÑÍ5z³ÊÚ"Õ}2¬*¬å!ú®å*¬+)å)å)å)ÑÑÑÑå*¬&+)Ñ^#VëÑ"¬!`¬å*¬&+)å))å))ÑÑÑÍ ÍR!ÍqÍ� = !ú®å*¬+)å)å)å)ÑÑÑÑå*¬&+)Ñ^#Vëå!ÍöÍ�Íb*¬&#ÑÃ;"ÍRÍ�ÍbÍRÍ�Total game value = *¬å!ÍöÍ�ÍbÍRÍ�ÍbÍRÍ�Hit any key to continueÍ�Íb!»Í8!ö®ÍÛÍbÉÃC-ýáá"÷«ýå*÷«å!Íå!Ñëás!å!ÍÑ·íRÂŒ#!ë*÷«só#·íR¡#!ë*÷«só#·íR³#!ë*÷«sÉ!"ê«!å!ÑÍ5z³Ê÷å!Íö! Íò!r¯å* «&+)Ñn&å!Íö! Íò!Ö®å!r¯å* «&+)Ñn&)))ÑÍ !ÍqÍ�Íb* «&#Ñî+ÍRÍ�ÍbÉÍQ!™«ÍâÍRÍ�Replace how many dice? Íb!š«åÍç*š«å!ÑÍ›å*š«å!Ñ͇Ñ}£oËEÊA,*š«å!ÑÍEz³Ê3-Õ}2˜«ÍRÍ�Replace which die? Íb!š«åÍç*š«å!ÑÍ›å*š«å!Ñ͇Ñ}£oËEÊž,*š«å!™«Í-Í}îoËEÊž,!™«Í-ÍQ*š«ÍaÍå!™«Íâ!r¯å*š«+)ÑåÍM#*˜«&+ÑÔ,*ü«&å!Ñ}2ü«Éýáá"¬ýåÍRÍ�Player number *¬å!ÍöÍ�Íb!å!ÑÍ5z³Ê¡-Õ}2ù«!r¯å*ù«&+)ÑåÍM#*ù«&#ÑÃ{-!}2ü«*ü«&å!ÑͯËEÊõ.ÍRÍ�ÍbÍj+ÍRå!Ñëás*ã«#ÑË'!å!ÑÍ5z³Ê(Õ"ã«*Þ«&å!²«å*ã«+Ñn&å!ÑÍNÑ}³o}2Þ«*ã«#ÑÃç'*Þ«&}2¼«*¼«&ÉÍE%åÍR'Ñ}£o}2Á«*Á«&É!}2Þ«!å!ÑÍ5z³ÊÎ(Õ}2ª«!"««!å!ÑÍ5z³Ê¬(Õ"ã«!r¯å*ã«+)Ñn&å*ª«&ÑÍNËEÊ£(*««å!Ñ"««*ã«#ÑÃm(*««å!ÑÍNËEÊÃ(!}2Þ«*ª«&#ÑÃR(*Þ«&}2±«*±«&É!}2©«!å!å!Ñë·íRÑÍ5z³ÊE)Õ"ã«!r¯å*ã«+)Ñn&å!r¯å*ã«å!Ñ+)Ñn&ÑÍaËEÊ<)!}2©«*ã«#ÑÃø(*©«&Éýáá}2é«ýåÍ´#"Ü«!}2Þ«*é«&·íRÊ¡)·íRÊ¡)·íRÊ¡)·íRÊ¡)·íRÊ¡)·íR§)Í$Ãç*·íRÂÆ)ÍW$}îoËEÊÃ)!"Ü«Ãç*#Õ}2ì«*ê«å!r¯å*ì«&+)Ñn&Ñ"ê«*ì«&#ÑÃÅ#*ê«"ñ«*ñ«ÉÃK)!"Ü«!å!ÑÍ5z³ÊV$Õ"ã«!r¯å*ã«+)Ñn&å*é«&ÑÍNËEÊM$*Ü«å*é«&Ñ"Ü«*ã«#ÑÃ$É!}2Ò«!å!å!Ñë·íRÑÍ5z³Ê.%Õ"ã«*ã«å!Ñå!ÑÍ5z³Ê%%Õ"á«!r¯å*ã«+)Ñn&å!r¯å*á«+)Ñn&ÑÍNå!r¯å*ã«+)Ñn&å!r¯å*á«+)Ñn&ÑÍNÑ}£oËEÊ%*Ò«&å!Ñ}2Ò«!r¯å*ã«+)Ñå!ëás!r¯å*á«+)Ñå!ëás*á«#ÑÃŒ$*ã«#ÑÃr$*Ò«&å!ÑÍt}2׫*׫&É!}2Ñ«!å!å!Ñë·íRÑÍ5z³Ê$&Õ"ã«*ã«å!Ñå!å!Ñë·íRÑÍ5z³Ê&Õ"á«*ã«å!Ñå!ÑÍ5z³Ê&Õ"ß«!r¯å*ã«+)Ñn&å!r¯å*á«+)ÑnÍ�0P(rint), E(veryone), S(core), R(eplace), Q(uit) Í�Íb!»Í8!û«ÍÛÍbÍRÍ�Íb*û«&Í(}2û«*û«&åÍQ!PÍa!EÍa!SÍa!RÍa!QÍaÍËEʺ-*û«&P·íRÂn.*¬åÍg Ãò.E·íR¤.!å*ø®ÑÍ5z³Ê¡.Õ}2ú«*ú«&åÍg *ú«&#ÑÃ.Ãò.S·íR¸.!}2ü«Ãò.R·íRÂÈ.Í5,Ãò.Q·íRÂò.!/¬åÍ gamemenu.chnÍ=!/¬Í´Íbè-Íj+ÍRÍ�Scoring number? Íb!ý«åÍç*ý«å!ÑÍ›å*ý«å!Ñ͇Ñ}£oËEÊø.!ú®å*¬+)å)å)å)ÑÑÑÑå*ý«+)Ñ^#Vëå!ÑÍNËEÊø.*ý«åÍ$É!å*ø®ÑÍ5z³ÊÝ/Õ}2‘«!å!ÑÍ5z³ÊÒ/Õ}2’«!ú®å*‘«&+)å)å)å)ÑÑÑÑå*’«&+)Ñå!ëás#r*’1!€¯¸ÿÍ�!X5‘«ͲÃz4ýáá"-¬ýå*-¬^#Vë"¬!¬Í+Í.Í_Íb!¬Í *-¬å!¬Íž*¬å!ÑÍaËEÊV ÍRÍ�Please enter a numberÍ�Íb*¬ë*-¬s#r*¬å!ÑÍNËEÊïÉýáá"¬ýå!"¬!å!ÑÍ5z³Ê!Õ}2¬*¬å!ú®å*¬+)å)å)å)ÑÑÑÑå*¬&+)Ñ^#VëÑ"¬!`¬å*¬&+)å))å))ÑÑÑÍ ÍR!ÍqÍ� = !ú®å*¬+)å)å)å)ÑÑÑÑå*¬&+)Ñ^#Vëå!ÍöÍ�Íb*¬&#ÑÀ !"¬*¬å!?ÑÍtËEÊm!*¬å!FÑ͇ËEÊN!!#"¬Ãm!*¬å!MÑ͇ËEÊg!!7"¬Ãm!!K"¬ÍRÍ�ÍbÍRÍ�Basic section totals to *¬å!ÍöÍ�Íb*¬å!ÑÍaËEÊ"ÍRÍ�with bonus ad·íRÂå)ÍE%}îoËEÊâ)!"Ü«Ãç* ·íR *Í*&ËEÊ*!"Ü«Ã*!"Ü«Ãç* ·íRÂ-*Íé&ËEÊ$*!#"Ü«Ã**!"Ü«Ãç* ·íRÂW*ÍO'ËEÊN**Ü«å!Ñ"Ü«ÃT*!"Ü«Ãç* ·íR‰*ÍO'åÍé&Ñ}£oËEÊ€**Ü«å!Ñ"ܫÆ*!"Ü«Ãç* ·íR³*Í@(ËEʪ**Ü«å!Ñ"ܫð*!"Ü«Ãç*·íRÂÀ*Ãç*·íRÂç*ÍÝ(ËEÊá**Ü«å!2Ñ"Ü«Ãç*!"Ü«!ú®å*¬+)å)å)å)ÑÑÑÑå*é«&+)Ñå*Ü«ëás#r!`¬å*é«&+)å))å))ÑÑÑÍ ÍR!ÍqÍ�ÍbÍRÍ�For a total of *Ü«å!ÍöÍ�ÍbÍRÍ�ÍbÉÍRÍ�Roll #*ü«&å!ÍöÍ�, your dice look like:Í�Íb!å!ÑÍ5z³Ê+,Õ}2 «ÍRÍ�Die #-* «&  «&#ÑÑ/*‘«&#ÑÃ|/!`¬å!+)å))å))ÑÑÑåÍ* 1 - Aces 1 for each Ace )ÍÑ!`¬å!+)å))å))ÑÑÑåÍ* 2 - Dueces 2 for each Duece )ÍÑ!`¬å!+)å))å))ÑÑÑåÍ* 3 - Treys 3 for each Trey )ÍÑ!`¬å!+)å))å))ÑÑÑåÍ* 4 - Fours 4 for each Four )ÍÑ!`¬å!+)å))å))ÑÑÑåÍ* 5 - Fives 5 for each Five )ÍÑ!`¬å!+)å))å))ÑÑÑåÍ* 6 - Sixes 6 for each Six )ÍÑ!`¬å!+)å))å))ÑÑÑåÍ* 7 - 2 pair same color Tot a die can have *) dieindex = 1..numdice; (* index into dice array *) die = record (* structure for each die *) color : diecolor; (* its color *) value : dievalue (* its value *) end; tabletype = 1..scores; (* possible ways to score *) scoretype = array[tabletype] of integer; (* used for scoring *) var dice : array[dieindex] of die; (* the dice *) score : array[1..maxplayers] of scoretype; (* keep track of scores  writeln('Grand total for basic section ',sum+bonus) end; writeln; sum := sum + bonus; for i := 7 to scores do begin sum := sum + score[player][i]; writeln(tables[i],' = ',score[player][i]) end; writeln; writeln('Total game value = ',sum); writeln; writeln('Hit any key to continue'); read(trm,ch) end; (* * play * given a player, it will roll the dice, * print out the board, keep score, and do * anything else that needs to be done al dice )ÍÑ!`¬å!+)å))å))ÑÑÑåÍ* 8 - 3 of a kind Total dice )ÍÑ!`¬å! +)å))å))ÑÑÑåÍ* 9 - Straight 30 points )ÍÑ!`¬å! +)å))å))ÑÑÑåÍ*10 - Flush same color 35 points )ÍÑ!`¬å! +)å))å))ÑÑÑåÍ*11 - Full house Total dice + 15 )ÍÑ!`¬å! +)å))å))ÑÑÑåÍ*12 - Full house same color Total dice + 20)ÍÑ!`¬å! +)å))å))ÑÑÑåÍ*13 - 4 of a kind Total dice + 25 )ÍÑ!`¬å!+)å))å))ÑÑÑåÍ*14 - Yarborough free turn to*) numplayers : integer; (* number of players in the game *) curgame : 1..maxplays; (* current play number *) ch : char; (* input character *) colors : array[diecolor] of string[7]; (* will contain red,...*) tables : array[tabletype] of string[41]; (* how scoring is done *) j : 1..maxplayers; dummy : file; {$I readnum } (* * print * prints out a given players points *) procedure print(player:integer); var sum : integer; bonus(* * kismet game *) program kismet (input, output); const maxplayers = 4; (* maximum number of players *) scores = 15; (* 15 ways to make points *) numdice = 5; (* the number of dice in the game *) maxplays = 6; (* number of plays in a game *) diemax = 6; (* die values go from 1-6 *) type diecolor = (red,green,black,white); (*possible colors *) dievalue = 1..diemax; (* possible values*) procedure play(player:integer); var num : integer; (* input number from user *) roll : 1..4; (* roll we are on *) ch : char; (* input character *) i : 1..maxplayers; (* index for printing everyone's board *) dienum : dieindex; (* used in rolling the dice *) (* * rolldie * will return a random number, and a random * color for a die *) procedure rolldie(var dice : die); begin dice.value := random(dtal dice )ÍÑ!`¬å!+)å))å))ÑÑÑåÍ*15 - Kismet 5 of a kind Total dice + 50 )ÍÑ!Ö®å!)))ÑåÍ red ÍÑ!Ö®å!)))ÑåÍ green ÍÑ!Ö®å!)))ÑåÍ black ÍÑÉÍRÍ�How many players? Íb!ø®åÍç*ø®å!ÑÍ›å*ø®å!Ñ͇Ñ}£oËEÊz4ÍíÍq/!å!ÑÍ5z³Ê 5Õ}2÷®!å*ø®ÑÍ5z³Ê5Õ}2_¬*_¬&åÍJ#*_¬&#ÑÃã4*÷®&#ÑÃÎ4!å*ø®ÑÍ5z³Ê55Õ}2_¬*_¬&åÍg *_¬&#ÑÃ5!/¬åÍ gamemenu.chnÍ=!/¬Í´ÍbÃÅ!å*ø®ÑÍ5z³ÊÕ}2_¬*_¬&åÍJ#*_¬&#ÑÃã4*÷®&#ÑÃÎ4!å*ø®ÑÍ5z³ÊÕ}2_¬*_¬&åÍg *_¬&#ÑÃ5!/¬åÍ gamemenu.chn : integer; i : tabletype; begin sum := 0; for i :=1 to 6 do begin sum := sum + score[player][i]; writeln(tables[i],' = ',score[player][i]) end; bonus := 0; if sum >= 63 then if sum <= 70 then bonus := 35 else if sum <= 77 then bonus := 55 else bonus := 75; writeln; writeln('Basic section totals to ',sum); if bonus <> 0 then begin writeln('with bonus added of ',bonus);   iemax) + 1; case (1 + random(3)) of 1: dice.color := red; 2: dice.color := green; 3: dice.color := black end end; (* * dietotal * returns the total of the sum of all the dice. *) function dietotal:integer; var i: dieindex; sum : integer; begin sum := 0; for i := 1 to numdice do sum := sum + dice[i].value; dietotal := sum end; (* * points * gives out points to a player * the way he (she) asked. for example, if the variable  if dice[i].color <> dice[i+1].color then flush := false end; (* * fullhouse * if there is a full house in the dice *) function fullhouse:boolean; (* * ifpair * if there is a pair (but not 3 or > of a kind) *) function ifpair:boolean; var tmp : array[1..diemax] of 0..numdice; (* number of each possibility *) begin (* * zero out the array *) for i := 1 to diemax do tmp[i] := 0; (* * count up the number of each  end; pair := numpairs >= 2 end; (* * three * returns whether on not there is a three of a kind in the dice *) function three:boolean; begin three := false; (* * simply roll through all combinations of three * and see if any are all equal *) for i := 1 to (numdice -2) do for j := i+1 to (numdice -1) do for k := i+2 to numdice do if (dice[i].value = dice[j].value) and (dice[j].value = dice[k].value) then : ifany; 7: if not pair then sum := 0; 8: if not three then sum := 0; 9: if straight then sum := 30 else sum := 0; 10: if flush then sum := 35 else sum := 0; 11: if fullhouse then sum := sum + 15 else sum := 0; 12: if fullhouse and flush then sum := sum + 20 else sum := 0; 13: if four then sum := sum + 25 else sum := 0; 14: ; 15: if five then sum := sum + 50 else sum := 0; end; score[player][how] := sum; writeln(t * how = 8 then the player asked for 3-of-a-kind *) procedure points(how:tabletype); var i,j,k : integer; (* indices into dice array *) return : boolean; (* used by subprocedures *) sum : integer; (* point sum *) (* * ifany * scores points if any correct * die values are shown *) procedure ifany; begin sum := 0; for i := 1 to numdice do if dice[i].value = how then sum := sum + how end; (* * pair * sees if there are 2value *) for i := 1 to numdice do tmp[dice[i].value] := tmp[dice[i].value] + 1; (* * see if any is exactly 2 *) for i := 1 to diemax do return := return or (tmp[i] = 2); ifpair := return end; (* * fullhouse *) begin fullhouse := three and ifpair end; (* * 4 of a kind *) function four:boolean; var counter : integer; j : 1..diemax; begin return := false; for j := 1 to diemax do begin counter := 0;  three := true end; (* * straight * returns whether or not there is a straight in the dice *) function straight:boolean; var has : set of 1..6; (* the dice put in a set *) begin has := []; for i := 1 to numdice do has := has + [dice[i].value]; straight := (has = [1,2,3,4,5]) or (has = [2,3,4,5,6]) end; (* * flush * whether or not there is a flush *) function flush:boolean; begin flush := true; for i := 1 to (numdice - 1) do ables[how]); writeln('For a total of ',sum); writeln end; (* * printdice * prints out the dice in a readable format *) procedure printdice; var i : dieindex; begin writeln('Roll #', roll ,', your dice look like:'); for i := 1 to numdice do writeln('Die #-',i,' ',dice[i].value,' ',colors[dice[i].color]); writeln end; (* * replace * will ask for a number (num), then will replace num dice *) procedure replace; var num : integer; used  different pairs, * with the 2 component of each pair having * the same color *) function pair:boolean; var numpairs : 0..3; begin numpairs := 0; for i := 1 to numdice -1 do for j := i+1 to numdice do if (dice[i].value = dice[j].value) and (dice[i].color = dice[j].color) then begin numpairs := numpairs + 1; dice[i].color := white; dice[j].color := white (* make sure neither is reused in a test *)  for i := 1 to numdice do if (dice[i].value = j) then counter := counter + 1; if (counter = 4) then return := true end; four := return end; (* * five * if there is five of a kind *) function five:boolean; begin five := true; for i := 1 to (numdice - 1) do if dice[i].value <> dice[i+1].value then five := false end; (* points *) begin sum := dietotal; return := false; case how of 1,2,3,4,5,6   : set of 1..numdice; numrep : 1..numdice; begin used := []; repeat write('Replace how many dice? '); readint(num) until (num > 0) and (num <= numdice); (* * cycle through num times replacing one die each time *) for numrep := num downto 1 do begin repeat repeat write('Replace which die? '); readint(num) until (num > 0) and (num <= numdice) until not (num in used); used := used + [num]; otal dice + 25 '; tables[14] := '14 - Yarborough free turn total dice '; tables[15] := '15 - Kismet 5 of a kind Total dice + 50 '; colors[red] := ' red '; colors[green] := ' green '; colors[black] := ' black ' end; (* main program *) begin repeat write('How many players? '); readint(numplayers) until (numplayers > 0) and (numplayers <= maxplayers); randomize; init; for curgame := 1 to maxplays do for j := 1 to numplayers do it * init strings *) procedure init; var i : diecolor; j : tabletype; k : 1..maxplayers; begin for k := 1 to numplayers do for j := 1 to scores do score[k][j] := 0; tables[1] := ' 1 - Aces 1 for each Ace '; tables[2] := ' 2 - Dueces 2 for each Duece '; tables[3] := ' 3 - Treys 3 for each Trey '; tables[4] := ' 4 - Fours 4 for each Four '; tables[5] := ' 5 - Fives 5 for each Fiv1!€¯¸ÿÍ�!1/�¬Ͳð.ýááÑÁÙ!¯Í¡áÑÁÙ! ¯Í¡ýå! ¯ÍüÅÕå!¯ÍüÅÕå! ¯ÍüÙáÑÁͼ ÅÕå!ÍÑÙáÑÁͳ ÅÕåÍ}ÙáÑÁÍÄ ÙáÑÁͳ Ù!¯Í¡!¯ÍüÉýááÑÁÙ!ù®Í¡ýå!ÅÕå!�ÅÕå!^¯ÍüÙáÑÁͼ ÅÕåÍçÅÕå!ù®ÍüÙáÑÁÍ‘}2ÿ®*ÿ®&Éýáá}2ò®ýå*ò®&å!0Ñë·íR"ó®*ó®Éýáá}2ì®ýå*ì®&å!0ÑÍtå*ì®&å!9Ñ͇Ñ}£o}2í®*í®&ÉýáP!•®Í²ýå!"�®!"‹®!"�®!}2Š®!}2‰®!•®Í Ímå!ÑÍ›ËEÊ"*�®å!•®Í ÍmÑͯå*‰®&Ñ}£oËEʇ!!•®å*�®Ñn&å! ÑÍNËEÊ}!*�®å!Ñ"�®Ã„!!}2‰®Ã5!*�®å!•®Í ÍmÑ͇å*Š®&}îoÑ}£oËEÊ"!•®å*�®Ñn&åÍÁ ËEÊü!*�®å! ÑÍ rolldie(dice[num]) end; roll := roll + 1 end; (* play *) begin writeln('Player number ',player); for dienum := 1 to numdice do rolldie(dice[dienum]); roll := 1; while roll < 4 do begin repeat writeln; printdice; writeln('P(rint), E(veryone), S(core), R(eplace), Q(uit) '); read(trm,ch); writeln; ch := upcase(ch) until (ch in ['P','E','S','R','Q']); case ch of 'P' : print(pla play(j); (* * now that it's all done, print out the results *) for j := 1 to numplayers do print(j); assign(dummy,'gamemenu.chn'); chain(dummy) end. e '; tables[6] := ' 6 - Sixes 6 for each Six '; tables[7] := ' 7 - 2 pair same color Total dice '; tables[8] := ' 8 - 3 of a kind Total dice '; tables[9] := ' 9 - Straight 30 points '; tables[10] := '10 - Flush same color 35 points '; tables[11] := '11 - Full house Total dice + 15 '; tables[12] := '12 - Full house same color Total dice + 20'; tables[13] := '13 - 4 of a kind TÄå!•®å*�®Ñn&åÍ£ Ñ"�®*�®å!Ñ"�®*‹®å!Ñ"‹®Ã"!}2Š®Ã‡!*‹®å!ÑÍNËEÊ"!ÿÿ"�®*�®"æ®*æ®Éýá!â­ÍâP!æ­Í²P!7®Í²ýå!}2Ý­!7®Í ÍR!ÍqÍb!»Í8!Ü­ÍÛÍb*Ü­&Í(}2Ü­ÍRÍ�Íb*Ü­&å!â­Í-ÍËEÊ¡"!}2ݭö"!æ­Í ÍR!ÍqÍ�Íb*Ý­&}îoËEÊJ"*Ü­&}2ˆ®*ˆ®&É!(­åÍ LANDINST.DATÍ<Íb!(­ÍÏÍb!(­Í�}îoËEÊ1#!(­Í8!Ö¬PÍ.Í_Íb!Ö¬Í ÍR!ÍqÍ�ÍbÃö"ÉÍDo you want instructions? ÍPlease answer Y or NÍQ!YÍa!NÍaÍ&"å!YÑÍNËEÊŠ#ÍÓ"ÍíÉÍLevel of difficulty? Í.B:Beginner, E:Expert, N:Navigayer); 'E' : for i := 1 to numplayers do print(i); 'S' : roll := 4; 'R' : replace; 'Q' : begin assign(dummy,'gamemenu.chn'); chain(dummy) end; end (* case *) end; (* while *) printdice; repeat repeat write('Scoring number? '); readint(num) until (num > 0) and (num <= scores); until score[player][num] = 0; points(num) end; (* * in  tor, A:AstronautÍQ!BÍa!EÍa!NÍa!AÍaÍ&"}2ͬ*ͬ&B·íRÂ$!}ÌÌÌÌLÙ!^¯Í¡Ãp$E·íRÂ9$!~ÌÌÌÌLÙ!^¯Í¡Ãp$N·íRÂV$!™™™™Ù!^¯Í¡Ãp$A·íRÂp$!€Ù!^¯Í¡ÉÍŽ#!„ÅÕå!^¯ÍüÙáÑÁͳ ÅÕå!„0ÅÕå!^¯ÍüÙáÑÁͳ ÅÕåÍçÙ!j¯Í¡!�ÅÕå!^¯ÍüÙáÑÁͳ ÅÕå!‚ÅÕå!^¯ÍüÙáÑÁͳ ÅÕåÍçÅÕå!‡HÙáÑÁÍÄ Ù!p¯Í¡!ÅÕå!‡HÅÕå!^¯ÍüÙáÑÁÍÄ ÅÕåÍçÅÕå!…pÙáÑÁͳ Ù!v¯Í¡!†HÅÕå!‚@ÅÕå!^¯ÍüÙáÑÁͼ ÅÕå!ƒÅÕå!^¯ÍüÙáÑÁͼ ÅÕåÍçÙáÑÁÍÄ Í™"T¯!ƒ@ÅÕå!„ ÅÕå!^¯ÍüÙáÑÁÍÄ +}2¦¬*¦¬&É!p¯ÍüÅÕå!}ÌÌÌÌLÙáÑÁ͸ËEÊ£.!v¯Íü˸Ù!v¯Í¡!v¯ÍüÅÕå!d¯ÍüÙáÑÁ͸ËEÊ>.ÍRÍ�We have landed safelyÍbÃW.ÍRÍ�We have crashedÍbÍRÍ� at a speed of !v¯ÍüÅÕå!å!Í@Í� meters/second.Í�Íb!}2¡¬Ãª.!}2¡¬*¡¬&ÉÍ2#Íq$Í+ÍÔ-åÍg-Ñ}³oËEʶ.ÍAgain? ÍY or NÍQ!YÍa!NÍaÍ&"å!NÑÍNËEʳ.ÍRÍ�Bye!Í�Íb!¯åÍ gamemenu.chnÍ=!¯Í´ÍbÃÅ2#Íq$Í+ÍÔ-åÍg-Ñ}³oËEʶ.¯Ñ͇å*V¯å!ÑÍtÑ}£oËEÊ)É*T¯å*V¯Ñë·íR"T¯!"µ¬*µ¬å!Ñ"µ¬!p¯ÍüÅÕå!v¯ÍüÅÕå!}ÌÌÌÌLÙáÑÁÍÄ ÙáÑÁͼ ÅÕå!j¯ÍüÅÕå*V¯ÍÑÙáÑÁͼ ÅÕå!€ÙáÑÁÍÄ ÅÕå!}ÌÌÌÌLÍÁ ÙáÑÁÍÄ ÙáÑÁͼ Ù!p¯Í¡!v¯ÍüÅÕå!j¯ÍüÅÕå*V¯ÍÑÙáÑÁͼ ÅÕå!}ÌÌÌÌLÙáÑÁÍÄ ÙáÑÁͳ Ù!v¯Í¡*µ¬å!å!}ÌÌÌÌLÙáÍÑÍÉ Í§ÑÍNå!p¯ÍüÅÕå!}ÌÌÌÌLÙáÑÁÍ‘Ñ}³oËEÊù)ÉÍï%Í '*T¯å!ÑÍ›ËEÊ+Í)Ã$+!"V¯Íä)É!}ÌÌÌÌLÅÕåÍP ËEÊ”+ÍRÍ�ADespite the precautionary measures taken, the ship was destroyed.Í�Íb!}2°¬Ãæ+ÍRÍ�>Your prudent actions saved the ship from the mevel, is * less than the argument *) function unlucky(percentchance : real) : boolean; begin unlucky := rand(0.0, 1.0 - chance) <= percentchance; end; (* * converts a numerical ascii character to its corresponding integral value *) function asciitoint(digit : char) : integer; begin asciitoint := ord(digit) - ord('0'); end; (* * returns true if the argument is a numerical digit *) function isdigit(ch : char) : boolean; begin isdigit := (ch >= '0') and (ch <= ÙáÑÁͼ Ù!d¯Í¡!�Ù!X¯Í¡!}2F¯ÉÍRÍ�ÍbÍRÍ�You are Íb!v¯ÍüÅÕå!ÙáÑÁÍ¥ËEÊ<&ÍRÍ�fallingÍbÃL&ÍRÍ�risingÍbÍRÍ� from a height of !p¯ÍüÅÕå!å!Í@Í�ÍbÍRÍ� meters at !v¯Íü˸ÅÕå!å!Í@Í� m/s.Í�Íb*F¯&}îoËEÊû&ÍRÍ� There are *T¯å!ÍöÍ� liters of fuel left.Í�Íb*T¯å!ÑÍN}2F¯É!�Ù!X¯Í¡!}ÌÌÌÌLÅÕåÍP ËEÊ)!‚ÅÕå!ƒ`ÅÕå!„ ÅÕå!^¯ÍüÙáÑÁÍÄ ÙáÑÁͳ ÅÕåÍçÍ™"R¯!å*R¯ÑÍ5z³Ê°'Õ"¿¬!X¯ÍüÅÕå!€ÌÌÌÌLÙáÑÁÍÄ Ù!X¯Í¡*¿¬#ÑÃ~'ÍRÍ�"We are on a collisprogram lander; const instrfile = 'LANDINST.DAT'; maxrand = 32767; timeinc = 0.1; slightly = 0.1; moderately = 0.2; very = 0.3; impossible = 0.5; certainty = 1.0; minmeteors = 2.0; maxmeteors = 7.0; eachmisschance = 0.8; minavoid = 10; landingheight = 0.1; crashlandspeed = 6.0; type answers = set of 'A'..'Z'; str80 = string[80]; var speed, height, gravity : real; maenacing meteors!Í�Íb!}2°¬*°¬&É!�ÅÕå!X¯ÍüÙáÑÁͼ ÅÕåÍP }îoËEÊq,ÍRÍ�FYour piloting skills have steered you through the center of the swarm!Í�Íb!}2«¬Ãa-*F¯&ËEÊ -ÍRÍ�CWhat a pity .. your craft was demolished by meteors before it couldÍ�ÍbÍRÍ�)be vaporized on contact with the surface.Í�Íb!}2«¬Ãa-ÍRÍ�BYour pointless gambling has destroyed the ship, you foolish plebe!Í�Íb!}2«¬*«¬&É!X¯ÍüÅÕå!�ÙáÑÁÍWå!p¯ÍüÅÕå!}ÌÌÌÌLÙáÑÁÍ‘Ñ}³oËEÊ­-!}2¦¬ÃÎ-*V¯å! ÑÍ›ËEÊÇ-Í(+}2¦¬ÃÎ-Íì'9'); end; (* * convert determines the numerical value of the digits ina string. it returns * the integer and updates the string to now contain whatever was after the * end of the number. if the string is blank, the value is zero; if a number * is not found it returns -1. *) function convert(numstring : str80) : integer; var intvalue : integer; position : integer; digitsfound : integer; endofnumber : boolean; notinteresting : boolean; begin inion course with *R¯å!ÍöÍ�ÍbÍRÍ�meteors.Íb*F¯&ËEÊ(ÍRÍ�ÍbÃ)ÍRÍ�If we do not use more than ! å!ÍöÍ�liters of fuel in theÍ�ÍbÍRÍ�next second, there is a !‡HÅÕå!�ÅÕå!X¯ÍüÙáÑÁͼ ÙáÑÁÍÄ Í™å!ÍöÍ� % probability that we will beÍ�ÍbÍRÍ�*hit. If more is used it will be only 10 %.Í�ÍbÉÍRÍ�Units of fuel : Íb!G¯Í+ Í.Í_Íb!G¯Í Íó "V¯*V¯å*T¯ÑÍ›ËEʈ)ÍRÍ� There isn't that much fuel left.Í�ÍbÃÃ)*V¯å!ÑͯËEÊÃ)ÍRÍ�I don't think that's possible.Í�Íb*V¯å*Txlandingspeed : real; chance, misschance : real; burn, fuel : integer; nummeteors : integer; inp : string[10]; ranout : boolean; dummy : file; (* * returns a random real number between lowlimit and highlimit *) function rand(lowlimit, highlimit : real) : real; begin rand := lowlimit + (highlimit - lowlimit + 1) * random; end; (* * returns true if a random number, weighted by the difficulty l  tvalue := 0; digitsfound := 0; position := 1; endofnumber := false; notinteresting := true; if length(numstring) > 0 then begin while (position < length(numstring)) and notinteresting do if numstring[position] = ' ' then position := position + 1 else notinteresting := false; while (position <= length(numstring)) and (not endofnumber) do if isdigit(numstring[position]) then begin intvalu0; speed := rand(0.0, 100.0 * chance) + 30.0; fuel := round(50.0 * rand(3.0 - chance, 4.0 - chance)); maxlandingspeed := crashlandspeed - 10.0 * chance; misschance := certainty; ranout := false; end; (* * tell player his height, speed and direction *) procedure writestatus; begin writeln; write('You are '); if speed > 0.0 then write('falling') else write('rising'); writeln(' from a height of ',height:1:1); writeln('meters at ',abs(str : string[80]; begin assign(instruct,instrfile); reset(instruct); while not eof(instruct) do begin readln(instruct,str); writeln(str); end; end; procedure startup; begin if ask('Do you want instructions? ','Please answer Y or N',['Y','N']) = 'Y' then instructions; randomize; end; (* * ask the player for the difficulty level of the next landing *) procedure getdifficulty; var level : char; begin level := ask('Le fuel to use in the next time period. *) procedure getburn; const fuelprompt = 'Units of fuel : '; begin repeat write(fuelprompt); readln(inp); burn := convert(inp); if burn > fuel then writeln('There isn''t that much fuel left.') else if burn < 0 then writeln('I don''t think that''s possible.'); until (burn <= fuel) and (burn >= 0); end; (* * figure out the craft's new speed according to the laws of physics *) procedure := intvalue * 10 + asciitoint(numstring[position]); position := position + 1; digitsfound := digitsfound + 1; end else endofnumber := true; if digitsfound = 0 then intvalue := -1; end; convert := intvalue; end; (* * asks a question with a single character answer. if the response is in the * set 'answers', the letter is returned. otherwise the string ifbad is * printed and the question is asked again. *) speed):1:1,' m/s.'); if not ranout then writeln('There are ',fuel:1,' liters of fuel left.'); ranout := fuel = 0; end; (* * determines if there are any meteors, and if so, how many *) procedure lookformeteors; var eachrock : integer; begin misschance := certainty; if unlucky(0.1) then begin nummeteors := round(rand(minmeteors,maxmeteors + 10.0 * chance)); for eachrock := 1 to nummeteors do misschance := misschance * eachmisschance; vel of difficulty? ','B:Beginner, E:Expert, N:Navigator, A:Astronaut', ['B','E','N','A']); case level of 'B' : chance := slightly; 'E' : chance := moderately; 'N' : chance := very; 'A' : chance := impossible; end; end; (* * variables that must be re-set each time a new landing is attempted *) procedure startgame; begin getdifficulty; gravity := rand(9.0 + chance, 11.0 + chance); height := rand(1.0 + chance, 2.0 + chance) * 100.e updatestatus; var deltat : integer; begin fuel := fuel - burn; deltat := 0; repeat deltat := deltat + 1; height := height - speed * timeinc - (gravity - burn) * 0.5 * sqr(timeinc); speed := speed + (gravity - burn) * timeinc; until (deltat = trunc(1 / timeinc)) or (height <= landingheight); end; (* * all the procedures that make a turn *) procedure doaturn; begin writestatus; lookformeteors; if fuel > 0 then getburn else  function ask(question, ifbad : str80; responses : answers) : char; var bad : boolean; ch : char; begin bad := true; repeat write(question); read(trm,ch); ch := upcase (ch); writeln; if ch in responses then bad := false else writeln(ifbad); until not bad; ask := ch; end; (* * prints out the instructions from a file instrfile *) procedure instructions; var instruct : text; ch : char;  writeln('We are on a collision course with ',nummeteors:1); write('meteors.'); if ranout then writeln else begin writeln('If we do not use more than ',minavoid:1,'liters of fuel in the'); writeln('next second, there is a ',round(100.0*(1.0-misschance)), ' % probability that we will be'); writeln('hit. If more is used it will be only 10 %.'); end; end; end; (* * asks the player for the amount of   burn := 0; updatestatus; end; (* * the course has changed: meteors have a lower chance of hitting *) function coursechanged : boolean; begin if unlucky(0.1) then begin writeln('Despite the precautionary measures taken, the ship was destroyed.'); coursechanged := true; end else begin writeln('Your prudent actions saved the ship from the menacing meteors!'); coursechanged := false; end end; function coursesame: booleanh to the ground that we can * say it has landed. could crash or touch down safely. *) function landed : boolean; begin if height < landingheight then begin speed := abs(speed); if speed < maxlandingspeed then write('We have landed safely') else write('We have crashed'); writeln(' at a speed of ',speed:1:1,' meters/second.'); landed := true; end else landed := false; end; begin startup; repeat s A simple when the fuel is asked for is equivalent to '0'. ; begin if not unlucky(1.0 - misschance) then begin writeln('Your piloting skills have steered you through the center of the swarm!'); coursesame := false; end else if ranout then begin writeln('What a pity .. your craft was demolished by meteors before it could'); writeln('be vaporized on contact with the surface.'); coursesame := true; end else begin writeln('Your pointless gambling has destroyed the ship, you fool LANDER is a game which simulates landing a ship on a planet. The ship's fuel, speed, and height, as well as the gravity and the maximum successful landing speed on the planet, are randomly determined at the start of each game, though they are weighted according to the skill level chosen. In order of increasing difficulty the choices are: B Beginner E Expert N Navigator A Astronaut In additiotartgame; repeat doaturn; until landed or anyhit; until ask('Again? ','Y or N',['Y','N']) = 'N'; writeln('Bye!'); assign(dummy,'gamemenu.chn'); chain(dummy) end. ish plebe!'); coursesame := true; end; end; (* * figures if any meteors (if there were any) managed to hit the ship. * different messages are printed depending on the thrust of the last turn. *) function anyhit : boolean; begin if (misschance = certainty) or (height <= landingheight) then anyhit := false else if burn > minavoid then anyhit := coursechanged else anyhit := coursesame; end; (* * returns true if the ship has come close enougn to the usual dangers of running out of fuel and landing too quickly (also known as crashing), a swarm of meteors will occasionally get on a collision course with you. If you do not change your course enough by burning a sufficient amount of fuel, each has a 20 % chance of hitting you. Even if you do so, 10 % of the time one of the rocks will stray and still hit you. This program uses its own integer conversion routines, and so will not 'bomb' if the amount of fuel is mistyped.   1!€¯¸ÿÍ�!l%ö®ͲÃ#ýáá"A¯ýå*A¯^#Vë"&¯!(¯Í+Í.Í_Íb!(¯Í *A¯å!$¯Íž*$¯å!ÑÍaËEÊV ÍRÍ�Please enter a numberÍ�Íb*&¯ë*A¯s#r*$¯å!ÑÍNËEÊïÉýáá}2!¯ýå!"¯*!¯&·íRÂã ÍRÍ�Binary: Íb!å!ÑÍ5z³Êà Õ"¯!Í" ¯*¯å!ÑÍÄå* ¯Ñ"¯* ¯ÍRå!ÍöÍb*¯#Ñá ò!·íRÂK!ÍRÍ�Octal: Íb!å!ÑÍ5z³ÊH!Õ"¯!Í" ¯*¯å!ÑÍÄå* ¯Ñ"¯* ¯ÍRå!ÍöÍb*¯#Ñà !ò!·íR²!ÍRÍ� Decimal: Íb!å!ÑÍ5z³Ê²!Õ"¯! Í" ¯*¯å! ÑÍÄå* ¯Ñ"¯* ¯ÍRå!ÍöÍb*¯#ÑÃs!*¯""¯*"¯Éýáá"¯á}2 ¯ýåueses *) ch : char; (* used to answer questions *) frombase : base; (* from this base *) tobase : base; (* to this base *) good : boolean; input : char; dummy : file; {$I readnum } (* * makenumber * creates a random number of base * first, then prints it out in base * first. it then returns a decimal representation * of that number *) function makenumber(first:base):integer; var temp : string[10]; nuber *) (* * getnumber * gets a number from the user, in the * passed base. it then checks to see * if it is equal to the decimal answer * it was passed. it returns a boolean indictor * whether or not they matched *) function getnumber(readbase:base; answer:integer):boolean; var ch : string[5]; (* input from user *) factor : integer; (* multiplying factor *) inter : integer; (* intermediate results *) index : integer; (* index intÍRÍ� -> Íb* ¯&·íRÂ"ÍRÍ� decimal: Íb! "ü®ÃJ"·íRÂ'"ÍRÍ� octal: Íb!"ü®ÃJ"·íRÂJ"ÍRÍ� binary: Íb!"ü®!þ®Í+Í.Í_Íb!þ®Í Ím"ö®!"ø®!"ú®*ö®å*ø®ÑÍtËEÊã"!þ®å*ø®Ñn&åÍQ!0å!9ÍkÍËEÊÎ"*ú®å*ü®ÑÍÄå!þ®å*ø®Ñn&å!0Ñë·íRÑ"ú®ÃÔ"*ö®"ø®*ø®å!Ñ"ø®Ãs"*ú®å*¯ÑÍNËEÊý"!}2 ¯Ã#ÍRÍ�Wrong!!!Í�Íb!}2 ¯* ¯&ÉÍRÍ�Which would you like?Í�ÍbÍRÍ�1) Binary to decimalÍ�ÍbÍRÍ�2) Binary to octalÍ�ÍbÍRÍ�3) Octal to decimalÍ�ÍbÍRÍ�Which number? Íb!s¯Í+ÍÛÍ_Íb!m : integer; index : integer; i : integer; begin num := 0; case first of binary : begin write('Binary: '); for index := 1 to 5 do begin i := random(base2); num := num * base2 + i; write(i:1) end end; octal : begin write('Octal: '); for index := 1 to 2 do begin (* * numcnvrt * tests your ability to convert a number * from bases * binary -> decimal, decimal -> binary * octal -> decimal, decimal -> octal * binary -> octal, octal -> binary *) program numcnvrt (input, output); const base2 = 2; (* binary *) base8 = 8; (* octal *) base10 = 10; (* decimal *) type base = (binary,octal,decimal); var i : integer; (* index variable *) right : integer; (* number of correct go ch *) strlength : integer; (* length of read in string *) begin write(' -> '); case readbase of decimal : begin write(' decimal: '); factor := base10 end; octal : begin write(' octal: '); factor := base8 end; binary : begin write(' binary: '); factor := base2 end end; readln(ch); strleng}2t¯*s¯&1·íRÂî#!}2v¯!}2u¯Ãm$2·íR $!}2v¯!}2u¯Ãm$3·íRÂ$$!}2v¯!}2u¯Ãm$ÍRÍ�Illegal numberÍ�ÍbÍRÍ�Which number? Íb!s¯Í+ÍÛÍ_Íb!}2t¯*t¯&å!ÑÍNËEÊÈ#Íí!"x¯!å! ÑÍ5z³ÊÉ$Õ"z¯*u¯&å*v¯&åÍg åͼ!ËEÊÀ$*x¯å!Ñ"x¯*z¯#ÑÓ$ÍRÍ�ÍbÍRÍ�You got *x¯å!ÍöÍ� out of 10Í�ÍbÍRÍ�ÍbÍRÍ�Again? Í�Íb!»Í8!w¯ÍÛÍbÍRÍ�Íb*w¯&Í(å!YÑÍaËEÊ#!C¯åÍ gamemenu.chnÍ=!C¯Í´ÍbÃÅ� out of 10Í�ÍbÍRÍ�ÍbÍRÍ�Again? Í�Íb!»Í8!w¯ÍÛÍbÍRÍ�Íb*w¯&Í(å!YÑÍaËEÊ# i := random(base8); num := num * base8 + i; write(i:1) end end; decimal : begin write('Decimal: '); for index := 1 to 2 do begin i := random(base10); num := num * base10 + i; write(i:1) end end end; makenumber := num end; (* makenum  th := length(ch); index := 1; inter := 0; while (strlength >= index) do begin if ch[index] in ['0'..'9'] then inter := (inter * factor) + (ord(ch[index]) - ord('0')) else index := strlength; index := index + 1 end; if inter = answer then getnumber := true else begin writeln('Wrong!!!'); getnumber := false end end; (* getnumber *) (* main -------------------------------------------------------------- *) ÍRÍ� you get $*x¯å!ÑÍÄå!ÍöÍ�Íb*z¯å*x¯å!ÑÍÄÑ"z¯ÃÐ"*v¯&å!Ñͯå*u¯&å!ÑͯÑ}£oå*v¯&å!ÑÍ›å*u¯&å!ÑÍ›Ñ}£oÑ}³oËEÊ "ÍRÍ�You made even money.Í�ÍbÍRÍ� you won $*x¯å!ÍöÍ�Íb*z¯å*x¯Ñ"z¯ÃÐ"ÍRÍ� You lost $*x¯å!ÍöÍ�Íb*z¯å*x¯Ñë·íR"z¯ÍRÍ�You new total is $*z¯å!ÍöÍ�ÍbÉÃÆ#ýáá"Á®á"îP!ŮͲýå!ÿÿ"»®*»®å*îÑͯå*»®å*Á®ÑÍ›Ñ}³oËEʼ#!Å®Í ÍR!ÍqÍbÍí!»®åÍç*»®å*îÑͯå*»®å*Á®ÑÍ›Ñ}³oËEʹ#ÍRÍ�Sorry, only numbers between *îå!ÍöÍ� and *Á®å!ÍöÍ�ÍbÃ#*»®"¯*¯ÉÍn; writeln('You got ',right:2,' out of 10'); writeln; writeln('Again? '); read(trm,ch); writeln until upcase(ch) <> 'Y'; assign(dummy,'gamemenu.chn'); chain(dummy) end. program overunder(input, output); const maxdie = 6; (* the maximum # on a die *) mindie = 1; (* the minimum # on a die *) maxsum = 12; (* maximum sum for two dice *) minsum = 2; (* minimum sum for two dice *) startmoney = 500; (* amount of money player starts with *) type diesum = mindie..maxsum; (* type for the sum of dice *) dietype = mindie..maxdie; (* a die value *) str80 begin repeat writeln('Which would you like?'); writeln('1) Binary to decimal'); writeln('2) Binary to octal'); writeln('3) Octal to decimal'); write('Which number? '); readln(input); repeat good := true; case input of '1' : begin frombase := binary; tobase := decimal end; '2' : begin frombase := binary; tobase := octal What number do you want? !å! åÍý"}2u¯Í Your bet? !å*z¯åÍý""x¯ÉÍRÍ�ÍbÍRÍ� Overunder:Í�ÍbÍRÍ�A simple dice game.Í�ÍbÍRÍ�%You choose a number between 2 and 12.Í�ÍbÍRÍ�)If the sum of two dice rolled is the sameÍ�ÍbÍRÍ�&as the number you picked, you win fourÍ�ÍbÍRÍ�'times your bet. If your number, and theÍ�ÍbÍRÍ�'dice sum are either both under, or bothÍ�ÍbÍRÍ�(over 7, then you win the amount you bet.Í�ÍbÍRÍ�ÍbÍRÍ�ÍbÉ!ô"z¯ÍRÍ�Do you want instructions? Íb!»Í81!€¯¸ÿÍ�!Ê&·®ͲÚ%ýáá"B¯ýå*B¯^#Vë"'¯!)¯Í+Í.Í_Íb!)¯Í *B¯å!%¯Íž*%¯å!ÑÍaËEÊV ÍRÍ�Please enter a numberÍ�Íb*'¯ë*B¯s#r*%¯å!ÑÍNËEÊïÉÀ !å!ÍÑ}2 ¯* ¯&ÉÍRÍ�'Die#1 Die#2 Sum Your# RollÍ�ÍbÍj }2w¯*w¯&ÍRå!ÍöÍ� Íb*w¯&}2v¯Íj }2w¯*v¯&å*w¯&Ñ}2v¯*w¯&ÍRå!ÍöÍ� *v¯&å!ÍöÍ� *u¯&å!ÍöÍ� Íb*v¯&å!ÑͯËEÊb!ÍRÍ�UnderÍ�ÍbÙ!*v¯&å!ÑÍ›ËEʈ!ÍRÍ�OverÍ�ÍbÙ!ÍRÍ�EvenÍ�Íb*v¯&å*u¯&ÑÍNËEÊ"ÍRÍ�You matched!!!!Í�Íb = string[80]; (* a string *) var money : integer; (* how much money player has *) bet : integer; (* how much is being bet this time *) die : dietype; (* value of a die *) sum : diesum; (* sum of the 2 dice *) numnum : diesum; (* number picked by player *) ch : char; (* used to answer questions *) dummy : file; {$I readnum } (* * play * throws the dice, prints them out, * an end; '3' : begin frombase := octal; tobase := decimal end else begin writeln('Illegal number'); write('Which number? '); readln(input); good := false end end; until good = true; randomize; right := 0; for i := 1 to 10 do if getnumber(tobase, makenumber(frombase)) then right := right + 1; writel!t¯ÍÛÍbÍRÍ�Íb*t¯&Í(å!YÑÍNËEÊô%Í$ÍRÍ�ÍbÍú"ÍRÍ�ÍbÍg ÍRÍ�ÍbÍRÍ�Want to try again? Íb!»Í8!t¯ÍÛÍbÍRÍ�Íb*t¯&Í(å!YÑÍaå*z¯å!Ñ͇Ñ}³oËEÊô%*z¯å!Ñ͇ËEʧ&ÍRÍ�Sorry, you're out of money.Í�Íb!D¯åÍ gamemenu.chnÍ=!D¯Í´ÍbÃÅ*t¯&Í(å!YÑÍaå*z¯å!Ñ͇Ñ}³oËEÊô%*z¯å!Ñ͇ËEʇÍRÍ�Sorry, you're out of money.Í�Íb!D¯åÍ gamemenu.chnÍ=!D¯Í´ÍbÃo  d keeps score *) procedure play; (* * dieroll * returns a random die value *) function dieroll:dietype; begin dieroll := 1 + random(maxdie) end; (* dieroll *) begin writeln('Die#1 Die#2 Sum Your# Roll'); die := dieroll; write(die:4,' '); sum := die; die := dieroll; sum := sum + die; write(die:4,' ',sum:4,' ',numnum:4,' '); if sum < 7 then writeln('Under') else if sum > 7 then ln; if upcase(ch) = 'Y' then inst; repeat writeln; getnumbers; writeln; play; writeln; write('Want to try again? '); read(trm,ch); writeln; until (upcase(ch) <> 'Y') or (money <= 0); if money <= 0 then writeln('Sorry, you''re out of money.'); assign(dummy,'gamemenu.chn'); chain(dummy) end.  write(question); randomize; readint(num); if (num < min) or (num > max) then writeln('Sorry, only numbers between ',min,' and ',max) end; legal := num; end; (* legal *) begin numnum := legal('What number do you want? ',minsum,maxsum); bet := legal('Your bet? ',1,money); end; (* getnumbers *) (* * inst * print out a list of instructions *) procedure inst; begin writeln; writeln('Overunder:'); writ(* * pascal * creates and draws pascal triangles of any size *) program pascal(input, output); var ch : char; (* used to answer questions *) dummy : file; (* * triangle * creates the triangle and prints it out. * note that only one row is created. To make * a node, all you need to know is the value of * the node to its left, and the value of the node * directly above it. as a result, i only keep the * previous row. *) procedure triangle; type nodeptr = ^ writeln('Over') else writeln('Even'); if sum = numnum then begin writeln('You matched!!!!'); writeln('you get $',bet*4); money := money + (bet * 4) end else if ((sum < 7) and (numnum < 7)) or ((sum > 7) and (numnum > 7)) then begin writeln('You made even money.'); writeln('you won $',bet); money := money + bet end else begin writeln('You lost $',bet); money := money1!€¯¸ÿÍ�!™"¯ͲÃ)"ÃÉ ýáá"5¯ýå*5¯^#Vë"¯!¯Í+Í.Í_Íb!¯Í *5¯å!¯Íž*¯å!ÑÍaËEÊY ÍRÍ�Please enter a numberÍ�Íb*¯ë*5¯s#r*¯å!ÑÍNËEÊòÉýáá"¯ýå*?¯å!ÑÍNËEÊ• *¯ÍRå!ÍöÍbÃÈ *¯å*?¯ÑÍå!ÑÍNËEʼ ÍRÍ� ÍbÃÈ ÍRÍ�* ÍbÉ!;¯ÍcÍRÍ�/Which multiples do you want printed as spaces? Íb!?¯åÍêÍRÍ�Size of the triangle? Íb!A¯åÍê!å*A¯ÑÍ5z³Ê„!Õ"9¯!åÍj !C¯å!Í¥!ë*C¯s#r*C¯å*E¯ëás#r*C¯"E¯*9¯#ÑÃA!ÍRÍ�Íb!å*A¯ÑÍ5z³Ê""Õ"7¯!"=¯*E¯"C¯!å*A¯å*7¯Ñë·íRÑÍ5z³Ê"Õ"9eln('A simple dice game.'); writeln('You choose a number between 2 and 12.'); writeln('If the sum of two dice rolled is the same'); writeln('as the number you picked, you win four'); writeln('times your bet. If your number, and the'); writeln('dice sum are either both under, or both'); writeln('over 7, then you win the amount you bet.'); writeln; writeln end; (* inst *) begin money := startmoney; write('Do you want instructions? '); read(trm,ch); writenode; node = record value : integer; (* value of this node *) next : nodeptr; (* next node (may be nil) *) end; var start : nodeptr; (* beginning of the last line *) curnode : nodeptr; (* current node *) size : integer; (* how big the triangle is to be *) mult : integer; (* the multiples to be removed *) last : integer; (* value of the last node *) heap : ^integer; (* pointer to the heap *) which : integer; (* which  - bet end; writeln('You new total is $',money) end; (* play *) (* * getnumbers * get the guess and the bet from the * player *) procedure getnumbers; (* * legal * gets a number between min * and max from the player, with proper error * checking *) function legal(question: str80;min,max:integer):integer; var num : integer; (* input number *) begin num := -1; while (num < min) or (num > max) do begin ¯*=¯å*C¯^#VëÑåÍj *C¯^#Vëå*=¯Ñë*C¯s#r*C¯^#Vë"=¯*C¯^#Vë"C¯*9¯#ÑÃÁ!ÍRÍ�Íb*7¯#ÑØ!!;¯ÍkÉÍçÍRÍ�ÍbÍRÍ� Continue? Íb!»Í8!{¯ÍÛÍbÍRÍ�Íb*{¯&Í(å!YÑÍaËEÊ)"!K¯åÍ gamemenu.chnÍ=!K¯Í´ÍbÃÅ*7¯#ÑØ!!;¯ÍkÉÍçÍRÍ�ÍbÍRÍ� Continue? Íb  node we are printing on the line *) left : integer; (* how many rows of the triangle left *) {$I readnum } (* * print * prints out the current node *) procedure print(value: integer); begin if mult = 0 then (* if mult = 0 => user wants real triangle *) write(value:4) else if (value mod mult) = 0 then write(' ') else write('* ') end; begin mark(heap); (* used to free up space *) write('Which multiples do youmediately adjacent to it. If a cell isÍ�ÍbÍRÍ�=empty and has exactly 3 neighbors it will be born in the nextÍ�ÍbÍRÍ�6generation. If it is alive and has either two or threeÍ�ÍbÍRÍ�9neighbors, it will continue to live. Otherwise it dies ofÍ�ÍbÍRÍ�loneliness or overcrowding.Í�ÍbÍRÍ�< The initial pattern is entered by typing the row and thenÍ�ÍbÍRÍ�Athe column of the desired position. A cell is removed by enteringÍ�ÍbÍRÍ�>its position again. To finish entering give a position outs'*–#ÑÃ'*–#ÑÃÏ&*–#Ñì&É!"|–!"z–!q–ð•í°Íç!ÿÿå!Ñå*ô•å!Ñë·íRåÍ%å!å!Ñë·íRå*ö•å!ÑåÍF%ÑÍ5z³Ê•)Õ"ú•!ÿÿå!Ñå*ð•å!Ñë·íRåÍ%å!På!Ñë·íRå*ò•å!ÑåÍF%ÑÍ5z³ÊŒ)Õ"ø•!€–å*ú•#)å)å))å)å)å)ÑÑÑÑÑÑå*ø•#å)ÑÑ"ü•*ü•n&·íRÂ)*ü•^#Vëå!ÑÍNËEÊ)!ë*ü•s*ø•å*ú•ÍÍR!*ÍòÍb*ø•å*ú•åÍu%*|–å!Ñ"|–Ã)·íRƒ)*ü•^#Vëå!ÑÍNå*ü•^#Vëå!ÑÍNÑ}³oËEÊY)*ø•å*ú•åÍu%Ã)!ë*ü•s*ø•å*ú•ÍÍR! ÍòÍb*z–å!Ñ"z–*ø•#ÑÃ{(*ú•#ÑÃ9(*~–å*|–Ñå*z–Ñë·íR"~–ÉÃA*!å!Í!ÿÿå!Ñå!På! want printed as spaces? '); readint(mult); write('Size of the triangle? '); readint(size); (* * create the first row. * note that it is being created from * the left side toward the right. *) for which := 1 to size do begin print(1); new(curnode); curnode^.value := 1; curnode^.next := start; start := curnode end; writeln; for left := 1 to size do begin last := 0; curnode := start; for which := 1 to (sideÍ�ÍbÍRÍ� 'Y'; assign(dummy,'gamemenu.chn'); chain(dummy) end. ^#Vëå*–åÍF%ëás#r*–å*–^#Vëå*–åÍ%ëás#rÉ*u–å!Ñë·íRå*w–å!ÑÑÍ5z³ÊŽ&Õ"–*q–å!Ñë·íRå*s–å!ÑÑÍ5z³Ê…&Õ" –!€–å*–#)å)å))å)å)å)ÑÑÑÑÑÑå* –#å)ÑÑå!ëás#r* –#ÑÃ;&*–#ÑÃ&ÉÍþ%*u–å!Ñë·íRå*w–å!ÑÑÍ5z³Êå'Õ"–*q–å!Ñë·íRå*s–å!ÑÑÍ5z³ÊÜ'Õ"–!€–å*–#)å)å))å)å)å)ÑÑÑÑÑÑå*–#å)ÑÑn&å!ÑÍNËEÊÓ'!ÿÿå!ÑÍ5z³ÊÓ'Õ"–!ÿÿå!ÑÍ5z³ÊÊ'Õ"–!€–å*–å*–Ñ#)å)å))å)å)å)ÑÑÑÑÑÑå*–å*–Ñ#å)ÑÑå!€–å*–å*–Ñ#)å)å))å)å)å)ÑÑÑÑÑÑå*–å*–Ñ#å)ÑÑ^#Vëå!Ñëás#r*–#ÑÃ2  Í� is : ÍbÃŽ*Í®)ÉÍl$Í«)Í�&Íæ'*~–å!ÑÍNå*|–å!ÑÍNå*z–å!ÑÍNÑ}£oÑ}³oåÍ Ñ}³oËEÊä+!å!ÍÍ ËEÊF,!»Í8!y–ÍÛÍbÞ,*~–å!ÑÍNËEÊ{,ÍRÍ�This colony has died.Í�ÍbÞ,ÍRÍ�The pattern is stable.Í�Íb!A–åÍ gamemenu.chnÍ=!A–Í´ÍbÃÅbÃ2,*~– begin writeln('please answer yes or no'); read(trm,answer); writeln end; if upcase(answer) = 'Y' then begin writeln('LIFE simulates the growth of a colony of animals on a 0..', height-1:1,' by 0..',width-1:1,' ''world''.'); writeln('Whether a cell is born, lives, or dies depends on the number'); writeln('of living animals immediately adjacent to it. If a cell is'); writeln('empty and has exactly 3 neighbors it will be born i end; var board : array [minbound .. height] of array [minbound .. width] of cell; population : integer; births : integer; deaths : integer; ch : char; edge : edges; dummy : file; (* * initializes the edges of the pattern. this starts representing a pattern * which has no insides; the top is lower than the bottom, the left side is * to the right of the right side. this ensures that the coordinates of the * corner of the pattern after it across].nearby := 0; end; resetedges; end; (* * max ( & min) * returns the larger (smaller) of the two integer arguments *) function max(a, b: integer): integer; begin if a >= b then max := a else max := b end; function min(a, b: integer): integer; begin if a <= b then min := a else min := b end; (* * determine if and how the co-ordinates passed as argument change the bounds * of the pattern (the position of a box thatn the next'); writeln('generation. If it is alive and has either two or three'); writeln('neighbors, it will continue to live. Otherwise it dies of'); writeln('loneliness or overcrowding.'); writeln(' The initial pattern is entered by typing the row and then'); writeln('the column of the desired position. A cell is removed by entering'); writeln('its position again. To finish entering give a position outside'); writeln('of the dimensions of the screen. To s is entered will be correct without needing * to scan the entire array after the pattern is entered (a time consuming * process). *) procedure resetedges; begin edge.top := height - 1; edge.right := minbound + 1; edge.left := width - 1; edge.bottom := minbound + 1; end; procedure instructions; var answer : char; begin writeln('Would you like instructions for LIFE? '); read(trm,answer); writeln; while not (upcase(answer) in ['Y', 'N']) do  could contain living cells), * checking that it does not go off one of the sides of the board. *) procedure limits(x, y: integer); begin with edge do begin left := min(left,x); right := max(right,x); top := min(top,y); bottom := max(bottom,y); end; end; (* * this erases the record of the neighbors of all the cells, in preparation * for the new calculation of the nearby field *) procedure clearnearby; var down, across : integeprogram life; const height = 24; (* number of lines on screen *) width = 80; (* number of columns on screen *) minbound = -1; (* minimum dimension of screen bounds *) clearscreen = 26; (* screen clear character *) type state = (alive, dead); cell = record lookslikeitis : state; nearby : integer; end; edges = record left, right, top, bottom : integer; top a pattern, just hit'); writeln('any key. Type any key to start.'); writeln; read(trm,answer); writeln end; clrscr end; (* * initialize * resets the board to empty (all dead and with no neighbors) *) procedure initialize; var down, across : integer; begin instructions; for down := minbound to height do for across := minbound to width do begin board[down, across].lookslikeitis := dead; board[down,  r; begin for down := edge.top - 1 to edge.bottom + 1 do for across := edge.left - 1 to edge.right + 1 do board[down,across].nearby := 0; end; (* * computes the number of adjacent cells, and thus which cells will survive * through the next generation. To speed this up, the middle cell of the 3 by 3 * matrix which is being examioned is included in the count, even though it is * not really a neighbor of itself. this off-by-one discrepancy is taken into * account in the boa of the pattern, which is destroyed * by the prompt line which asks for the cell positions. *) procedure reprinttopline; var across : integer; begin gotoxy(1,1); for across := minbound + 1 to width - 1 do if board[minbound + 1][across].lookslikeitis = dead then write(' ') else write('*'); end; (* RePrintTopLine *) begin (* GetPositions *) finished := false; population := 0; gotoxy(1,1); write('Position of cell #',population +wn][across] do case lookslikeitis of dead: if nearby = 3 then begin lookslikeitis := alive; gotoxy(across,down); write('*'); limits(across,down); births := births + 1; end; alive: if (nearby = 3) or (nearby = 4) then limits(across,down) countneighbors; update; until (population = 0) or ((births = 0) and (deaths = 0)) or keypressed; gotoxy(1,1); if keypressed then read(trm,ch) else if population = 0 then writeln('This colony has died.') else writeln('The pattern is stable.'); assign(dummy,'gamemenu.chn'); chain(dummy) end. rd update. *) procedure countneighbors; var down, across : integer; deltadown, deltaacross : integer; begin clearnearby; for down := edge.top - 1 to edge.bottom + 1 do for across := edge.left - 1 to edge.right + 1 do if board[down,across].lookslikeitis = alive then for deltadown := -1 to 1 do for deltaacross := -1 to 1 do board[down+deltadown,across+deltaacross].nearby := board[down+deltadown,acros 1:1,' is : '); while not finished do begin readln(down, across); if (down <= minbound) or (down >= height) or (across <= minbound) or (across >= width) then finished := true else with board[down][across] do begin limits(across, down); gotoxy(across, down); if lookslikeitis = alive then begin write(' '); lookslikeitis := d else begin lookslikeitis := dead; gotoxy(across,down); write(' '); deaths := deaths + 1; end; end; population := population + births - deaths; end; (* * get the starting positions of the cells *) procedure getpositions; var down, across : integer; finished : boolean; (* * this is needed to reprint the top lines+deltaacross].nearby + 1; end; (* * update * if a birth or death occurs, the screen is updated. *) procedure update; var down, across : integer; localedge : edges; begin births := 0; deaths := 0; localedge := edge; resetedges; for down := max(minbound+1, localedge.top-1) to min(height-1, localedge.bottom+1) do for across := max(minbound+1, localedge.left-1) to min(width-1,localedge.right+1) do with board[doead; population := population - 1; end else begin write('*'); lookslikeitis := alive; population := population + 1; end; gotoxy(1,1); write('Position of cell #',population + 1:1,' is : '); end; end; reprinttopline; end; (* GetPositions *) (* main program *) begin initialize; getpositions; repeat   (* a procedure to input numbers with verification *) (* Bruce Berryhill 13 Jan 85 *) procedure readint(var innum: integer); var instring : string[20]; temp, error : integer; begin repeat temp := innum; (* save the variable *) readln(instring); (* input a number string *) val(instring,innum,error); (* convert the string into a number *) if error <> 0 then begin (* the string waí°ýå*+«å*-«ÍÍR! ÍòÍb!˜«å*+«)))å)ÑÑå*-«Ñå!ëásÉ*Z¯å!Ñ"Z¯!å!ÍÍR!$Íò*Z¯å!ÍöÍb!˜«å*`¯)))å)ÑÑå*b¯Ñå!ëás!`¯å!åÍ$É!h¯å!+))Ñå!åÍ$!å!ÑÍ5z³Ê®&Õ"«!h¯å*«+))Ñå!h¯å*«å!Ñë·íR+))Ñåͺ$*«#ÑÃv&!d¯å!åÍ$!`¯å!åÍ$!\¯å!åÍ$É!d¯«í°!¾Í8!«ÍÛÍb*«&Í(}2«!d¯"«*«&U·íRÂF'*«^#Vëå!ÑÍ›ËEÊC'*«å*«^#Vëå!Ñë·íRëás#rÃ(N·íR‰'*«^#Vëå!ÑͯËEʆ'*«å*«^#Vëå!Ñëás#rÃ(H·íRÂÁ'*«^#Vëå!ÑÍ›ËEʾ'*«^#Vëå!Ñë·íRë*«s#rÃ(J·íRÂÍRÍ�@by typing U, N, H and J respectively. You cannot move diagonallyÍ�ÍbÍRÍ�+though the snake can. You can quit with Q.Í�ÍbÍRÍ�ÍbÍRÍ�Type any key to continue Íb!»Í8!S«ÍÛÍbÉÍ !å!'ÑÍ5z³Êä"Õ"M«!å!ÑÍ5z³ÊÛ"Õ"K«!˜«å*M«)))å)ÑÑå*K«Ñå!ëás*K«#Ñì"*M«#ÑØ"Íí!’«å!Ñå!Sëás!’«å!Ñå!Iëás!’«å!Ñå!$ëás!’«å!Ñå! ëás!’«å!Ñå!#ëás!}2Y¯!}2X¯!"Z¯!å! ÑÍ5z³Ê…#Õ"M«!˜«å*M«)))å)ÑÑå!Ñå!ëás*M«#ÑÃV#ÍR!ÍòÍbÉýááF«í°ýå*F«åÍQ!å!'ÍkÍå*H«åÍQ!å!ÍkÍÑu.Í�Íb!b«åÍ gamemenu.chnÍ=!b«Í´ÍbÃÅ&ËEÊstÍRÍ�You have escaped with $*Z¯å!ÍöÍ�ÍbÃy+ÍRÍ�The snake has eaten yosn't a number *) writeln('Please enter a number'); (* so prompt for a number *) innum := temp; (* and restore the variable *) end; until error = 0; end; ö'*«^#Vëå!'ÑͯËEÊó'*«^#Vëå!Ñë*«s#rÃ(Q·íRÂ(!}2Y¯!˜«å*«^#Vë)))å)ÑÑå*«^#VëÑn&å!ÑÍNËEÊG(!«d¯í°Ãæ(!«åÍÁ%*d¯å*`¯ÑÍNå*f¯å*b¯ÑÍNÑ}£oËEÊt(Í&Û(*d¯å*\¯ÑÍNå*f¯å*^¯ÑÍNÑ}£oËEÊ›(!}2Y¯*«^#Vëå*«^#VëÍÍR!IÍòÍb!˜«å*«^#Vë)))å)ÑÑå*«^#VëÑå!ëásÉýáá"«ýå*«å!ÑÍNËEÊ)!"«Ã')*«å!ÑÍ›ËEÊ!)!"«Ã')!ÿÿ"«*«É!å*Z¯åÍçå!dÑ͇ËEÊZ)!«å!h¯å!+))Ñåͺ$ÃX*!h¯å!+))Ñ^#Vëå*d¯å!h¯å!+))Ñ^#VëÑë·íRåÍç(Ñ"«!h¯å!+))Ñ^#Vëå*f¯å!h¯å!+))Ñ^#VëÑë·íRåÍç(Ñ"«!}£oËEÊù#!˜«å*F«)))å)ÑÑå*H«Ñn&å!ÑÍN}2J«Ã$!}2J«*J«&Éýáá}2?«á"@«ýå*@«";«!å!'å!Ñë·íRåÍçë*;«s#r*;«å!å!å!Ñë·íRåÍçëás#r*@«åÍ’#ËEÊ$*;«^#Vëå*;«^#VëÍ!’«å*?«&Ñn&ÍRÍòÍb!˜«å*;«^#Vë)))å)ÑÑå*;«^#VëÑå*?«&ëásÉýáá"7«á"9«ýå!ÿÿå!åÍç"1«!ÿÿå!åÍç"/«*1«å!ÑÍaå*/«å!ÑÍaÑ}³oËEÊÆ$*7«^#Vëå*1«Ñë*9«s#r*9«å*7«^#Vëå*/«Ñëás#r*9«åÍ’#å*9«^#Vëå*d¯ÑÍNå*9«^#Vëå*f¯ÑÍNÑ}£oÑ}³oËEÊÆ$*9«^#Vëå*9«^#VëÍ!˜«å*9«^#Vë)))å)ÑÑå*9«^#VëÑå!ëás!’«å!Ñn&ÍRÍòÍbÉýáá+«1!€¯¸ÿÍ�!ô+«ͲÃ0+ýáá"\«á"^«ýå*^«å*\«å*^«Ñë·íRå!ÑÍÑ"`«*`«ÉÍRÍ�Do you want instructions? Íb!»Í8!S«ÍÛÍbÍRÍ�Íb*S«&Í(åÍQ!YÍa!NÍaÍ}îoËEʸ ÍRÍ�Please enter 'Yes' or 'No'.Í�Íb!»Í8!S«ÍÛÍbÍRÍ�ÍbÃQ *S«&Í(å!YÑÍNËEʉ"ÍRÍ�ÍbÍRÍ�LThe object of SNAKE is to get as much money ($) to the door (#) as possible.Í�ÍbÍRÍ�CThe snake tries to prevent you (I). As you get more money, he triesÍ�ÍbÍRÍ�=more and more successfully. You move up, down, left and rightÍ�Íb˜«å*«)))å)ÑÑå*«Ñn&å!ÑÍNå*«å*d¯ÑÍNå*«å*f¯ÑÍNÑ}£oÑ}³oËEÊD**«å*«ÍÍR!SÍòÍb!˜«å*«)))å)ÑÑå*«Ñå!ëásÃX*!«å!h¯å!+))Ñåͺ$!h¯å!+))ÑåÍÁ%*«å*d¯ÑÍNå*«å*f¯ÑÍNÑ}£oËEÊ�*!}2X¯!å!ÑÍEz³Ê+Õ"«!h¯å*«+))Ñå!h¯å*«å!Ñë·íR+))ÑÑí°!h¯å*«+))Ñ^#Vëå*d¯ÑÍNå!h¯å*«+))Ñ^#Vëå*f¯ÑÍNÑ}£oËEÊ+!}2X¯*«+ÑÚ*!h¯å!+))Ñå!«Ñí°ÉÍŠ"ÍW&ÍÐ&*Y¯&}îoËEÊJ+Í+)*Y¯&å*X¯&Ñ}³oËEÊ6+!å!ÍÍRÍ�Íb*Y¯&ËEʬ+ÍRÍ�You have escaped with $*Z¯å!ÍöÍ�ÍbÃÑ+ÍRÍ�The snake has eaten yo  program snake; const playerchar = 'I'; snakechar = 'S'; moneychar = '$'; doorchar = '#'; upcommand = 'U'; downcommand = 'N'; leftcommand = 'H'; rightcommand = 'J'; quitcommand = 'Q'; snakelength = 5; height = 23; width = 39; clearscreen = 26; moneyworth = 25; type coordinate = record x : integer; y : integer; end; snaketype = array[1..snakelength] of coordinate; n if (pos.x in [0..width]) and (pos.y in [0..height]) then freespot := screen[pos.x, pos.y] = emptything else freespot := false; end; (* * assigns the coordinates of a position on the screen that is not being used *) procedure makespace(var newpos : coordinate; forwhat : thing); begin with newpos do begin repeat x := rand(0, width - 1); y := rand(0, height - 1); until freespot(newpos); gotoxy(x, y); wri writeln('more and more successfully. You move up, down, left and right'); writeln('by typing U, N, H and J respectively. You cannot move diagonally'); writeln('though the snake can. You can quit with Q.'); writeln; write('Type any key to continue '); read(trm,answer) end; end; (* * sets up all the variables *) procedure initialize; var x, y : integer; begin instructions; for x := 0 to width do for y := 0 to height do $',score); screen[money.x, money.y] := emptything; makespace(money, moneything); end; (* * position all of the items in the game making sure that none of them * overlap. *) procedure placeobjects; var snakebody : integer; begin makespace(snake[1], snakething); for snakebody := 2 to snakelength do placenearby(snake[snakebody], snake[snakebody - 1]); makespace(player, playerthing); makespace(money, moneything); makespace(door, doorthing); end; (*  thing = (playerthing, snakething, moneything, doorthing, emptything, scorething); var snake : snaketype; player, money, door : coordinate; score : integer; left, eaten : boolean; screen : array[0..width] of array[0..height] of thing; lookslike : array[thing] of char; dummy : file; (* * returns a random integer between min and max *) function rand(min, max: integer) : integer; begin rand := min + random(max-min+1); end; procedure instructions; varte(lookslike[forwhat]); screen[x, y] := forwhat; end; end; (* * placenearby finds a free coordinate adjacent to the argument coordinate * and places the thing there. *) procedure placenearby(var near, coord : coordinate); var deltax, deltay : integer; begin repeat repeat deltax := rand(-1, 1); deltay := rand(-1, 1); until (deltax <> 0) or (deltay <> 0); near.x := coord.x + deltax; near.y := coord.y + deltay; unti screen[x][y] := emptything; randomize; lookslike[snakething] := snakechar; lookslike[playerthing] := playerchar; lookslike[moneything] := moneychar; lookslike[emptything] := ' '; lookslike[doorthing] := doorchar; left := false; eaten := false; score := 0; for x := 0 to 10 do screen[x, 0] := scorething; write(chr(clearscreen)); end; (* * returns true if the position is valid and empty *) function freespot(pos : coordinate) : boolean; begi * read the player's move from the keyboard, not input so that the letter * will not be echoed and mess up the display. *) procedure playermove; var command : char; oldpos : coordinate; begin oldpos := player; read(kbd, command); command := upcase(command); with player do begin case command of upcommand : if y > 0 then y := y - 1; downcommand : if y < height then y := y + 1; leftcommand : if x > 0 then x := x - 1; ri answer : char; begin write('Do you want instructions? '); read(trm,answer); writeln; while not (upcase(answer) in ['Y','N']) do begin writeln('Please enter ''Yes'' or ''No''.'); read(trm,answer); writeln end; if upcase(answer) = 'Y' then begin writeln; writeln('The object of SNAKE is to get as much money ($) to the door (#) as possible.'); writeln('The snake tries to prevent you (I). As you get more money, he tries');l (freespot(near) or ((near.x = player.x) and (near.y = player.y))); gotoxy(near.x,near.y); screen[near.x, near.y] := snakething; write(lookslike[snakething]); end; (* * removes whatever is at the coordinates from the terminal screen * and the array screen. *) procedure remove(pos : coordinate); begin gotoxy(pos.x, pos.y); write(' '); screen[pos.x, pos.y] := emptything; end; procedure takegold; begin score := score + moneyworth; gotoxy(0,0); write('  ghtcommand : if x < width then x := x + 1; quitcommand : left := true ; end; if screen[x, y] = scorething then player := oldpos else begin remove(oldpos); if (player.x = money.x) and (player.y = money.y) then takegold else if (player.x = door.x) and (player.y = door.y) then left := true; gotoxy(x, y); write(playerchar); screen[x, y] := playerthing; end; en]); if (newpos.x = player.x) and (newpos.y = player.y) then eaten := true; for bodypart := snakelength downto 2 do begin snake[bodypart] := snake[bodypart - 1]; if (snake[bodypart].x = player.x) and (snake[bodypart].y = player.y) then eaten := true; end; snake[1] := newpos; end; begin (* main *) initialize; placeobjects; repeat playermove; if not left then snakemove; until left or eaten; gotoxy(0, heome 's and vice versa.Í�ÍbÍRÍ�?In addition, changing a corner position also changes the centerÍ�ÍbÍRÍ�@position; changing the center position also changes the outsideÍ�ÍbÍRÍ�middle positions.Í�ÍbÍRÍ�ÍbÍRÍ�BYou will be asked if you want to change the default initial board.Í�ÍbÍRÍ�4Answer "N" to get the same board each time you play.Í�ÍbÍRÍ�ÍbÍRÍ�Type 0 to quit. Have fun!Í�ÍbÍ0 ÉÍcÍR! e.å!ÍqÍ�*** SHOOTING STARS ***Í�Íb!åÍ›!ÍRÍ�Do you want instructions? (Y/d; end; (* * used by snakemove to figure out which way is the direction * toward the player *) function sign(x : integer) : integer; begin if x = 0 then sign := 0 else if x > 0 then sign := 1 else sign := -1; end; (* * snake moves randomly at first, then it goes more directly toward * the player *) procedure snakemove; var newpos : coordinate; bodypart : integer; begin if rand(0, score) <= 100 then placenearby(newpos, sna1!€¯¸ÿÍ�!ž.O®ͲÃý-ýáá"¯ýå!¾Í8*¯ÍÛÍbÉýáá"Å®á"Ç®P!ɮͲýå*Ç®å*Å®Í!É®Í ÍR!ÍqÍbÉÍPRESS SPACE BAR TO CONTINUE!å!åÍÿ!¼®åÍç*¼®&å! ÑÍNËEÊZ Í !å!åÍÿÉýáá"¶®á"¸®á"º®ýå*¸®å*¶®ÍÍRÍ� Íb*¸®å*¶®Í!±®åÍç*±®&åÍQ!YÍa!yÍa!NÍa!nÍaÍËEÊÏ *±®&å!YÑÍNå*±®&å!yÑÍNÑ}³oËEÊ;!ÍRÍ�YESÍb!ë*º®sÃP!ÍRÍ�NO Íb!ë*º®sÉÍR!ÍòÍbÉýáá"©®á"«®ýå*«®å*«®å*©®ÑÑÍ5z³Êš!Õ"£®!å*£®Íͽ*£®#ÑÃ{!Éýáá"¡®ýå!å*¡®ÑÍ5z³ÊÉ!Õ"›®ÍRÍ�Íb*›®#Ñî!ight); writeln; if left then writeln('You have escaped with $',score) else writeln('The snake has eaten you.'); assign(dummy,'gamemenu.chn'); chain(dummy) end. N)Íb!�®å!!å!åÍž *�®&ËEÊê%ÍÊ!É!Â*"z¯!/E"x¯ÍcÍRÍ�6Do you want to change the default initial board? (Y/N)Íb!‹®å!8å!åÍž *‹®&ËEÊe&!ÿÍ"z¯!ÿÍ"x¯É*z¯å!ÑÍÞ"ƒ®*x¯å!ÑÍÞ"�®*ƒ®å*�®Ñå!ÿ?ÑÍtËEʰ&*ƒ®å*�®Ñå!ÿ?Ñë·íR"®Ã¼&*ƒ®å*�®Ñ"®*x¯"z¯*®å!ÑÍÄ"x¯*x¯"‰®*‰®ÉÍc!"R¯!f¯å!+)Ñå!éÿëás#r!T¯å!+)Ñå!îëás#r!f¯å!+)Ñå!ýÿëás#r!T¯å!+)Ñå!ëás#r!f¯å!+)Ñå!íÿëás#r!T¯å!+)Ñå!:ëás#r!f¯å!+)Ñå!õÿëás#r!T¯å!+)Ñå!Ù ëás#r!f¯å!+)Ñå!ëás#r!T¯å!+)Ñå! ëás#r!f¯å!+)Ñå!ûÿëás#r!T¯å!+)Ñke[1]) else begin newpos.x := snake[1].x + sign(player.x - snake[1].x); newpos.y := snake[1].y + sign(player.y - snake[1].y); if (screen[newpos.x, newpos.y] = emptything) or ((newpos.x = player.x) and (newpos.y = player.y)) then begin gotoxy(newpos.x, newpos.y); write(snakechar); screen[newpos.x, newpos.y] := snakething; end else placenearby(newpos, snake[1]); end; remove(snake[snakelengthÉÍcÍRÍ�6If you like brain teasers then you're in for some fun.Í�ÍbÍRÍ�>The object of this puzzle is to solve a 3 X 3 matrix such thatÍ�ÍbÍRÍ�@*s appear in all positions except in the center which will be '.Í�ÍbÍRÍ�=The positions on the matrix board are referred to as follows:Í�ÍbÍRÍ� 7 8 9Í�ÍbÍRÍ� 4 5 6Í�ÍbÍRÍ�4 1 2 3 -- just like your numeric keypad.Í�ÍbÍRÍ�;When a * is made a ', its immediate neighbors change state,Í�ÍbÍRÍ�%that is: *s bec  å!Oëás#r!f¯å!+)Ñå!óÿëás#r!T¯å!+)Ñå!Òëás#r!f¯å!+)Ñå!ùÿëás#r!T¯å!+)Ñå! ëás#r!f¯å! +)Ñå!ïÿëás#r!T¯å! +)Ñå!¦ëás#rÍ7 8 9!å!åÍÿÍ4 5 6!å!åÍÿÍ1 2 3!å!åÍÿÍ0 - Quit!å!åÍÿÉ!å! ÑÍ5z³Ê+)Õ"u®Íf&å!dÑÍÞ"s®*s®å!ÈÑÍ›ËEÊ")!f¯å*u®+)Ñå!f¯å*u®+)Ñ^#Vë}/o|/g#ëás#r*u®#ÑÃÔ(É!å!ÍÍR! e.å!ÍqÍb!å! ÑÍ5z³ÊÄ)Õ"m®!f¯å*m®+)Ñ^#Vëå!ÑͯËEÊŒ)ÍRÍ� ' Íb!f¯å*m®+)Ñ^#Vëå!ÑÍ›ËEÊ»)ÍRÍ� * Íb*m®#ÑÃT)!åÍTURBO Pascal -- Wm Meacham, 6/2/84 ** Further "User friendly" enhancements -- WPM, 6/5/84 *} TYPE VECTOR = ARRAY[1..9] OF INTEGER ; STR80 = STRING[80] ; VAR SEED1, SEED2 : INTEGER ; STARS, F5 : VECTOR ; C : INTEGER ; DONE,REPLY : BOOLEAN ; dummy : file; { -------------------- Screen handling routines -------------------- } PROCEDURE KEYIN(VAR CIX : CHAR) ; BEGIN READ (KBD,CIX) ou fired*R¯å!ÍöÍ� shotsÍ�Íb!}2d®*d®&ËEÊ"-É!}2Q¯Íi%Íë%ÍÚ&ÍÉ(Í,)Íö*! å! åÍ^!ÍWould you like to play again?!å! åÍÿ!P¯å!å! åÍž *P¯&}îoËEÊq.!}2Q¯*Q¯&ËEÊ.! ¯åÍ gamemenu.chnÍ=! ¯Í´ÍbÃÅÍ^!ÍWould you like to play again?!å! N', 'n']) ; IF (CH = 'Y') OR (CH = 'y') THEN BEGIN WRITE ('YES') ; BOOL := TRUE END ELSE BEGIN WRITE ('NO ') ; BOOL := FALSE END END ; { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } PROCEDURE BEEP ; BEGIN WRITE (CHR(7)) END ; { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } { PROCEDURE CLRSCR ; Clear screen & home cur›!ÍR! e.å!ÍqÍb!å!ÑÍ5z³ÊY*Õ"m®!f¯å*m®+)Ñ^#Vëå!ÑͯËEÊ!*ÍRÍ� ' Íb!f¯å*m®+)Ñ^#Vëå!ÑÍ›ËEÊP*ÍRÍ� * Íb*m®#ÑÃé)!åÍ›!ÍR! e.å!ÍqÍb!å!ÑÍ5z³Êî*Õ"m®!f¯å*m®+)Ñ^#Vëå!ÑͯËEʶ*ÍRÍ� ' Íb!f¯å*m®+)Ñ^#Vëå!ÑÍ›ËEÊå*ÍRÍ� * Íb*m®#ÑÃ~*!åÍ›!ÉÃ-!"[®!å! ÑÍ5z³Ê™+Õ"Y®!T¯å*e®+)Ñ^#Vëå!f¯å*Y®+)Ñ^#VëÑÍÞå!f¯å*Y®+)Ñ^#VëÑÍÄ"W®*W®å!T¯å*e®+)Ñ^#VëÑÍNËEÊ�+!f¯å*Y®+)Ñå!f¯å*Y®+)Ñ^#Vë}/o|/g#ëás#r*Y®#Ñà +!å! ÑÍ5z³ÊÎ+Õ"Y®*[®å!f¯å*Y®+)Ñ^#VëÑ"[®*Y®# { For TURBO Pascal -- WPM, 6/2/84} END ; { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } PROCEDURE WRITE_STR (ST:STR80 ; COL,ROW:INTEGER) ; BEGIN GOTOXY (COL,ROW) ; WRITE (ST) END ; { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } PROCEDURE PAUSE ; {Prints message on line 24, waits for user response} VAR CH : CHAR ; BEGIN WRITE_STR ('PRESS SPACE BAR TO CONTINUE',21,24) ; REPEAT KEYIN (CH) PROGRAM STARS ; {* ** PROGRAM TITLE: SHOOTING STARS ** ** WRITTEN BY: MARK J. BORGERSON ** DATE WRITTEN: July, 1976 ** ** WRITTEN FOR: PERSONAL ENJOYMENT ** ** TRANSLATED: Translated from BASIC ** by Ray Penley, SEPT 1979 ** 16 April 80 - added KEYIN. ** ** HISTORY: Originally from Pascal/Z Users' Group ** CP/M Users' Group volume 71 ** Modified for sor -- Built-in TURBO procedure } { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } PROCEDURE CLRlns(start,no_lines : integer); var i : integer; begin for i := start to start + no_lines do begin gotoxy(1,i); clreol; end end; { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } PROCEDURE SKIP(LINES:INTEGER) ; VAR I : INTEGER ; BEGIN FOR I := 1 TO LINES DO WRITELN END {---of SKIP---} ; { --------------Ñä+*[®"a®*a®É!}2Q®Í Your Shot !å! åÍÿ!R®åÍç*R®&å!0ÑÍNËEÊ,!}2c®Ãü,*R®&å!0Ñë·íR"e®ÍRÍ�Íb*R¯å!Ñ"R¯*e®å!Ñͯå*e®å! ÑÍ›Ñ}³oËEÊk,!}2Q®Ãü,!f¯å*e®+)Ñ^#Vëå!Ñ͇ËEÊü,ÍQ!ÍYou can only Shoot Stars!å! åÍÿ!å!€>ÑÍ5z³ÊÎ,Õ"O®*O®#Ñü,Í !å! åÍÿ!}2Q®*Q®&}îoËEÊØ+ÍRÍ�ÍbÉ!}2d®!}2c®ÍØ+*c®&ËEÊ_-ÍRÍ�GAME TERMINATED Í�Íb!}2d®Ãò-Íù*"g®Í,)*g®å!œÿÑÍNËEÊš-ÍRÍ� You lost!!!Í�Íb!}2d®Ãò-*g®å!`ÑÍNËEÊò-ÍRÍ� You WIN!!!Í�ÍbÍRÍ� Y UNTIL CH = CHR($20) ; WRITE_STR (' ',21,24) END ; { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } PROCEDURE READ_BOOL (VAR BOOL:BOOLEAN; COL,ROW:INTEGER) ; { Inputs "Y" OR "N" to boolean at row and column specified, prints "YES" or "NO"} VAR CH:CHAR ; BEGIN GOTOXY (COL, ROW) ; WRITE (' ') ; GOTOXY (COL, ROW) ; REPEAT KEYIN (CH) UNTIL (CH IN ['Y', 'y', '  ------ Routines for the game as such -------------------- } PROCEDURE INSTRUCTIONS ; VAR I : INTEGER ; BEGIN CLRSCR ; WRITELN('If you like brain teasers then you''re in for some fun.') ; WRITELN('The object of this puzzle is to solve a 3 X 3 matrix such that') ; WRITELN('*s appear in all positions except in the center which will be ''.') ; WRITELN('The positions on the matrix board are referred to as follows:') ; WRITELN(' 7  SEED2 := RANDOM (MAXINT) END END {--- of SEEDRAND ---} ; { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } FUNCTION RANDM : INTEGER ; { RANDM will return numbers from 0 to 32767. Call RANDM using the following convention: Range Use 0 - 32 RANDM DIV 1000 0 - 327 RANDM DIV 100 0 - 32767 RANDM GLOBAL SEED1, SEED2 : INTEGER } CONST HALFINT = 16383 ; { 1/2 want instructions? (Y/N)') ; READ_BOOL (ANS, 33, 4) ; IF ANS THEN INSTRUCTIONS END {---of HEADING---} ; (*============================================================* Procedures SEEDRAND and RANDM implement a Fibonacci series Random number generator. Written for PASCAL/Z By Raymond E. Penley, September 1979. Add these lines to your program -- VAR SEED1, SEED2 : INTEGER ; Within the body of the main program but BEFORE calling RANDM -- = (-17) ; F5[9] := 1190 ; WRITE_STR ('7 8 9', 21, 14) ; WRITE_STR ('4 5 6', 21, 17) ; WRITE_STR ('1 2 3', 21, 20) ; WRITE_STR ('0 - Quit', 21, 22) END {---of INITIALIZE---} ; { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } PROCEDURE LOAD ; VAR I, X7 : INTEGER ; BEGIN FOR I := 1 TO 9 DO BEGIN X7 := ( RANDM DIV 100 ) ; IF X7 > 200 THE8 9') ; WRITELN(' 4 5 6') ; WRITELN(' 1 2 3 -- just like your numeric keypad.') ; WRITELN('When a * is made a '', its immediate neighbors change state,') ; WRITELN('that is: *s become ''s and vice versa.') ; WRITELN('In addition, changing a corner position also changes the center') ; WRITELN('position; changing the center position also changes the outside') ; WRITELN('middle positions.') ; WRITELN ; WRIT OF MAXINT } VAR HALF1, HALF2, HALFADD : INTEGER ; BEGIN HALF1 := SEED1 DIV 2 ; HALF2 := SEED2 DIV 2 ; IF (HALF1+HALF2) >= HALFINT THEN HALFADD := HALF1 + HALF2 - HALFINT ELSE HALFADD := HALF1 + HALF2 ; SEED1 := SEED2 ; SEED2 := HALFADD * 2 ; { Restore from previous DIVision } RANDM := SEED2 END {---of RANDM---} ; (*============================================================*) PR SEEDRAND ; *============================================================*) PROCEDURE SEEDRAND ; { Initial values for SEED1 and SEED2 may be input here } VAR ANS : BOOLEAN ; BEGIN SEED1 := 10946 ; SEED2 := 17711 ; CLRSCR ; WRITE ('Do you want to change the default initial board? (Y/N)') ; READ_BOOL (ANS, 56, 1) ; IF ANS THEN BEGIN SEED1 := RANDOM (MAXINT) ; {Built-in TURBO function} N STARS[I] := (-STARS[I]) END END {---of LOAD---} ; { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } PROCEDURE BOARD ; VAR J : INTEGER ; BEGIN GOTOXY (1,1) ; WRITE(' ':20) ; FOR J := 7 TO 9 DO BEGIN IF STARS[ J ] < 0 THEN WRITE( ''' ') ; IF STARS[ J ] > 0 THEN WRITE( '* ') END ; SKIP(3) ; WRITE(' ':20) ; FOR J := 4 TO 6 DO ELN('You will be asked if you want to change the default initial board.') ; WRITELN('Answer "N" to get the same board each time you play.') ; WRITELN ; WRITELN('Type 0 to quit. Have fun!') ; PAUSE ; END {---of INSTRUCTIONS---} ; { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } PROCEDURE HEADING ; VAR ANS : BOOLEAN ; BEGIN CLRSCR ; WRITELN(' ':20, '*** SHOOTING STARS ***') ; SKIP(2) ; WRITE ('Do youOCEDURE INITIALIZE ; BEGIN CLRSCR ; C := 0 ; { SHOT COUNTER } STARS[1] := (-23) ; F5[1] := 1518 ; STARS[2] := (-3) ; F5[2] := 1311 ; STARS[3] := (-19) ; F5[3] := 570 ; STARS[4] := (-11) ; F5[4] := 3289 ; STARS[5] := 2 ; F5[5] := 2310 ; STARS[6] := (-5) ; F5[6] := 1615 ; STARS[7] := (-13) ; F5[7] := 2002 ; STARS[8] := (-7) ; F5[8] := 1547 ; STARS[9] :   BEGIN IF STARS[ J ] < 0 THEN WRITE( ''' ') ; IF STARS[ J ] > 0 THEN WRITE( '* ') END ; SKIP(3) ; WRITE(' ':20) ; FOR J := 1 TO 3 DO BEGIN IF STARS[ J ] < 0 THEN WRITE( ''' ') ; IF STARS[ J ] > 0 THEN WRITE( '* ') END ; SKIP(4) END {---of BOARD---} ; { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } PROCEDURE PLAYTHEGAME  WRITE_STR(' ',1,12) ; ERROR := TRUE END END UNTIL NOT ERROR ; WRITELN END {---of INPUT---} ; { -------------------- } BEGIN { PLAYTHEGAME } ENDOFGAME := FALSE ; QUIT := FALSE ; REPEAT INPUT ; IF QUIT THEN BEGIN WRITELN ('GAME T C, X : INTEGER ; STARS : VECTOR ; } VAR CIX : CHAR ; ERROR : BOOLEAN ; I : INTEGER ; BEGIN REPEAT ERROR := FALSE ; WRITE_STR('Your Shot ',1,11) ; KEYIN(CIX) ; IF CIX='0' THEN QUIT := TRUE ELSE BEGIN X := ( ORD(CIX) - ORD('0') ); LOAD ; BOARD ; PLAYTHEGAME ; CLRlns(13,12); WRITE_STR ('Would you like to play again?', 1, 13) ; READ_BOOL (REPLY, 31, 13) ; IF NOT REPLY THEN DONE := TRUE UNTIL DONE; assign(dummy,'gamemenu.chn'); chain(dummy) END {---of STARS---}. ; VAR D, X : INTEGER ; ENDOFGAME, QUIT : BOOLEAN ; { -------------------- } FUNCTION CHECK : INTEGER ; { Check to if the F value for the shot can be evenly divided by the stars value for each position. If the stars value divides into F without a remainder, the STAR or black hole is inverted (its sign is changed). GLOBAL X : INTEGER ; STARS, F5 : VECTOR ; } VAR ERMINATED ') ; ENDOFGAME := TRUE END ELSE BEGIN D := CHECK ; BOARD ; IF D = (-100) THEN BEGIN WRITELN('You lost!!!') ; ENDOFGAME := TRUE END ELSE IF D=96 THEN BEGIN  ; WRITELN ; C := C + 1 ; IF (X<1) OR (X>9) THEN ERROR := TRUE ELSE IF STARS[ X ] <= 0 THEN BEGIN BEEP ; WRITE_STR('You can only Shoot Stars',1,12) ; FOR I := 0 TO 16000 DO ; {DO NOTHING}  B1, K, Z5 : INTEGER ; BEGIN B1 := 0 ; FOR K := 1 TO 9 DO BEGIN Z5 := ( F5[ X ] DIV STARS[ K ] ) * STARS[ K ] ; IF Z5 = F5[ X ] THEN STARS[ K ] := (-STARS[ K ]) END ; FOR K := 1 TO 9 DO B1 := B1 +STARS[ K ] ; CHECK := B1 END {---of CHECK---} ; { -------------------- } PROCEDURE INPUT ; { GLOBAL  WRITELN('You WIN!!!') ; WRITELN('You fired', C:3, ' shots') ; ENDOFGAME := TRUE END END UNTIL ENDOFGAME END {---of PLAYTHEGAME---} ; { -------------------- The main program -------------------- } BEGIN { STARS } DONE := FALSE ; heading; REPEAT SEEDRAND ; { Seed the Random Number Generator } INITIALIZE   1!€¯¸ÿÍ�!s%è®ͲÃ|#!0å!1ÑÍ5z³ÊE Õ}2 ¯!å!ÑÍ5z³Ê: Õ" ¯!^¯å* ¯&Ðÿå)ÑÑå* ¯+Ñå! ëás* ¯#Ñà * ¯&#ÑÃò!A}2 ¯!2å!9ÑÍ5z³ÊÒ Õ}2 ¯!å!ÑÍ5z³ÊÇ Õ" ¯* ¯&å!QÑÍNËEÊ‘ * ¯&#}2 ¯!^¯å* ¯&Ðÿå)ÑÑå* ¯+Ñå* ¯&ëás* ¯&#}2 ¯* ¯#ÑÃl * ¯&#ÑÃW Éýáá"¯ýå!"þ®!}2¯*¯å!ÑÍ›ËEÊ]!!å*¯ÑÍ5z³Ê]!Õ"¯!C¯å*¯+Ñn&å!Z¯Í-ÍËEÊ4!*¯"þ®ÃT!*¯å*þ®Ñë·íRå!ÑÍ›ËEÊT!!}2¯*¯#ÑÃ!*¯&É !õ®ÍØýáá"ü®ýåÍ ËEÊ«!!»Í8!õ®ÍÛÍb!¯åÍ gamemenu.chnÍ=!¯Í´Íb*ü®å*A¯ÑÍ›ËEÊú!!å*A¯ÑÍ5z³Ê= array[1..lettersperdigit] of char; var dial : array['0'..'9'] of digitslet; vowels : set of 'A'..'Z'; phonenum : string[12]; word : array [1..maxnumlength] of char; numlength : integer; dummy : file; (* * initializes the array dial to contain the same (digit, 3 letters) * groups that are on telephones. 0 and 1 do not have any, and are set * to blank. the rest of the numbers are mapped to succeeding triples * of letters ( 2 -> A,B,C). the exception to ththen enoughvowels := false; end; end; (* * this is a recursive procedure which prints all possible combinations * of letters for the digits in the given phone number. given a position in * the number at which to continue looking, it loops through all the * possible values of the current position's letter (determined by the * corresponding letters for that digit on a telephone dial). for each * letter, it calls itself recursively on the next position in the number * (î!Õ"ö®!C¯å*ö®+Ñn&ÍRÍòÍb*ö®#ÑÃÆ!ÍRÍ�ÍbÃb"!å!ÑÍ5z³Êb"Õ"ö®!C¯å*ü®+Ñå!^¯å!M¯å*ü®Ñn&Ðÿå)ÑÑå*ö®+Ñn&ëás*ü®åÍÓ ËEÊY"*ü®å!ÑåÍc!*ö®#ÑÃ" õ®Ãò!ï®ÍØýáá}2ó®ýå*ó®&å!0ÑÍtå*ó®&å!9Ñ͇Ñ}£o}2ô®*ô®&Ùï®Ãò!è®ÍØ!}2î®!-e.å!M¯Í Í|å!ÑÍaËEÊú"!M¯å!-e.å!M¯Í Í|å!ͽÿ"!M¯Í Ím"A¯*A¯å!Ñ͇å*A¯å! ÑÍ›Ñ}³oËEÊ0#!}2î®Ãm#!å*A¯ÑÍ5z³Êm#Õ"è®!M¯å*è®Ñn&åÍk"}îoËEÊd#!}2î®*è®#ÑÃ;#*î®&Ùè®ÃòÍçÍQ!AÍa!EÍa!IÍa!OÍa!UÍa!YÍa!Z¯ÍâÍRÍ�=This program finds is is that the letter * Q is ignored, making the triple for 7 to be P,R,S. *) procedure setupdial; var i : integer; digit : char; letter : char; begin for digit := '0' to '1' do for i := 1 to lettersperdigit do dial[digit][i] := ' '; letter := 'A'; for digit := '2' to '9' do for i := 1 to lettersperdigit do begin if letter = 'Q' then letter := succ(letter); dial[digit][i] := letter; letteprogram telephone; const lettersperdigit = 3; (* each number can have 3 letters *) maxnumlength = 10; (* allows long distance numbers *) maxconsonants = 3; (* maximum number of consonants *) (* that are allowed in a word, if *) (* there are more than this many *) (* the rest of the combinations *) (* with this root are skipped *) type digitslet to figure out the next letter). the end of the number is reached * when the position would extend past the end of the string; then the current * permutation is printed and it returns to get the next combination. *) {$A-} (* allow recursive code *) procedure permutate(position:integer); var i : integer; ch : char; begin if keypressed then begin read(trm,ch); assign(dummy,'gamemenu.chn'); chain(dummy) end; if position > numlength then words that match the digits in a telephoneÍ�ÍbÍRÍ�number. Words with more than !å!ÍöÍ� consonants are automaticallyÍ�ÍbÍRÍ� maxconsonants then for posinword := 1 to sofar do begin if word[posinword] in vowels then lastvowel := posinword else if posinword - lastvowel > maxconsonants    begin for i := 1 to numlength do write(word[i]); writeln end else for i := 1 to lettersperdigit do begin word[position] := dial[phonenum[position]][i]; if enoughvowels(position) then permutate(position + 1); end; end; (* * returns true if ch is a numerical character *) function isdigit (ch : char) : boolean; begin isdigit := (ch >= '0') and (ch <= '9'); end; (* * determines if the string typed in might writeln('have been listed.'); writeln; repeat write('What is your number? '); readln(phonenum); until arealphonenumber; permutate(1); assign(dummy,'gamemenu.chn'); chain(dummy) end. shuffle * shuffle the screen index *) procedure shuffle; var i : index; tmp : pos; rnd : index; begin for i := 1 to scrsize do begin rnd := random(scrsize) + 1; tmp := screen[rnd]; screen[rnd] := screen[i]; screen[i] := tmp end end; (* shuffle *) (* * fill * fill up the screen with a character *) procedure fill(ch:char); var i : index; begin for i := 1 to scrsize do begin gotoxy(screen[i].xloc,screen[i].y be a syntactically correct * telephone number. it must contain digits; it may optionally have * dashes (which are removed). *) function arealphonenumber : boolean; var digitpos : integer; begin arealphonenumber := true; while pos('-',phonenum) <> 0 do delete(phonenum,pos('-',phonenum),1); numlength := length(phonenum); if (numlength <= 0) or (numlength > maxnumlength) then arealphonenumber := false else for digitpos := 1 to numlength do if not isd(* * twinkle * randomly fill the screen with * '*' and then randomly remove them *) program twinkle(output); const scrsize = 1920; (* number of points on the screen *) xmax = 79; (* maximum x location (0 -> 79) *) ymax = 23; (* maximum y location *) type pos = record xloc : 0..xmax; yloc : 0..ymax end; index = 1..scrsize; var screen : array[index] of pos; dummy : file; (* * init * do a primitive c1!€¯¸ÿÍ�!—!3 ͲÃ]!!å!ÑÍ5z³Ê Õ}2D ÍRÍ�Íb*D &#ÑÃòÍí!"F !å!OÑÍ5z³Ê‘ Õ}2E !å!ÑÍ5z³Ê† Õ}2D !| å*F +)Ñå*E &ëás!| å*F +)Ñå*D &ëás*F å!Ñ"F *D &#ÑÃ9 *E &#ÑÃ$ É!å!€ÑÍ5z³Ê!Õ"> !€Íå!Ñ": !| å*: +)Ñ< í°!| å*: +)Ñå!| å*> +)ÑÑí°!| å*> +)Ñå!< Ñí°*> #ÑÃ� Éýáá}29 ýå!å!€ÑÍ5z³Ê\!Õ"3 !| å*3 +)Ñn&å!| å*3 +)Ñn&Í*9 &ÍRÍòÍb*3 #ÑÃ!ÉÍçÍ’ !*åÍ!Í’ ! åÍ!!L åÍ gamemenu.chnÍ=!L Í´ÍbÃÅz³ÊÕ"3 !| å*3 +)Ñn&å!| å*3 +)Ñn&Í*9 &loc); write(ch) end; end; (* fill *) (* main *) begin init; shuffle; fill ('*'); shuffle; fill (' '); assign(dummy,'gamemenu.chn'); chain(dummy) end. (* twinkle *) igit(phonenum[digitpos]) then begin arealphonenumber := false; end; end; begin setupdial; vowels := ['A','E','I','O','U','Y']; writeln('This program finds words that match the digits in a telephone'); writeln('number. Words with more than ',maxconsonants:1,' consonants are automatically'); writeln('rejected. Numbers may have embedded dashes and may be up to ',maxnumlength:1); writeln('digits long. Hit any key to exit before all the combinations'); lear screen, * then init the screen array *) procedure init; var scrindex : integer; (* index into screen array *) x : 0..xmax; y : 0..ymax; begin (* do a simple clear screen *) for y := 0 to ymax do writeln; randomize; scrindex := 1; for x := 0 to xmax do for y := 0 to ymax do begin screen[scrindex].xloc := x; screen[scrindex].yloc := y; scrindex := scrindex + 1 end end; (* init *) (* *   1!€¯¸ÿÍ�!K.}®ͲÃó-ýáá"Ý®á"ß®ýå*ß®å*Ý®å*ß®Ñë·íRå!ÑÍÑ"á®*á®ÉÍRÍ�ÍbÍRÍ�@Your mission, should you desire to accept it, is it hunt for theÍ�ÍbÍRÍ�BWumpus in his cave. To succeed, you must shoot it with one of yourÍ�ÍbÍR!å!ÍöÍ�D arrows. If you shoot into a room which is not directly connected toÍ�ÍbÍRÍ�Cyours, the arrow will bounce to one of the rooms that does connect.Í�ÍbÍRÍ�AThe bats in the cave may pick you up and place you in a differentÍ�ÍbÍRÍ�Aroom. If you enÑÍ-Íä(}2—®*—®&}2–®Í¨$Ã,)*<¯å!Ñë·íR"<¯*:¯&ËEÊ2*ÍRÍ�"You klutz! You just shot yourself.Í�Íbí**9¯&ËEÊz*ÍRÍ�.Congratulations! You slew the fearsome Wumpus.Í�Íbí**<¯å!ÑÍNËEÊ­*ÍRÍ�You ran out of arrows.Í�ÍbÉÍRÍ�To Íb!‘®Í+ÍíÍ_Íb*‘®&åÍQ!å!ÍkÍ}îoËEÊ+ÍRÍ�There is no room # *‘®&å!ÍöÍ�ÍbÃ+*‘®&å!@¯å*?¯&+å)ÑÑÍ-Í}îoËEÊv+ÍRÍ�I see no tunnel to room # *‘®&å!ÍöÍ�ÍbÃ+*‘®&}2?¯Í¯'Í 'ÍT(ÉÍRÍ�ÍbÍRÍ� Do you really want to quit now? Íb!»Í8!Œ®ÍÛÍ smell a Wumpus.Í�Íb!@¯å*?¯&+å)ÑÑÍ-!6¯Í-ÍÍQͪËEÊ%&ÍRÍ� I hear bats.Í�Íb!@¯å*?¯&+å)ÑÑÍ-!3¯Í-ÍÍQͪËEÊn&ÍRÍ�I feel a draft.Í�ÍbÉÍ©$ÍRÍ�> Íb!»Í8!´®ÍÛÍbÍRÍ�Íb*´®&Í(}2´®*´®&å!¯ Í-Í}îoËEÊã&ÍRÍ� Type ? for instructions.Í�Íb*´®&å!¯ Í-ÍËEÊr&*´®&}2¹®*¹®&É!å!åÍç}2¯®*¯®&å!@¯å*>¯&+å)ÑÑÍ-ÍËEÊE'*¯®&}2>¯*>¯&å*?¯&ÑÍNËEÊ®'ÍRÍ�Look Out!! The Wumpus got you.Í�ÍbÍRÍ�Better luck next time.Í�Íb!}2:¯É*?¯&å!6¯Í-ÍËEÊS(!program wumpus; const maxrooms = 20; maxbats = 2; maxpits = 2; numberofarrows = 7; prompt = '> '; tunnelsperroom = 2; move = 'M'; quit = 'Q'; shoot = 'S'; help = '?'; type room = 1..maxrooms; rooms = set of room; var cave : array[room] of rooms; player : room; wumpus : room; arrowsleft : integer; ter a room which has a pit, you will fall into it.Í�ÍbÍRÍ�;If the wumpus finds you or you run out of arrows, you lose.Í�ÍbÍRÍ�8 At the prompt type m,s or q for move, shoot or quit.Í�ÍbÍRÍ�ÍbÉÍRÍ�Do you want instructions? Íb!»Í8!ЮÍÛÍbÍRÍ�Íb*Ю&Í(åÍQ!YÍa!NÍaÍ}îoËEÊ^#ÍRÍ�Please answer yes or noÍ�ÍbÍRÍ�Would you like instructions? Íb!»Í8!ЮÍÛÍbÍRÍ�ÍbÃÔ"*Ю&Í(å!YÑÍNËEÊv#Í Éýáá}2ήá}2Ï®ýå!@¯å*Ï®&+å)ÑÑå!@¯å*Ï®&+å)ÑÑÍ-ÍQ*ή&ÍaÍåÍó!@¯å*ή&bÍRÍ�Íb*Œ®&Í(å!YÑÍN}2;¯Éýáá}2‹®ýå*‹®&M·íRÂ,Í®*Ã3,S·íRÂ,Í#)Ã3,Q·íRÂ&,͉+Ã3,?·íRÂ3,Í É*;¯&å*:¯&Ñ}³oå*9¯&Ñ}³oå*<¯å!ÑÍNÑ}³o}2†®*†®&ÉÍí!å!ÑÍ5z³Ê¤,Õ}2}®!@¯å*}®&+å)ÑÑåÍQÍó*}®&#ÑÃu,ÍQ!6¯ÍâÍQ!3¯ÍâÍü#!å!åÍç}2>¯!å!ÑÍ5z³Ê-Õ}2}®!6¯Í-ÍQ!å!åÍçÍaÍå!6¯Íâ*}®&#ÑÃÙ,!å!ÑÍ5z³ÊZ-Õ}2}®!3¯Í-ÍQ!å!åÍçÍaÍå!3¯Íâ*}®&#ÑÃ-!å!åÍç}2?¯*?¯&å*>¯&ÑÍaå*?¯&å!3¯Í-Í}îoÑ}£oå*?¯&å!6¯Í-Í}îoÑ}£oËEÊZ-!}2;¯!}2:¯!}29¯!å!åÍç}2ª®*ª®&å!6¯Í-!3¯Í-ÍåÍ}îoå*ª®&å*>¯&ÑÍaÑ}£oËEÊÆ'ÍRÍ�-A superbat picked you up and carried you off.Í�Íb*ª®&}2?¯É*:¯&}îoå*?¯&å!3¯Í-ÍÑ}£oËEÊã(ÍRÍ�.Don't do that!! Too late, you fell into a pit.Í�ÍbÍRÍ�You should be more careful.Í�Íb!}2:¯Éýá!¡®Íâýå!å!åÍç}2œ®*œ®&å!¡®Í-ÍËEÊñ(*œ®&"¤®*¤®É*?¯&}2–®!ÊÍš}îoËEÊç)ÍRÍ�where Íb!—®Í+ÍíÍ_Íb*>¯&å*—®&ÑÍNËEÊx)!}29¯Ã“)*?¯&å*—®&ÑÍNËEÊ“)!}2:¯*—®&å!@¯å*–®&+å)ÑÑÍ-Í}îoËEÊØ)!@¯å*–®&+å)Ñ quitting : boolean; killed : boolean; wumpuskilled : boolean; bats : rooms; pits : rooms; commandset : set of char; dummy : file; (* * rand * returns a random number between low and high *) function rand(low, high : integer) : integer; begin rand := low + random(high-low+1); end; procedure doinstr; begin writeln; writeln('Your mission, should you desire to accept it, is it hunt for the'); writeln('Wumpus in his cave+å)ÑÑå!@¯å*ή&+å)ÑÑÍ-ÍQ*Ï®&ÍaÍåÍóÉ!å!ÑÍ5z³Ê4$Õ}2Å®*Å®&å*Å®&å!Ñë·íRåÍw#*Å®&#ÑÃ$!å!ÑÍ5z³Ê§$Õ}2Å®!å*Å®&å!Ñë·íRåÍç}2î*î&}/o|/gå!@¯å*Å®&+å)ÑÑÍ-ÍËEÊœ$*Å®&å*î&åÍw#*Å®&#ÑÃ?$ÉÉÍRÍ�You are in room *?¯&å!ÍöÍ�ÍbÍRÍ�"There are tunnels leading to roomsÍb!å!ÑÍ5z³ÊZ%Õ}2º®*º®&å!@¯å*?¯&+å)ÑÑÍ-ÍËEÊO%ÍR! Íò*º®&å!ÍöÍb*º®&#Ñà %ÍRÍ�Íb*?¯&å!@¯å*>¯&+å)ÑÑÍ-Íå!@¯å*?¯&+å)ÑÑÍ-!@¯å*>¯&+å)ÑÑÍ-ÍÍQͪÑ}³oËEÊß%ÍRÍ�I"<¯ÍQ!MÍa!SÍa!QÍa!?Ía !¯ÍâÉÍRÍ�Welcome to Wumpus!!Í�Íb͘"Íg,Ío&åÍé+Í4,ËEÊ.!ã®åÍ gamemenu.chnÍ=!ã®Í´ÍbÃÅ"<¯ÍQ!MÍa!SÍa!QÍa!?Ía !¯ÍâÉÍRÍ�Welcome to Wumpus!!Í�Íb͘"Íg,Ío&åÍé+Í4,ËEÊ.!ã®åÍ gamemenu.chnÍ=!ã®Í´Íbà  . To succeed, you must shoot it with one of your'); writeln(numberofarrows:1,' arrows. If you shoot into a room which is not directly connected to'); writeln('yours, the arrow will bounce to one of the rooms that does connect.'); writeln('The bats in the cave may pick you up and place you in a different'); writeln('room. If you enter a room which has a pit, you will fall into it.'); writeln('If the wumpus finds you or you run out of arrows, you lose.'); writeln(' At the prompt typone *) function command : char; var ch : char; begin describe; repeat write(prompt); read(trm,ch); writeln; ch := upcase(ch); if not (ch in commandset) then begin writeln(' Type ? for instructions.'); end; until ch in commandset; command := ch; end; (* * checkwump * move the wumpus and see if it went to the same room as the player, * if so he's dead. *) procedure checkwump; var newwumproom : for currentroom := 3 to maxrooms do begin newtunnel := rand(1, currentroom-1); if not newtunnel in cave[currentroom] then addtunnel(currentroom, newtunnel); end; end; (* * skipblanks * skips spaces, tabs until eoln *) procedure skipblanks; begin end; (* * describe * give a description of the current room ( player ). tell player if the * wumpus is nearby. *) procedure describe; var i : room; begin writeln('You are in roln('You should be more careful.'); killed := true; end; end; (* * randroom * returns a random room number in the range limited by the set argument. *) function randroom ( limitedto : rooms) : integer; var apossibility : room; begin repeat apossibility := rand(1, maxrooms); until apossibility in limitedto; randroom := apossibility; end; (* * doshoot * player tries to shoot the wumpus by listing the rooms that he wants to * shoot through. if the m,s or q for move, shoot or quit.'); writeln; end; procedure askinstruct; var answer : char; begin write('Do you want instructions? '); read(trm,answer); writeln; while not (upcase(answer) in ['Y','N']) do begin writeln('Please answer yes or no'); write('Would you like instructions? '); read(trm,answer); writeln end; if upcase(answer) = 'Y' then doinstr; end; (* * addtunnel * make a tunnel connection between two room; begin newwumproom := rand(1, maxrooms); if (newwumproom in cave[wumpus]) then wumpus := newwumproom; if (wumpus = player) then begin writeln('Look Out!! The Wumpus got you.'); writeln('Better luck next time.'); killed := true; end; end; (* * checkbats * if the player is in a room with bats they will pick him up and move him to * another room (which will not have bats in it). *) procedure checkbats; var flewto : room; beom ',player:1); write('There are tunnels leading to rooms'); for i := 1 to maxrooms do if i in cave[player] then write(' ',i:1); writeln; if (player in cave[wumpus]) or ((cave[player] * cave[wumpus]) <> []) then writeln('I smell a Wumpus.'); if cave[player] * bats <> [] then writeln('I hear bats.'); if cave[player] * pits <> [] then writeln('I feel a draft.'); end; (* * command * returns the single character that signifies what is to be de rooms do not match the list, the arrow bounces * randomly to a connecting tunnel. *) procedure doshoot; var nextroom, lastroom : room; begin lastroom := player; while not eoln do begin write('where '); readln(nextroom); if wumpus = nextroom then wumpuskilled := true else if player = nextroom then killed := true; if not (nextroom in cave[lastroom]) then nextroom := randroom(cave[lastroom]); lastroom := n rooms *) procedure addtunnel(from, dest : room); begin cave[from] := cave[from] + [dest]; cave[dest] := cave[dest] + [from]; end; (* * makemaze * makes a reasonably random maze. for each room tries to make 3 new tunnels. * if a tunnel already exists in that direction, another digging that way is * not made. *) procedure makemaze; var currentroom, tunnelto, newtunnel : room; begin for currentroom := 2 to maxrooms do addtunnel(currentroom, currentroom-1);gin if player in bats then begin repeat flewto := rand(1,maxrooms) until (not (flewto in (bats + pits))) and (flewto <> wumpus); writeln('A superbat picked you up and carried you off.'); player := flewto; end; end; (* * checkpits * determines if the player fell into a pit. *) procedure checkpits; begin if not killed and (player in pits) then begin writeln('Don''t do that!! Too late, you fell into a pit.'); write  extroom; skipblanks; end; arrowsleft := arrowsleft - 1; if killed then writeln('You klutz! You just shot yourself.') else if wumpuskilled then writeln('Congratulations! You slew the fearsome Wumpus.') else if arrowsleft = 0 then writeln('You ran out of arrows.') end; (* * domove * player's move, must be to an adjacent room *) procedure domove; var dest : room; begin write('To '); readln(dest); if not (dest in [1..maxrooms]nitialize; var i : room; begin randomize; for i := 1 to maxrooms do cave[i] := []; bats := []; pits := []; makemaze; wumpus := rand(1, maxrooms); for i := 1 to maxbats do bats := bats + [rand(1, maxrooms)]; for i := 1 to maxpits do pits := pits + [rand(1, maxrooms)]; repeat player := rand(1, maxrooms); until (player <> wumpus) and not (player in pits) and not (player in bats); quitting := false; killed := false; wumpuså) then writeln('There is no room # ', dest) else if not (dest in cave[player]) then writeln('I see no tunnel to room # ',dest) else player := dest; checkbats; checkwump; checkpits; end; (* * doquit * asks if the player really wants to quit *) procedure doquit; var answer : char; begin writeln; write('Do you really want to quit now? '); read(trm,answer); writeln; quitting := upcase(answer) = 'Y' end; procedure doaturn(actåkilled := false; arrowsleft := numberofarrows; commandset := [move, shoot, quit, help]; end; begin writeln('Welcome to Wumpus!!'); askinstruct; initialize; repeat doaturn(command); until gameover; assign(dummy,'gamemenu.chn'); chain(dummy) end. åion : char); begin case action of move : domove; shoot : doshoot; quit : doquit; help : doinstr; end; end; (* * gameover * returns true if the game is over *) function gameover : boolean; begin gameover := quitting or killed or wumpuskilled or (arrowsleft = 0); end; (* * initialize * generates a random maze and the positions of the player, wumpus,and bats. * make sure that the player doesn't start with the wumpus. *) procedure iå  åååååååååå!  åååååååååå"  åååååååååå#  åååååååååå$  åååååååååå%  åååååååååå&  åååååååååå'  åååååååååå