zd : n  , : X$"Tour de France Bicycle Race" :  x  , : X$"(c) David H. Ahl, 1986" :   , : X$"Press any key to continue." :  3 () : RNRN : _ :  : :Display initial scenario PLACE$(),TYPE(),DIST(),PP()GDGR : PLACE$()"Reims"  : :Read event probabilities  :  : :Read data about places3 , : X$"Press any key to continue." :  P () : RNRN : { RN : RNRN : : RN : ::Enter pre-race data "Do you have the timing loop value from a previous run";A$  : A$"N" "6 "Please enter the value";PT : PT PT ,z "That doesn't sound right. Please enter it again";PT : ,"  : :Calculate pedaling time (takes 20 seconds),: "About your physical fitness: are you (1) in fantastic health,"C6 " (2) excellent shape, (3) quite good, (4) okay, (5) pfffsst"v@ " Please enter a number between 1 and 5";AJ A A "Huh? I don't understand." : @TFIT #|A : :Physical fitness factor)^ "How many weeks do you intend to take off from work or school to"hh "practice and prepare for the race";WK : WK WK r WK  : "You must be joking. You'll need at least six"| "weeks if you want to be a real contender. Now..." : ^<FITFIT( WK)L| : :Modify fitness factor for amount of practicea  : :Assign keys to pedals "Thank you. Let's go out for a practice run."PFRQ : PTM : J : PD : : :Pedal bicycle "In an upper middle gear ratio (52/17)," RPM "rpm would translate"h "to a speed of approximately" (JRPM) "kilometers per hour." RPM<  : "That speed is barely competitive. Next time" "you play, try a timing loop value of" (PPTRPM) "but for now"; "you may want to have the computer do most of the pedaling." : "How much do you want to pedal your bike (on the keyboard)?" "1=hardly at all, 3=occasionally, 7=frequently, 10=every opportunity" "Please enter a number between 1 and 10";PFRQ : PFRQ PFRQ. PFRQ PFRQ 6:^:Beginning of main riding sectionlDAYDAY& : "Date: July" DAY " You are at " PLACE$(DAY) "."0 TYPE(DAY) D : "Today, thank goodness, is a rest and recuperation day." : PD "Your destination is " PLACE$(DAY) "," DIST(DAY) "km from here."N "Type of racing this stage: " TYPE$(TYPE(DAY))X TYPE(DAY)TYPE(DAY) b:l:Select gear range v "Do you want a different basic gear range than yesterday";A$1  : A$"N" R : GDGRz "Naturally you will shift gears, but what will be your basic gear" "range (ring and cog) for the day. First the ring (40 or 52)";RNG RNG( RNG4  : "You don't have that ring."* "Enter 40 or 52 please";RNG : _ "Which cog (13, 15, 17, 19, 21, 23, or 25)";CG CG CG CG CG CG CG CG  "Sorry, you don't have that cog. Please try again." : ' (CG RNG() (CG RNG4)  : GRRNGCG: j "The chain line will be badly skewed with that combination." "Let's do it again. First the ring. "; :  TYPE(DAY) R GRL X$"high" : GRfff X$"low" : ?  "That ratio sounds very " X$; : ". Do you want to change it";A$Z   : A$"Y"   TYPE(DAY) GR33   : >  "For mountainous terrain, that's a rather high basic gear ratio." !* "Do you want to stick with it";A$ :  : A$"N" Y!4GDGRff&\B~GR : H : :Penalty for too high gear ratio in mts!> GR GDGR,)\~GR : :Penalty for too high gear on flat route!H:!R:Start of stage!\TDEPd(;())!"f "Your departure time is scheduled at 9:"; : ((TDEP),)\"p p : PTM : RPS : J : KPHRPM_~GRGDGR"z "##.#";KPH; : " kph." : "TDL :  : :Road hazards"CR : :  : :Mechanical breakdowns# TYPE(DAY) GR, PP()PP() : PPTPPT : PPX<# : \ : :Physical problemsn# PPX PPX : PP()PP() : PPTPPT # : "Time for a quick breather. You have about";# (()) "km to go."# "Press any key when you're ready to go."+$ () : : "Okay, on the road again..."3$:Q$:Sprint at end of stage$ p : : "You're coming up on 10 km from the end."$ "During the countdown (in 0.1 kilometer increments) you can"% "press any key when you want to start your sprint." : p \% : DSP  L} : :Count down from 10km by 0.1 increments% , : "##.#";DSP : () .%$ DSP : KSR : B%.PTMDSP : RPS : J : KSRRPMJ : :Sprint speed &8 "##.#";KSR; : " kph." : M&BTMSDDSPKSR : TMRD(DIST(DAY)DSP)KPH : TTM()TMSDTMRDTDL&L DSP "Puff...puff...puff. That was a L-O-N-G sprint!"&V:&`:Calculate top six riders&j : "Race summary (total times in hours):".'t " Rider 1 (you) 2 3 4 5 6"o'~TTSTTM() : WS : "Stage time", : "#####.##";TTM();' TYPE(DAY) GQ : GQL' I  : RPMF()'TTM(I)DIST(DAY)(GQRPM)333() : "#####.##";TTM(I); ( TTM(I)TTS TTSTTM(I) : WSI(( I](TTT : WT : : "Total time", : I (TTR(I)TTR(I)TTM(I) : "#####.##";TTR(I);( TTR(I)TTT TTTTTR(I) : WTI( I : : ) " Stage winner: Rider" WS " Overall leader: Rider" WT)WSG(WS)WSG(WS)1) DAY 9):T) :End of race summary) : "The Tour de France has ended!" : : X) I  : WSG(I)X XWSG(I) : WSI)( I : "Winner of the most stages (" X ") was Rider" WS;*2 WS " That's YOU!" : M*< "Overall winner by elapsed time was Rider" WT;r*F WT " That's YOU!" : *PTTT : WT : I *Z TTR(I)WSG(I)TTT TTTTTR(I)WSG(I) : WTI*d I+n "Overall points winner (time and stages) was Rider" WT;3+x WT " That's YOU!" : =+  E+:s+:Subroutine to read event probabilities+ I  : A : PRTPRTA : PR(I)PRT : I+ 5,5,5,5,5,5,5,5,5,5+ I  : A : PMTPMTA : PM(I)PMT : I , 5,5,5,5,5,5,10,5@, I  : A : PPTPPTA : PP(I)PPT : I : b, 8,5,5,5,5,5,5,5,5,8,5,5,5,3j,:,:Subroutine to deal with road hazards,RN(PRT()) : I  , RNPR(I) I : I : :If event happened, exit loop(- I ,",6,J,^,r,,,,k- "Mostly gravel roads this stage. You'll have to slow down."-TDLTDLL : -" "The roads in this area are very bumpy and will slow you down."-,TDLTDL : ".6 "Hot weather in this area has caused the roads to become very"Y.@ "slippery from oil seepage." : TDLTDL : .J "The wind is at your back making for a very fast ride!".TTDLTDL : .^ "You're heading straight into the wind today. Tough going."/hTDLTDL : K/r "There is a gusty side wind today creating balance problems."a/|TDLTDL : / "Dreary day: drizzle, fog, and clammy chill in the air."/TDLTDLL~ : / "Horrible weather! Icy rain that hits you like 1000 needles,"C0 "stinging your face and arms. Your shoes are soaked. And there"0 "are few spectators to cheer you on." : TDLTDL : 0 "Mud and puddles on the road cause you to slide and skid all over."0TDLTDLL : &1 "Today is a crisp, clear day in the French countryside." : .1:c1:Subroutine to deal with mechanical breakdowns1RN(PMT()) : I  : :Select event1 RNPM(I) I : I : :If event happened, exit loop1 I ,&,:,b,,,,H=2 "You have a broken spoke. Want to fix it now";A$ :  k2 A$"Y" TDLTDLL} : TDLTDL~q22& "You got a flat tire. You'll have to change it now."20TDLTDLL} : 3: "Your brakes tend to lock every time you apply them hard. You can"Q3D "nurse them along or fix them here. Want to fix them now";A$3N  : A$"Y" TDLTDLL~ : TDLTDLL3X3b "You seem to be missing shifts to your 19 cog. Perhaps one or"4l "more teeth are worn. You can shift around it or fix it here."Z4v "Want to fix it now";A$:  : A$"Y" TDLTDLL~:p4TDLTDLL : 4 "On a tight corner, you narrowly missed a spill, but your toe clip"5 "got bent on a boulder near the road. Want to bend it out now";A$15 A$"Y" TDLTDLL} : TDLTDLL~75y5 "Uh oh! Chain broke. You've no choice but to fix it now."5TDLTDL~ : 5 "WHOOPS! Took a corner too fast, lost traction, slid, and CRASHED!"6 p : CR : RN() : RNu{   : RN Y6 "You pick up yourself and your bicycle. You're both"6 "scratched and a bit beaten up but there seems to be no"6 "serious damage so you get on your way." : TDLTDL : $7 "You twisted your ankle and it is very painful. You know it will"o7 "slow you down. However, there is no way you would drop out of the"7  "race, so you pick up your bicycle and get on your way."7TDLTDLL : 8  "Blood is all over the place; ambulance is called and"78* "you are rushed to the local hospital." : p 84 "Bad news! You dislocated your shoulder and you're out of the race."8>  8H "Bicycle ran like a charm today. No problems at all!" : 8R:9\:Subroutine to deal with physical problems)9fRN(PPT()) : I g9p RNPP(I) I : I : :If event happened, exit loopx9z I 9 I , ,$ ,B ,V ,t , , , , 9 I  ,( ,P ,d 9X(DIST(DAY)2) : X X6: "You're pushing yourself to the absolute limit and after" X "hours"~: "you totally collapse. The medics give you oxygen and bring you": "around, but warn you against resuming the race." : CL :CL : ()L +; p : "But nothing can defeat your competitive spirit and you"_; "vow to press on regardless." : TDLTDL : ; p : "You heard of another rider dying from overexersion last"; "year, so you follow the doctor's advice and withdraw." :  0< p : "This is the second time you collapsed in this race,"r< "so you reluctantly concede that this just isn't your year"< "and you withdraw from the race." :  < "You have a terrible abdominal pain...something you ate, perhaps?"'= "You'll have to slow down a bit." : TDLTDLL : r=$ "You're having difficulty breathing and you're feeling lightheaded."=. "You recognize this as an early warning signal of total collapse">8 "and wisely decide to slow your pace a bit." : TDLTDL : J>B "You seem to be seeing through a haze...and it's not the weather.">L "Occasionally, you can't seem to focus at all." : . >V "Uh oh! A muscle in your calf seems to have turned to jelly. It's"?` "not particularly painful, but it seems to be completely out of"`?j "control. You'll have to slow down a bit." : TDLTDL : ?t "You have a sharp pain in your lower back. It doesn't seem to be"?~ "injured...perhaps you're just overly tense." : TDLTDLL~ : 8@ "The gearing you've been using is really tough on your legs and"@ "you have developed shin splints. You'll have to back off your"@ "blistering pace a bit." : TDLTDL : @ "Terrible pain in the balls of your feet. Your toe clip seems to be"GA "adjusted correctly. Maybe it's these new cleats. In any event,"A "you decide to back off a bit...just for today." : TDLTDL :A "A medic takes a look at you during lunch break and declares you"!B "have a salt/water imbalance. 'Drink more water along the way,'"`B "he recommends, 'and don't forget your salt pills.'" : tB TYPE d B "The altitude is getting to you in the mountains. You're short of"B "breath and you feel lightheaded." :  ;C "Your saddle feels like it has appended itself to your body. A cyst"C "seems to be starting, something you want to avoid at all costs."C "You put some extra padding on the saddle and back off on your"C "pace just a tad." : TDLTDL~ : AD( "The blistering pace you've been keeping has played havoc with your"D2 "knees. You've heard of football players with bad knees, but a"D< "bicycle racer? Nevertheless, you'll have to slow down a bit."DF TDLTDLL~ : ,EP "You developed a bad cramp in your legs. You'll have to take it"[EZ "just a bit easier." : TDLTDL~ : Ed CR f : :Can't feel too great after a crashEn "You're feeling fit as a fiddle and have no physical problems today."Ex E :F :It's all overEF : "Too bad. That's it for this year, but there's always"[F "next year...."F : "Would you like to ride again";A$ :  F A$"Y" : "M" : F :F :Subroutine to assign keys to pedals*G "To pedal your computer bike, you will strike two keys alternately"fG "with two fingers (one hand or two, it's up to you)."G "Which key do you want for your left pedal";LF$G "and which key for the right";RT$ : G :H :Subroutine to calculate time to pedal as a function of processor speedjH "Calculating timing loop value takes 20 seconds. Please be patient."H : EN<((,,))((,))H" <((,,))((,))EN : PTPT : I, PTPT : "The timing loop value for your computer is"PTSI6 "Please write it down for playing this game in the future." : [I@ :~IJ :Subroutine to pedal bicycleIT DAY PD  : :Must get at least one chance to pedalI^ DAY PD  : :Second chance to pedal9Jh PFRQR() PDPD :  : :Human pedal bike?Jr RPM((RPS(())FIT) : "Computer is pedaling your bicycle."J| p : X$"It" :  J "Start pedaling"; : p : " NOW!" : J K : I PTPTM K A$ : (A$) A$B$  0K A$LF$ A$RT$ KK : B$A$8K IzK "Okay, stop pedaling." : RPM(fffFITKPTM) : X$"You"K RPM_ RPM(T ())K X$ " pedaled at a rate of" RPM "rpm. Calculating speed...."; L A$"" : I   : B$ : I : L :AL :Subroutine to read data about routeszL I  : N,PLACE$(I),TYPE(I),DIST(I) : I : L 1,"Lille",1,213L 2,"Arras",4,52L 3,"Caen",1,308L 4,"Le Mans",1,172L& 5,"Nantes",1,192M0 6,"Bordeaux",1,338#M: 7,"Biarritz/Bayonne",1,184;MD 8,"Lourdes",3,168QMN 9,"Lourdes",5,0kMX 10,"Toulouse",2,172Mb 11,"Rodez",2,176Ml 12,"Avignon",2,294Mv 13,"Grenoble",2,228M 14,"l'Alpe-d'Huez",4,39M 15,"Lansleburg",3,225N 16,"Martigny, Switzerland",3,230.N 17,"Annecy",3,218DN 18,"Annecy",5,0ZN 19,"Lyon",2,182qN 20,"Dijon",1,212N 21,"Fountainbleau",1,259N 22,"Paris",1,210N :N :Subroutine to read wordsN I  : TYPE$(I) : I : 9O "Mostly flat with small hills.","Hills, gorges, steep slopes."uO "Mountains." ,"Time trial against the clock.","Rest."}O :O :Subroutine to read yes/no answerO > : A$"Y" A$"N" P* "Don't understand your answer. Enter 'Y' or 'N' please";A$:  P4 :bP> :Subroutine to read first letter of answer and convert to upper case{PH A$"" A$"Y" : PR A$(A$,) : A$"A" A$"Z" P\ A$((A$) ) : Pf :Pp :Subroutine to make a short pauseQz PAUSE , : XX : PAUSE : Q :KQ :Subroutine to print a centered linehQ (F(X$))) X$ : pQ :Q :Subroutine to display initial scenarioQ X$"Tour de France Bicycle Race" :  : R " You are a bicycle racer entered in the 22-day Tour de France"cR "bicycle race around France. Your objective is to win the race by"R "having the lowest overall elapsed time. In addition, you must try"R "to win as many individual 'stages' or daily races as possible, as"=S "wins on these stages count towards the overall points prize."S " Each day you pedal your bicycle by alternately pressing two"S "keys on your computer keyboard as quickly as possible (you may opt"T "to have the computer do some of the pedaling for you)."VT " While racing, various hazards occur (weather, mechanical"T "breakdowns, road conditions, and physical problems) that hamper"T$ "your progress."T. " At the end of each stage (day), you may sprint to the finish"EU8 "line. The computer will count down the distance starting ten"UB "kilometers from the end of the race. During this countdown, you"UL "must decide when to start your sprint. Remember, if you start too"#VV "soon, you may become too exhausted to maintain your sprint to the"jV` "end, but if you start too late, other riders may overtake you."pVj