THE GAME
In Tour de France, you are a bicycle racer whose objective is to win the famous three-week bicycle road race around France. The competition is fierce in this most grueling of all races: You must overcome physical pain, mechanical difficulties, rough terrain, and other problems.
Prior to the race, you are asked some questions about your physical condition and training. You are also given a chance to pedal your bicycle on a short practice run. To "pedal" your bicycle, strike two keys alternately on your keyboard. You can use the index finger of each hand or the index and middle finger of one hand. A well-practiced rider in excellent condition can pedal a bicycle at about 80 rpm.
Your bicycle is a 12-speed with ring gears (pedal) of 52 and 40 teeth, and cog gears (back wheel) of 13, 15, 17, 19, 21, 23, and 25 teeth. (See Table 1.) In your highest gear, 52/13, you will travel 8.61 meters for each pedal revolution, while in your lowest gear, 40/25, you will travel 3.45 meters. Your high gears are best for the flat, open road, while your low gears are necessary for climbing the steep mountains.
Cog Gear | 13 | 15 | 17 | 19 | 21 | 23 | 25 |
Ring Gear | |||||||
52 | 8.61 | 7.45 | 6.59 | 5.88 | 5.32 | 4.87 | |
40 | 5.75 | 5.06 | 4.55 | 4.09 | 3.75 | 3.45 |
TABLE 1. Meters progressed for ring/cog combinations
Here are a few tips to help you place among the top finishers:
- Always use the highest gear possible for the terrain you encounter.
- You can have the computer do some of your pedaling, but it is an inconsistent performer, so you may be better off doing your own pedaling.
- There is a sprint at the end of each stage. The computer counts down the kilometers starting 10 km from the end of the stage. You must decide when to start your sprint. Start too soon and you may tire before you reach the finish line; start too late and you will not gain much time.
The Tour de France is probably the toughest athletic contest in the world One quarter of the starters never finish the race. But the others—despite collisions, concussions, gashes, and even broken bones—continue to compete, for simply to finish the Tour is a feat any cyclist can be proud of.
THE STORY
What is the most popular sporting event in the world? The World Series? Wimbledon? The Olympic Games? Hardly. The World Soccer Cup? Getting warmer. The Indianapolis 500? Almost (it is the most popular one-day event). The Tour de France? Bingo! Every year, more than 20 million fans line the roads to catch just a quick glimpse of the bicycles flashing by in this most competitive race.
The Tour, which lasts three weeks, is a race of at least 4000 kilometers (2500 miles) winding through France, the Pyrenees, and the Alps, to the traditional finish line on the Champs-Elysèes in Paris. The riders who compete in the Tour de France are among the toughest and most courageous athletes in the world; they have to be to survive the formidable daily pace, full-speed sprints, 60 mph spills, treacherous weather, and fickle equipment.
The Tour de France was created in 1903 by Henri Desgranges as a promotional device to sell newspapers, and today it is still owned by I'Equipe, a sports paper. But over the years, the Tour has become practically a sovereign state with its own motorcycle police force, its own traveling bank, and more than 2000 full-time participants (officials, mechanics, trainers, doctors, chauffeurs, technicians, salesmen, reporters, and photographers) in addition to the 170 or so riders.
Although it is theoretically possible to enter the Tour de France as an individual, it is rarely done, not only because of the high cost, but because of the support personnel and equipment required. Thus, in recent years, all of the entries have been teams—each one consisting of ten competitors and a veritable army of support troops.
Many other countries have bicycle tours, but the majority of them are relatively unimportant to the professional teams because of length (too short), time of year (before or after the main European season), or location (Africa, Asia, and East Europe pose unmanageable logistical problems). Thus, only three tours remain significant—those of Spain, Italy, and France—and, of these three, the Tour de France reigns supreme.
The route of the Tour changes each year and, for a price, a small town or village can buy a few moments of recognition on European television by becoming an evening stopover point—the end of one stage and the beginning of the next. In these small towns, shops and banks close, and all of the townspeople turn out to welcome the riders as they struggle in at the end of the daily stage. Even more exciting is the half hour in the morning before the departure on the next stage: Young and old turn out in full racing regalia to glide on their bicycles among the riders, children seek autographs, and riders chat with their fans.
The price a town must pay to start the Tour is substantial—about a half million dollars. Therefore the race usually starts in a major city, not necessarily in France. Frankfurt was the starting city in 1980, Nice in 1981, and Basel in 1982. More recently, the organizers have been promoting the idea of a region—rather than a city—hosting the race start. Thus in 1983 the race began in the southeast of Paris, Val-de-Marne Department, and in 1984 the race began north of the capital in the Seine-Saint-Denis Department.
As the route of the Tour changes from year to year, so does the length. It is generally about 4000 kilometers long, although in 1968 it was stretched to a staggering 4664 kilometers. Sometimes the route is continuous, with each new stage starting at the end of the preceding stage, although in recent years there have been some notable breaks, including a 300-kilometer train trip between Stages 22 and 23 in the 1984 race.
Generally, one stage is run each day, although this is not a hard-and-fast rule. Occasionally, a time-trial stage may be run after one of the shorter flat stages. During time trials, racers compete against the clock, starting at one-minute intervals and race completely on their own to the finish line. The time trials are regarded as particularly painful events because a rider cannot use the slipstream or draft effect of his competitors, and because tactics are secondary to pure concentration and sheer physical effort.
Sometimes there may be one or two rest days—usually just one which comes two-thirds of the way through on July 14, Bastille Day. Distances to be covered in each stage are quite different, ranging from 350 kilometers in a flat stage to as little as 20 kilometers in a time trial or one of the high mountain stages.
Although most time trials are held over fairly short distances, there are some that range longer in length. One of the most prestigious long distance events is the Hour Record time trial. In this event a racer is challenged to cover the maximum amount of distance possible in one hour. Points are awarded for winning and placing in all the time trials and race stages. Thus, for determining the overall Tour winner (calculated by a complex formula including total elapsed time and points for stage wins), time trials loom as important events.
To get a feel for an actual race, let's accompany the riders in the 1984 Tour. Seventeen teams entered the 1984 race, each with ten riders. A short prologue stage was held on Friday, June 29, two days before the official start. This was a time trial held near Paris that took the winner, Bernard Hinault, only 6 minutes, 39 seconds to complete. The tenth place rider was only 14 seconds behind the leader, and most riders agreed that this was just a small warm-up and not indicative of the race to follow. Nevertheless, Hinault got to wear the coveted yellow jersey (awarded to the winner of each stage) for the start of the actual race.
The first "real" stage of the 1984 Tour started from Seine-Saint-Denis on Sunday, July 1. The route wound 249 kilometers over secondary roads towards Louvroil in the Nord Department. The day was hot, and would have been oppressively so except for a headwind that was strong enough to cool down the passion for breakaways. Moreover, the road was narrow, rarely allowing more than three men abreast; thus, escape from the pack was effectively blocked. During this stage, the riders seemed most concerned with staying out of each other's way and avoiding the grazing contacts that can cause mass spills. Nevertheless, on a tight corner at the 78th kilometer, Jean-Rene Bernaudeau fell, scraping a knee. Before the day was over, six other riders crashed, injuring shoulders, legs, arms, and heads.
Jaime Vilamajo was fined 75 francs and penalized 10 seconds for receiving a bag of food at kilometer 158, 16 kilometers beyond the feeding zone, a designated stretch where riders can grab a light sack of food. Another rider was fined 50 francs for stopping on the left side of the road, instead of the regulation right, when he had a flat tire. In the old days, each rider carried a spare tire strapped to his back. However, as it took about three minutes for a rider to change his own tire and it takes a team mechanic only 30 seconds, today a rider with a flat simply waits at the side of the road for his team mechanic to come along and change the tire. These days, riders don't even dismount but simply stand, straddling the frame of their bicycle, while a tire is changed or a minor mechanical problem is fixed by a mechanic.
The second day of the 1984 race consisted of two stages, a 51-kilometer team time trial and an 83-kilometer stage through predominantly flat country near the Belgian border. During the afternoon stage, there was a strong sidewind, and Belgian rider Adri van den Haute, running 96th in the standings, perhaps sparked by the proximity to his native land, made a strong breakaway and built an astounding 6 minute and 23 second lead. Crowds love a breakaway, and a great cheer greeted him as he entered Douai, about midway through the stage. However, as the kilometers wore on and the sidewind turned into a rainy headwind, his lead slowly diminished, and he finally finished at Bethune with a 1 minute, 3 second lead.
The next day in Stage 5, Paulo Ferreira, an unknown Portuguese rider, unexpectedly broke away at kilometer 3, just after the start of the race. Two other riders followed him and the three of them swapped the positions of setting the pace and riding the slipstream for the entire 207 kilometers of the stage from Bethune to Cergy-Pontoise. As their lead from the pack built up through 11 minutes, 19 minutes, and ultimately 27 minutes, they experienced the exhilaration of looking back over the small hills and seeing nobody following. Until this stage, there had never been more than 13 seconds difference between the total elapsed time of the first- and fourth-place riders. Now, three completely new riders were in the top three places—Vincent Barteau, Maurice Le Guilloux, and Ferreira—and there was more than a 17-minute gap to the former first place rider who had slipped to fourth place.
Stage 6 was a 202-kilometer run over flat country to Alençon. The stage was largely uneventful until, just ten kilometers from the end, two riders in the middle of the pack locked wheels, causing a mass crash of at least 30 other riders. "What's awful about bicycling," said Greg LeMond, the great American cyclist, "is that you're supposed to get up, get back on your bike, and finish. In any other sport they'd let you lie there for a while. What if you'd done something to your neck and they get you up and put you on your bike and break your neck and you're paralyzed the rest of your life?"
Except in the Benelux countries, helmets are not required for cycling in Europe. Nobody wears them, because they are too hot and, according to most riders, their protective value has not been proven. Race organizers like to point out that competitive cycling is quite safe: "After all," they say, "only six riders have died from injuries in the last 30 years." Of course, this argument ignores the scores of non-fatal injuries sustained in nearly every race: broken legs and arms, dislocated shoulders, amputated fingers, concussions, gashes, and sprains.
Thursday, July 5, saw the first serious individual time trial—67 hilly kilometers from Alençon to Le Mans. Riders were started at two-minute intervals in the inverse order of their overall ranking. On a long time trial, a rider must not think about the distance traveled or the distance to go; rather, he must just focus on the next 20 meters; his attention cannot wander and he cannot relax. His back may be aching, his lungs bursting, and his legs wobbly, but he must pedal on.
Laurent Fignon of the Renault team finished with a time of 1 hour, 27 minutes, 33 seconds, with an average speed of nearly 46 kph. Sean Kelly, an Irish rider, was 16 seconds behind, and Bernard Hinault, an unpopular Breton who had won the Tour four times since his debut in 1978, finished 49 seconds off Fignon's time. Barteau was still in the lead, but Fignon had made up more than five minutes on his total time and was in fourth place overall.
The eighth stage on Friday, July 6 was a largely flat 192-kilometer ride from Le Mans to Nantes at the mouth of the Loire River on the West Coast. Pascal Jules of the Renault team won the stage, although overall he was well down in the rankings. The ninth, another flat stage, saw the cyclists "riding forever," as LeMond put it, "forever" being the 338 kilometers between Nantes and Bordeaux.
At the end of one of the bonus sprints on this long and boring stage, Hinault, accompanied by 20 other riders, made a breakaway and gained 30 seconds on the pack. It didn't take long for the Renault, Panasonic, and Kwantum teams to react. Their riders fell into team time-trial formations and pushed the pace up to 60 kph in an effort to catch the Hinault group. When a team is chasing over a flat road and can see the gap narrowing, the chasers have the psychological advantage. On this particular July day, some additional aid to the chasers came from an unexpected ally, the wind, which shifted from the left side to a headwind. In 20 kilometers the pack had caught the renegades, and things settled down for the remaining 200 odd kilometers. Jan Raas of the Kwantum team was the winner with a time of 9 hours, 40 minutes. The order of the first six riders had not changed since Alençon, and Barteau, surprisingly, was still in first place overall, with the favored Fignon in fourth place, trailing the leader by more than 12 minutes.
The tenth stage—the prelude to the mountains—was held Sunday, July 8. It covered 198 kilometers from Bordeaux to Pau in the foothills of the Pyrenees. Eric Vanderaerden was the stage victor. Fignon displaced Ferreira from third place but was still more than 12 minutes behind race leader Barteau.
Compared to previous years, the climb in the Pyrenees from Pau to the ski resort at the summit of Guzet-Neige (1480 meters high) was relatively benign. Asked why the new route was chosen, the organizers claimed it was to avoid the steeper peaks close to the Spanish border where Spanish Basques, eager for publicity, might possibly disrupt the race. Robert Millar of Scotland was the easy winner with Luis Herrera of Colombia 41 seconds behind him. Overall, the first three places remained unchanged, but Ferreira, who had been holding on to fourth place, proved conclusively that he was not a climber by finishing dead last, 59 minutes and 43 seconds behind Millar.
Next came a series of four stages through the Massif Central, France's mountainous heartland and the transition between the Pyrenees and the Alps. This is a region of hills, gorges, short climbs, and sharp descents. The roads are bumpy and narrow. Stressful climbs, sharp turns, and bold descents took their toll on the riders—both physically and mentally. Grenoble, the start of the tough Alpine stages, was reached on July 14, Bastille Day and the only rest day of the Tour. At this point, after 15 stages, Barteau was still leading with a total elapsed time of 73 hours, 52 minutes, 19 seconds. Fignon had worked up to second place, 10 minutes, 13 seconds behind; Hinault was third, less than two minutes behind Fignon; LeMond was sixth and Kelly seventh, both a bit over 14 minutes behind the leader; and Millar had pulled up to ninth place. Barteau had held up far better than his two companions on the Cergy-Pontoise breakaway; Le Guilloux had dropped to thirty-third while Ferreira, totally defeated by the mountains, was running dead last in the field of 140 men remaining in the race.
The next five days in the Alps would answer many questions:
Could the young Barteau hold onto his lead? Could Hinault win a fifth victory? Could Fignon duplicate his win of the year before? How would the American LeMond make out? Would the Scot, Millar, or the Irishman, Kelly, be any real challenge to the leaders? Would any of the Colombians, known for their mountain racing, be a factor in this race?
First in the Alps was a 22-kilometer individual time trial, followed by daily climbs to L'Alpe-d'Huez, La Plagne, Morzine, and Crans-Montana Mountain in Switzerland. Fignon won the time trial easily; Herrera was second, Delgado third, and Hinault fourth.
The first climb was 151 kilometers; the second, 185 kilometers; the third, 186 kilometers; and the fourth, 140 kilometers. In the first mountain stage, Barteau was unseated from his first-place position. (He continued to slip and finally finished the Tour in 28th place, exactly one hour behind the leader.) By the end of the second of these mountain stages, it was clear that Fignon would win the race unless he was injured or did something very stupid. Hinault was running second, almost nine minutes behind Fignon, but it was clear that he could not close the gap. LeMond was third, just a little more than one minute behind Hinault, and Millar was just 20 seconds behind him.
As it turned out, these places did not change from the second Alps stage, the eighteenth stage of the race, to the end of the Tour. On the other hand, the mountains exacted a terrible toll from the rest of the pack. Delgado, a fast Spanish rider, got a puncture just before the Morzine finish line, crashed, broke his shoulder, and left the race. Tonon, an experienced Italian rider, hit a spectator who had wandered onto the road with his bike; both were rushed to a hospital by helicopter, Tonon with a fractured skull, the spectator with "grave injuries." In all, 16 riders were forced to retire from the race with injuries during these four stages.
The twenty-first stage was another long one—320 kilometers, from Crans-Montana to Villefranche-sur-Saône, across the Beaujolais wine country. The riders, exhausted from their days in the mountains, appealed to the race organizers to shorten the stage; they won a reduction, and the first 30 kilometers were covered in team cars.
Little was at stake during this stage and during the ten hot and dreary hours, the riders decided to clown a bit. Barteau pretended to read a newspaper, Castaing did a giant crossword puzzle, Brun turned his handlebars up like a casual Sunday rider, and the pack goaded Cabrera, a timid little Colombian, to win two of the bonus sprints. Kelly was not having any of it; while Cabrera was playfully being allowed to win his first sprint, Kelly was right behind him, gaining an eight-second reduction in his overall time. By the end of the day, Kelly had worked his way up from seventh place to fifth. Kelly, desperate for a stage victory, kept pressing on and eventually won a mock victory at the midpoint of the stage.
The next day was a 51-kilometer time trial, and Kelly, determined to earn the coveted stage victory, went all out to win. His time was a sensational 1 hour, 7 minutes, 9 seconds; Hinault was second, 36 seconds behind; and LeMond third, 41 seconds behind. Only Fignon, last to start, was still out on the road. He finished the race with a long sprint in the same time as Kelly; when the timers calculated the time to thousandths of a second, they gave the race to Fignon by 48/1000 seconds. Disappointed and frustrated, Kelly had no use for the condolences of other riders.
Later that day, July 21, the riders boarded a train for Paris. For all intents and purposes, the race was over, although there was one last 196-kilometer stage run around the suburbs of Paris that would pass the Arc de Triomphe six times before it swept down the Champs-Elysées to the finish line at the Place de la Concorde. This was a sprinter's stage, and it was won by Vanderaerden, with Jules, Hoste, Hinault, and Kelly following.
Finishers: 124 out of 170. First: Laurent Fignon. Second: Bernard Hinault. Third: Greg LeMond. Fourth: Robert Millar. Fifth: Sean Kelly. First Colombian finisher: Luis Herrera, twenty-seventh place. Leading climber (polka-dot jersey): Millar. Points leader (green jersey): Franck Hoste. Leading neophyte (white jersey): LeMond. Top team by time: Renault. Top team by points: Panasonic/Raleigh.
Months later, as the season came to a close, Hinault came back to win two prestigious one-day classics; Barteau, being in great demand, rode several six-day races; and Sean Kelly was awarded the Super Prestige Pernod trophy as the season's top-ranked professional bicyclist. LeMond left the Renault team and signed a $1 million contract with the La Vie Claire team. Three other teams disbanded. And riders mounted their exercise machines to wait for the start of the next season.
BIBLIOGRAPHY
Abt, Samuel. Breakaway: On the Road with the Tour de France. New York: Random House, 1985.
Leete, Harley M., ed. The Best of Bicycling! New York: Trident Press, 1970.
Walton, Bill and Rostaing, Bjarne. Bill Walton's Total Book of Bicycling. New York: Bantam Books, 1985.
THE PROGRAM
The Tour de France program consists of a main program (with five sections and five associated subroutines), two introductory sections (with five associated subroutines), a closing section, and five utility subroutines.
In the introductory section (Lines 100–220), the title screen is displayed followed by a screen of instructions. While this screen is being displayed, data are read in subroutines at Lines 1430, 3050, and 3300. After all the data have been read, you are instructed to "Press any key to continue," and program execution proceeds.
In the pre-race data section (Lines 240–510), you are asked to enter information about your physical fitness, practice time, the amount of pedaling help you want from the computer, and the timing loop value for your computer. This last item is unique to this program and is needed for the pedaling routine.
Tour de France contains a pedaling subroutine (Lines 2890–3030) that simulates in an interesting way the actual pedaling of a bicycle. Specifically, it asks you to alternately press two keys (representing the two pedals on a bike). The program counts the number of keystrokes you make in a given period of time and computes a revolutions per minute (rpm) value. To pedal an actual bike, you must use both feet; so it is with the program:
2960 K = 0 : FOR I = 1 TO PT * PTM 2970 A$ = INKEY$ : IF LEN(A$) = 0 OR A$ = B$ THEN 2990 2980 IF A$ = LF$ OR A$ = RT$ THEN K = K + 1 : B$ = A$ 2990 NEXT I
In the routine, you pedal for a certain amount of time (PT * PTM), which will be discussed later. The INKEY$ function polls the keyboard. If there has been no keystroke, the length of A$ is 0 and the routine goes to the next I. Also, if the current keystroke is the same as the previous one (A$ = B$)—two pushes with the left foot or two with the right—the routine continues and does not count that keystroke. The routine then tests (Line 2980) whether the keystroke is the same as one of the two pedals (LF$, RT$); if so, it is counted as one keystroke (K = K + 1). The value of A$ is then put into B$ and it becomes the previous keystroke.
The length of the timing loop (PT * PTM) consists of a fundamental pedaling-time (PT) value for your computer times a pedal-time multiplier (PTM). Variable PT will be different for different processor speeds. For example, a standard IBM PC (or clone) may be able to execute this routine 2000 times in ten seconds, whereas a Tandy 2000 or IBM PC AT may be able to execute it 3600 times. However, it is desirable for you to have the same amount of time to 'pedal' on the keyboard no matter what computer you are using. Hence, PT is a function of your computer and BASIC interpreter. (For a standard PC or clone, the value of PT should be about 2150.) The value of PT need be calculated only once (Lines 2820–2870). It is set equal to twice the number of times the computer executes a rather simple loop in 20 seconds. The real time (in seconds) is equal to:
60 * VAL(MID$(TIME$, 4, 2)) + VAL(RIGHT$(TIME$, 2))
The real time is always available in the string variable TIME$. For readability, colons are automatically inserted in this string between the hours, minutes, and seconds, so it returns string values such as 14:35:12 or 10:09:00. The right-hand part of the above expression takes the number of seconds and converts it to a numeric value. The left-hand part takes a string of two numbers starting with the fourth character of the string (minutes) and converts it to a numeric value, which is multiplied by 60 to get the number of seconds.
This loop is run until the current time is equal to the starting time plus 20 seconds. On an IBM PC, the loop is executed about 54 times per second. Thus, running it for a shorter time than 20 seconds leads to somewhat erratic values because the loop may start at any time within the initial second (1/100 to 99/100). Running it for 20 seconds means that the value of PT will be between, say, 2100 and 2200, that is, approximately plus or minus 2.5% of the exact value, a tolerable range for pedaling time.
The pedal-time multiplier is normally equal to one. However, if you elect to do a very long sprint (Lines 1000–1100), PTM could be as high as five, which leads to a very long and exhausting pedaling time.
The routine to select the gear range (Lines 620–830) is straightforward. If you select a gear range that is too high for the terrain, you will have to shift much more than you should, and appropriate penalties are accessed in Lines 820 and 830. In addition, using a gear range that is too high in the mountains increases physical exertion and the risk of collapse. Line 920 tests for these conditions and, if they exist, increases the probability of physical collapse by ten percentage points (from 11% to 21%). If nothing happens, probabilities are returned to normal in Line 940.
In the sprint routine (Lines 1000–1100), a counter, which counts down in 0.1-kilometer increments starting 10 km from the end of the race, is started (Line 1040). Pressing any key interrupts this countdown, and your sprint starts. Note that the countdown values overprint themselves (Line 1050) with the value at which you interrupt the loop being held on the screen.
Daily elapsed times for five other riders are calculated in Lines 1160 to 1180. The program assumes they are all in excellent physical condition and that they use the correct gear for the terrain. They have their share of delay-causing problems (1.4 * RND(1)) which tend to be in the same range as your delay time.
Event probabilities (Lines 1430–1490) are handled in the same generalized way as in the Marco Polo program, the difference being that Tour de France has three different sets of events: road hazards, mechanical breakdowns, and physical problems. Each of these sets of events has its own subroutine. Various events cause delays of between 0.1 hours (6 minutes) and 1 hour (physical collapse, assuming you recover). A few "events" are simply informative and cause no delay: a nice day in the French countryside, bicycle running like a charm, and feeling fit as a fiddle.
All the other subroutines either are straightforward and self-explanatory or are explained in the program notes for other programs.
PROGRAM VARIABLES
A Answer to input query, numeric
A$ Answer to input query, string
B$ Temporary string variable
CG Teeth on cog
CL Physical-collapse indicator
CR Crash indicator
DAY Day of race
DIST(d) Distance to cover (d = day)
DSP Distance of sprint
EN End time for timing loop
FIT Physical-fitness factor (.1 = poor, .5 = excellent)
GDGR Good gear indicator (0 = poor, 1 = good)
GQ Gear ratio x distance (for calculating performance of other riders)
GR Gear ratio
I Temporary iteration variable
K Temporary iteration variable
KPH Speed over route
KSR Speed of sprint
LF$ Left-pedal key
PAUSE Temporary iteration variable
PD Pedal indicator
PFRQ Pedaling frequency (1 = low, 10 = high)
PLACE$(d) Destination for day (d = day)
PM(n) Probability of mechanical problem (n = problem no.)
PMT Total probabilities of all mechanical problems
PP(n) Probability of physical problem (n = problem no.)
PPT Total probabilities of all physical problems
PR(n) Probability of road hazard (n = hazard no.)
PRT Total probabilities of all road hazards
PT Pedaling time
PTM Pedaling-time multiplier
RN Random number
RNG Teeth on ring gear
RPM Pedal speed
RPS RPM-speed multiplier
RT$ Right-pedal key
TDEP Time of departure
TDL Time for delays
TMSD Time to ride sprint distance
TMRD Time to ride route distance
TTM(r) Total time for stage (r = rider)
TTR(r) Total time for race to date (r = rider)
TTS Total stage time, leader
TTT Total race time, leader
TYPE(d) Type of terrain (d = day)
TYPE$(t) Type of terrain, description
WK Weeks of practice
WS Winner of stage
WSG(r) Stages won by each rider (r = rider)
WT Winner of race to date
X$ Temporary string variable
Note: Distances are in kilometers
Times in hours and fractions
Speeds in kilometers per hour
PROGRAM LISTINGS
Download TOUR.BAS (tokenized BASIC format)
100 CLS : KEY OFF
110 LOCATE 10, 1 : X$ = "Tour de France Bicycle Race" : GOSUB 3470
120 LOCATE 13, 1 : X$ = "(c) David H. Ahl, 1986" : GOSUB 3470
130 LOCATE 23, 1 : X$ = "Press any key to continue." : GOSUB 3470
140 WHILE LEN(INKEY$) = 0 : RN = RN + 1 : WEND
150 CLS : GOSUB 3500 : 'Display initial scenario
160 DIM PLACE$(23), TYPE(23), DIST(23), PP(14)
170 GDGR = 1 : PLACE$(0) = "Reims"
180 GOSUB 1430 : 'Read event probabilities
190 GOSUB 3050 : GOSUB 3300 : 'Read data about places
200 LOCATE 23, 1 : X$ = "Press any key to continue." : GOSUB 3470
210 WHILE LEN(INKEY$) = 0 : RN = RN + 1 : WEND
220 WHILE RN > 32767 : RN = RN - 65535! : WEND : RANDOMIZE RN : CLS
230 '
240 'Enter pre - race data
250 INPUT "Do you have the timing loop value from a previous run";A$
260 GOSUB 3350 : IF A$ = "N" THEN 290
270 INPUT "Please enter the value";PT : IF PT > 500 AND PT < 5000 THEN 300
280 INPUT "That doesn't sound right. Please enter it again";PT : GOTO 300
290 GOSUB 2820 : 'Calculate pedaling time (takes 20 seconds)
300 PRINT : PRINT "About your physical fitness: are you (1) in fantastic health,"
310 PRINT " (2) excellent shape, (3) quite good, (4) okay, (5) poor"
320 INPUT " Please enter a number between 1 and 5";A
330 IF A < 1 OR A > 5 THEN PRINT "Huh? I don't understand." : GOTO 320
340 FIT = .57 - .04 * A : 'Physical fitness factor
350 PRINT "How many weeks do you intend to take off from work or school to"
360 INPUT "practice and prepare for the race";WK : IF WK > 12 THEN WK = 12
370 IF WK > 5 THEN 390 ELSE PRINT "You must be joking. You'll need at least six"
380 PRINT "weeks if you want to be a real contender. Now…" : GOTO 350
390 FIT = FIT - (12 - WK) * .05 : 'Modify fitness factor for amount of practice
400 GOSUB 2760 : 'Assign keys to pedals
410 PRINT "Thank you. Let's go out for a practice run."
420 PFRQ = 10 : PTM = 1 : GOSUB 2890 : PD = 0 : PRINT : 'Pedal bicycle
430 PRINT "In an upper-middle gear ratio (52 / 17)," RPM "rpm would translate"
440 PRINT "to a speed of approximately" INT(.3956 * RPM + .5) "kilometers per hour."
450 IF RPM > 60 THEN 480 ELSE PRINT "That speed is barely competitive. Next time"
460 PRINT "you play, try a timing-loop value of" INT(80 * PT / RPM) "but for now"
470 PRINT "you may want to have the computer do most of the pedaling."
480 PRINT : PRINT "How much do you want to pedal your bike (on the keyboard)?"
490 PRINT "1 = hardly at all, 3 = occasionally, 7 = frequently, 10 = every opportunity"
500 INPUT "Please enter a number between 1 and 10";PFRQ : IF PFRQ < 1 THEN PFRQ = 1
510 IF PFRQ > 10 THEN PFRQ = 10
520 '
530 'Beginning of main riding section
540 DAY = DAY + 1
550 PRINT : PRINT "Date : July" DAY " You are at " PLACE$(DAY - 1) "."
560 IF TYPE(DAY) < 5 THEN 580
570 PRINT "Today, thank goodness, is a rest and recuperation day." : GOTO 540
580 PRINT "Your destination is " PLACE$(DAY) "," DIST(DAY) "km from here."
590 PRINT "Type of racing this stage:" TYPE$(TYPE(DAY))
600 IF TYPE(DAY)< >TYPE(DAY - 1) THEN 650
610 '
620 'Select gear range
630 INPUT "Do you want a different basic gear range than yesterday";A$
640 GOSUB 3350 : IF A$ = "N" THEN 850 ELSE GDGR = 1
650 PRINT "Naturally you will shift gears, but what will be your basic gear"
660 INPUT "range (ring and cog) for the day. First the ring (40 or 52)";RNG
670 IF RNG = 40 OR RNG = 52 THEN 690 ELSE PRINT "You don't have that ring."
680 INPUT "Enter 40 or 52 please"; RNG : GOTO 670
690 INPUT "Which cog (13, 15, 17, 19, 21, 23, or 25)"; CG
700 IF CG = 13 OR CG = 15 OR CG = 17 OR CG = 19 OR CG = 21 OR CG = 23 OR CG = 25 THEN 720
710 PRINT "Sorry, you don't have that cog. Please try again." : GOTO 690
720 IF (CG = 13 AND RNG = 40) OR (CG = 25 AND RNG = 52) THEN 730 ELSE GR = RNG / CG : GOTO 750
730 PRINT "The chain line will be badly skewed with that combination."
740 PRINT "Let's do it again. First the ring. "; : GOTO 680
750 IF TYPE(DAY) = 4 THEN 850
760 IF GR > 3.2 THEN X$ = "high" ELSE IF GR < 1.8 THEN X$ = "low" ELSE GOTO 790
770 PRINT "That ratio sounds very " X$; : INPUT ". Do you want to change it";A$
780 GOSUB 3350 : IF A$ = "Y" THEN 740
790 IF TYPE(DAY) = 3 AND GR > 2.3 THEN 800 ELSE 830
800 PRINT "For mountainous terrain, that's a rather high basic gear ratio."
810 INPUT "Do you want to stick with it";A$ : GOSUB 3350 : IF A$ = "N" THEN 740
820 GDGR = 1.3 - .19 * GR : GOTO 840 : 'Penalty for too high gear ratio in mts
830 IF GR > 3 THEN GDGR = 1.35 - .14 * GR : 'Penalty for too high gear on flat route
840 '
850 'Start of stage
860 TDEP = 100 + INT(59 * RND(1))
870 PRINT "Your departure time is scheduled at 9 : "; : PRINT RIGHT$(STR$(TDEP), 2)
880 GOSUB 3440 : PTM = 1 : RPS = 130 : GOSUB 2890 : KPH = RPM * .1292706 * GR * GDGR
890 PRINT USING "##.#"; KPH; : PRINT " kph." : PRINT
900 TDL = 0 : GOSUB 1510 : 'Road hazards
910 CR = 0 : PRINT : GOSUB 1760 : 'Mechanical breakdowns
920 IF TYPE(DAY) = 3 AND GR > 2.7 THEN PP(1) = PP(1) + 10 : PPT = PPT + 10 : PPX = 1
930 PRINT : GOSUB 2140 : 'Physical problems
940 IF PPX = 1 THEN PPX = 0 : PP(1) = PP(1) - 10 : PPT = PPT - 10
950 PRINT : PRINT "Time for a quick breather. You have about";
960 PRINT INT(20 + 20 * RND(1)) "km to go."
970 PRINT "Press any key when you're ready to go."
980 WHILE LEN(INKEY$) = 0 : WEND : PRINT "Okay, on the road again…"
990 '
1000 'Sprint at end of stage
1010 GOSUB 3440 : PRINT : PRINT "You're coming up on 10 km from the end."
1020 PRINT "During the countdown (in 0.1-kilometer increments) you can"
1030 PRINT "press any key when you want to start your sprint." : GOSUB 3440
1040 PRINT : FOR DSP = 10 TO 0 STEP - .1 : 'Count down from 10km by 0.1 increments
1050 LOCATE 23, 10 : PRINT USING "##.#";DSP : IF LEN(INKEY$) > 0 THEN 1070
1060 NEXT DSP : KSR = 1 : GOTO 1090
1070 PTM = DSP / 2 : RPS = 140 : GOSUB 2890 : KSR = RPM * .396 : 'Sprint speed
1080 PRINT USING "##.#"; KSR; : PRINT " kph." : PRINT
1090 TMSD = DSP / KSR : TMRD = (DIST(DAY) - DSP) / KPH : TTM(1) = TMSD + TMRD + TDL
1100 IF DSP > 3 THEN PRINT "Puff…puff…puff. That was a L-O-N-G sprint!"
1110 '
1120 'Calculate top six riders
1130 PRINT : PRINT "Race summary (total times in hours) :"
1140 PRINT " Rider 1 (you) 2 3 4 5 6"
1150 TTS = TTM(1) : WS = 1 : PRINT "Stage time", : PRINT USING "#####.##"; TTM(1);
1160 IF TYPE(DAY) = 3 THEN GQ = .3 ELSE GQ = .4
1170 FOR I = 2 TO 6 : RPM = 70 + 20 * RND(1)
1180 TTM(I) = DIST(DAY) / (GQ * RPM) + 1.4 * RND(1) : PRINT USING "#####.##"; TTM(I);
1190 IF TTM(I) < TTS THEN TTS = TTM(I) : WS = I
1200 NEXT I
1210 TTT = 1000 : WT = 0 : PRINT : PRINT "Total time", : FOR I = 1 TO 6
1220 TTR(I) = TTR(I) + TTM(I) : PRINT USING "#####.##"; TTR(I);
1230 IF TTR(I) < TTT THEN TTT = TTR(I) : WT = I
1240 NEXT I : PRINT : PRINT
1250 PRINT " Stage winner : Rider" WS " Overall leader : Rider" WT
1260 WSG(WS) = WSG(WS) + 1
1270 IF DAY < 22 THEN 540
1280 '
1290 'End-of-race summary
1300 PRINT : PRINT "The Tour de France has ended!" : PRINT : X = 0
1310 FOR I = 1 TO 6 : IF WSG(I) > X THEN X = WSG(I) : WS = I
1320 NEXT I : PRINT "Winner of the most stages (" X ") was Rider" WS;
1330 IF WS = 1 THEN PRINT " That's YOU!" ELSE PRINT
1340 PRINT "Overall winner by elapsed time was Rider" WT;
1350 IF WT = 1 THEN PRINT " That's YOU!" ELSE PRINT
1360 TTT = 1000 : WT = 0 : FOR I = 1 TO 6
1370 IF TTR(I) - 2 * WSG(I) < TTT THEN TTT = TTR(I) - 2 * WSG(I) : WT = I
1380 NEXT I
1390 PRINT "Overall points winner (time and stages) was Rider" WT;
1400 IF WT = 1 THEN PRINT " That's YOU!" ELSE PRINT
1410 GOTO 2730
1420 '
1430 'Subroutine to read event probabilities
1440 FOR I = 1 TO 10 : READ A : PRT = PRT + A : PR(I) = PRT : NEXT I
1450 DATA 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
1460 FOR I = 1 TO 8 : READ A : PMT = PMT + A : PM(I) = PMT : NEXT I
1470 DATA 5, 5, 5, 5, 5, 5, 10, 5
1480 FOR I = 1 TO 14 : READ A : PPT = PPT + A : PP(I) = PPT : NEXT I : RETURN
1490 DATA 8, 5, 5, 5, 5, 5, 5, 5, 5, 8, 5, 5, 5, 3
1500 '
1510 'Subroutine to deal with road hazards
1520 RN = INT(PRT * RND(1)) : FOR I = 1 TO 10
1530 IF RN > PR(I) THEN NEXT I : I = 10 : 'If event happened, exit loop
1540 ON I GOTO 1550, 1570, 1590, 1610, 1630, 1650, 1670, 1690, 1720, 1740
1550 PRINT "Mostly gravel roads this stage. You'll have to slow down."
1560 TDL = TDL + .8 : RETURN
1570 PRINT "The roads in this area are very bumpy and will slow you down."
1580 TDL = TDL + .5 : RETURN
1590 PRINT "Hot weather in this area has caused the roads to become very"
1600 PRINT "slippery from oil seepage." : TDL = TDL + .3 : RETURN
1610 PRINT "The wind is at your back making for a very fast ride!"
1620 TDL = TDL + -.3 : RETURN
1630 PRINT "You're heading straight into the wind today. Tough going."
1640 TDL = TDL + .5 : RETURN
1650 PRINT "There is a gusty sidewind today creating balance problems."
1660 TDL = TDL + .3 : RETURN
1670 PRINT "Dreary day: drizzle, fog, and clammy chill in the air."
1680 TDL = TDL + .2 : RETURN
1690 PRINT "Horrible weather! Icy rain that hits you like 1000 needles,"
1700 PRINT "stinging your face and arms. Your shoes are soaked. And there"
1710 PRINT "are few spectators to cheer you on." : TDL = TDL + .5 : RETURN
1720 PRINT "Mud and puddles on the road cause you to slide and skid all over."
1730 TDL = TDL + .4 : RETURN
1740 PRINT "Today is a crisp, clear day in the French countryside." : RETURN
1750 '
1760 'Subroutine to deal with mechanical breakdowns
1770 RN = INT(PMT * RND(1)) : FOR I = 1 TO 8 : 'Select event
1780 IF RN > PM(I) THEN NEXT I : I = 8 : 'If event happened, exit loop
1790 ON I GOTO 1800, 1830, 1850, 1890, 1930, 1970, 1990, 2120
1800 INPUT "You have a broken spoke. Want to fix it now";A$ : GOSUB 3350
1810 IF A$ = "Y" THEN TDL = TDL + .1 ELSE TDL = TDL + .15
1820 RETURN
1830 PRINT "You got a flat tire. You'll have to change it now."
1840 TDL = TDL + .1 : RETURN
1850 PRINT "Your brakes tend to lock every time you apply them hard. You can"
1860 INPUT "nurse them along or fix them here. Want to fix them now";A$
1870 GOSUB 3350 : IF A$ = "Y" THEN TDL = TDL + .2 ELSE TDL = TDL + .4
1880 RETURN
1890 PRINT "You seem to be missing shifts to your 19 cog. Perhaps one or"
1900 PRINT "more teeth are worn. You can shift around it or fix it here."
1910 INPUT "Want to fix it now";A$ : GOSUB 3350 : IF A$ = "Y" THEN TDL = TDL + .2 : RETURN
1920 TDL = TDL + .4 : RETURN
1930 PRINT "On a tight corner, you narrowly missed a spill, but your toe clip"
1940 INPUT "got bent on a boulder near the road. Want to bend it out now";A$
1950 IF A$ = "Y" THEN TDL = TDL + .1 ELSE TDL = TDL + .2
1960 RETURN
1970 PRINT "Uh oh! Chain broke. You've no choice but to fix it now."
1980 TDL = TDL + .15 : RETURN
1990 PRINT "WHOOPS! Took a corner too fast, lost traction, slid, and CRASHED!"
2000 GOSUB 3440 : CR = 1 : RN = RND(1) : IF RN < .03 THEN 2080 ELSE IF RN < .5 THEN 2040
2010 PRINT "You pick up yourself and your bicycle. You're both"
2020 PRINT "scratched and a bit beaten up but there seems to be no"
2030 PRINT "serious damage so you get on your way." : TDL = TDL + .3 : RETURN
2040 PRINT "You twisted your ankle and it is very painful. You know it will"
2050 PRINT "slow you down. However, there is no way you would drop out of the"
2060 PRINT "race, so you pick up your bicycle and get on your way."
2070 TDL = TDL + .8 : RETURN
2080 PRINT "Blood is all over the place; ambulance is called and"
2090 PRINT "you are rushed to the local hospital." : GOSUB 3440
2100 PRINT "Bad news! You dislocated your shoulder and you're out of the race."
2110 GOTO 2700
2120 PRINT "Bicycle ran like a charm today. No problems at all!" : RETURN
2130 '
2140 'Subroutine to deal with physical problems
2150 RN = INT(PPT * RND(1)) : FOR I = 1 TO 14
2160 IF RN > PP(I) THEN NEXT I : I = 14 : 'If event happened, exit loop
2170 IF I > 10 THEN 2190
2180 ON I GOTO 2200, 2320, 2340, 2370, 2390, 2420, 2440, 2470, 2500, 2530
2190 ON I - 10 GOTO 2560, 2600, 2640, 2660
2200 X = INT(DIST(DAY) / 50) : IF X < 2 THEN X = 2
2210 PRINT "You're pushing yourself to the absolute limit and after" X "hours"
2220 PRINT "you totally collapse. The medics give you oxygen and bring you"
2230 PRINT "around, but warn you against resuming the race." : IF CL > 0 THEN 2290
2240 CL = 1 : IF RND(1) > .8 THEN 2270
2250 GOSUB 3440 : PRINT "But nothing can defeat your competitive spirit and you"
2260 PRINT "vow to press on regardless." : TDL = TDL + 1 : RETURN
2270 GOSUB 3440 : PRINT "You heard of another rider dying from overexertion last"
2280 PRINT "year, so you follow the doctor's advice and withdraw." : GOTO 2700
2290 GOSUB 3440 : PRINT "This is the second time you collapsed in this race,"
2300 PRINT "so you reluctantly concede that this just isn't your year"
2310 PRINT "and you withdraw from the race." : GOTO 2700
2320 PRINT "You have a terrible abdominal pain…something you ate, perhaps?"
2330 PRINT "You'll have to slow down a bit." : TDL = TDL + .4 : RETURN
2340 PRINT "You're having difficulty breathing and you're feeling lightheaded."
2350 PRINT "You recognize this as an early warning signal of total collapse"
2360 PRINT "and wisely decide to slow your pace a bit." : TDL = TDL + .3 : RETURN
2370 PRINT "You seem to be seeing through a haze…and it's not the weather."
2380 PRINT "Occasionally, you can't seem to focus at all." : GOTO 2350
2390 PRINT "Uh oh! A muscle in your calf seems to have turned to jelly. It's"
2400 PRINT "not particularly painful, but it seems to be completely out of"
2410 PRINT "control. You'll have to slow down a bit." : TDL = TDL + .3 : RETURN
2420 PRINT "You have a sharp pain in your lower back. It doesn't seem to be"
2430 PRINT "injured…perhaps you're just overly tense." : TDL = TDL + .2 : RETURN
2440 PRINT "The gearing you've been using is really tough on your legs and"
2450 PRINT "you have developed shin splints. You'll have to back off your"
2460 PRINT "blistering pace a bit." : TDL = TDL + .3 : RETURN
2470 PRINT "Terrible pain in the balls of your feet. Your toe clip seems to be"
2480 PRINT "adjusted correctly. Maybe it's these new cleats. In any event,"
2490 PRINT "you decide to back off a bit…just for today." : TDL = TDL + .3 : RETURN
2500 PRINT "A medic takes a look at you during lunch break and declares you"
2510 PRINT "have a salt/water imbalance. 'Drink more water along the way,'"
2520 PRINT "he recommends, 'and don't forget your salt pills.'" : RETURN
2530 IF TYPE< >3 THEN 2660
2540 PRINT "The altitude is getting to you in the mountains. You're short of"
2550 PRINT "breath and you feel lightheaded. : goto 2445
2560 PRINT "Your saddle feels like it has appended itself to your body. A cyst"
2570 PRINT "seems to be starting, something you want to avoid at all costs."
2580 PRINT "You put some extra padding on the saddle and back off on your"
2590 PRINT "pace just a tad." : TDL = TDL + .15 : RETURN
2600 PRINT "The blistering pace you've been keeping has played havoc with your"
2610 PRINT "knees. You've heard of football players with bad knees, but a"
2620 PRINT "bicycle racer? Nevertheless, you'll have to slow down a bit."
2630 TDL = TDL + .2 : RETURN
2640 PRINT "You developed a bad cramp in your legs. You'll have to take it"
2650 PRINT "just a bit easier." : TDL = TDL + .15 : RETURN
2660 IF CR = 1 THEN 2150 : 'Can't feel too great after a crash
2670 PRINT "You're feeling fit as a fiddle and have no physical problems today."
2680 RETURN
2690 '
2700 'It's all over
2710 PRINT : PRINT "Too bad. That's it for this year, but there's always"
2720 PRINT "next year...."
2730 PRINT : INPUT "Would you like to ride again";A$ : GOSUB 3350
2740 IF A$ = "Y" THEN RUN ELSE KEY ON : CLS : PRINT "Bye for now." : END
2750 '
2760 'Subroutine to assign keys to pedals
2770 PRINT "To pedal your computer bike, you will strike two keys alternately"
2780 PRINT "With two fingers (one hand or two, it's up to you)."
2790 INPUT "Which key do you want for your left pedal";LF$
2800 INPUT "and which key for the right";RT$ : RETURN
2810 '
2820 'Subroutine to calculate time to pedal as a function of processor speed
2830 PRINT "Calculating timing-loop value takes 20 seconds. Please be patient."
2840 PRINT : EN = 20 + 60 * VAL(MID$(TIME$, 4, 2)) + VAL(RIGHT$(TIME$, 2))
2850 WHILE 60 * VAL(MID$(TIME$, 4, 2)) + VAL(RIGHT$(TIME$, 2)) < EN : PT = PT + 1 : WEND
2860 PT = PT * 2 : PRINT "The timing-loop value for your computer is"PT
2870 PRINT "Please write it down for playing this game in the future." : RETURN
2880 '
2890 'Subroutine to pedal bicycle
2900 IF DAY = 8 AND PD = 0 THEN 2950 : 'Must get at least one chance to pedal
2910 IF DAY = 17 AND PD = 1 THEN 2950 : 'Second chance to pedal
2920 IF PFRQ >= 9.92 * RND(1) THEN PD = PD + 1 : GOTO 2950 : 'Human pedal bike?
2930 RPM = INT((RPS + 40 * RND(1)) * FIT) : PRINT "Computer is pedaling your bicycle."
2940 GOSUB 3440 : X$ = "It" : GOTO 3020
2950 PRINT "Start pedaling"; : GOSUB 3440 : PRINT " NOW!" : PRINT
2960 K = 0 : FOR I = 1 TO PT * PTM
2970 A$ = INKEY$ : IF LEN(A$) = 0 OR A$ = B$ THEN 2990
2980 IF A$ = LF$ OR A$ = RT$ THEN K = K + 1 : B$ = A$
2990 NEXT I
3000 PRINT "Okay, stop pedaling." : RPM = INT(.9 * FIT * K / PTM) : X$ = "You"
3010 IF RPM > 95 THEN RPM = INT(84 + 10 * RND(1))
3020 PRINT X$ " pedaled at a rate of" RPM "rpm. Calculating speed....";
3030 A$ = "" : FOR I = 1 TO 800 : B$ = INKEY$ : NEXT I : RETURN
3040 '
3050 'Subroutine to read data about routes
3060 FOR I = 1 TO 22 : READ N, PLACE$(I), TYPE(I), DIST(I) : NEXT I : RETURN
3070 DATA 1, "Lille", 1, 213
3080 DATA 2, "Arras", 4, 52
3090 DATA 3, "Caen", 1, 308
3100 DATA 4, "Le Mans", 1, 172
3110 DATA 5, "Nantes", 1, 192
3120 DATA 6, "Bordeaux", 1, 338
3130 DATA 7, "Biarritz/Bayonne", 1, 184
3140 DATA 8, "Lourdes", 3, 168
3150 DATA 9, "Lourdes", 5, 0
3160 DATA 10, "Toulouse", 2, 172
3170 DATA 11, "Rodez", 2, 176
3180 DATA 12, "Avignon", 2, 294
3190 DATA 13, "Grenoble", 2, 228
3200 DATA 14, "l'Alpe-d'Huez", 4, 39
3210 DATA 15, "Lansleburg", 3, 225
3220 DATA 16, "Martigny, Switzerland", 3, 230
3230 DATA 17, "Annecy", 3, 218
3240 DATA 18, "Annecy", 5, 0
3250 DATA 19, "Lyon", 2, 182
3260 DATA 20, "Dijon", 1, 212
3270 DATA 21, "Fountainbleau", 1, 259
3280 DATA 22, "Paris", 1, 210
3290 '
3300 'Subroutine to read words
3310 FOR I = 1 TO 5 : READ TYPE$(I) : NEXT I : RETURN
3320 DATA "Mostly flat with small hills.", "Hills, gorges, steep slopes."
3330 DATA "Mountains." ,"Time trial against the clock.", "Rest."
3340 '
3350 'Subroutine to read yes/no answer
3360 GOSUB 3390 : IF A$ = "Y" OR A$ = "N" THEN RETURN
3370 INPUT "Don't understand your answer. Enter 'Y' or 'N' please";A$ : GOTO 3360
3380 '
3390 'Subroutine to read first letter of answer and convert to uppercase
3400 IF A$ = "" THEN A$ = "Y" : RETURN
3410 A$ = LEFT$(A$, 1) : IF A$ >= "A" AND A$ <= "Z" THEN RETURN
3420 A$ = CHR$(ASC(A$) - 32) : RETURN
3430 '
3440 'Subroutine to make a short pause
3450 FOR PAUSE = 1 TO 300 : X = X + 1 : NEXT PAUSE : RETURN
3460 '
3470 'Subroutine to print a centered line
3480 PRINT TAB((70 - LEN(X$)) / 2) X$ : RETURN
3490 '
3500 'Subroutine to display initial scenario
3510 X$ = "Tour de France Bicycle Race" : GOSUB 3470 : PRINT
3520 PRINT " You are a bicycle racer entered in the 22-day Tour de France"
3530 PRINT "bicycle race around France. Your objective is to win the race by"
3540 PRINT "having the lowest overall elapsed time. In addition, you must try"
3550 PRINT "to win as many individual 'stages' or daily races as possible, as"
3560 PRINT "wins on these stages count toward the overall points prize."
3570 PRINT " Each day you pedal your bicycle by alternately pressing two"
3580 PRINT "keys on your computer keyboard as quickly as possible (you may opt"
3590 PRINT "to have the computer do some of the pedaling for you)."
3600 PRINT " While racing, various hazards occur (weather, mechanical"
3610 PRINT "breakdowns, road conditions, and physical problems) that hamper"
3620 PRINT "your progress."
3630 PRINT " At the end of each stage (day), you may sprint to the finish"
3640 PRINT "line. The computer will count down the distance starting ten"
3650 PRINT "kilometers from the end of the race. During this countdown, you"
3660 PRINT "must decide when to start your sprint. Remember, if you start too"
3670 PRINT "soon, you may become too exhausted to maintain your sprint to the"
3680 PRINT "end, but if you start too late, other riders may overtake you."
3690 RETURN
Return to Table of Contents | Previous Section | Next Section