file GRIDLOCK.TXT ================================================================ INSTRUCTIONS FOR GRIDLOCK ================================================================ Fred Lee CONTENTS INTRODUCTION ........................ 1 COMPUTER REQUIREMENTS ............... 2 THE FILES ........................... 3 STARTING THE PROGRAM ................ 3 YOUR SECTOR OF THE CITY ............. 4 MAIN MENU ........................... 4 Quit without saving (7) .......... 5 Quit this program (6) ............ 5 Turn sound off (5) ............... 5 Clear things (4) ................. 5 SET INTERSECTIONS (1) ............... 6 Type ............................. 7 Phase ............................ 8 Slave light ...................... 8 Slave delay ...................... 9 Demand ........................... 9 Normal-time demo ................. 9 Copying intersections ............ 9 Paper work ....................... 10 PLAN A TRIP (2) ..................... 11 RUN (3) ............................. 12 Traffic .......................... 12 Day or night ..................... 12 Mall lights ...................... 12 Running .......................... 13 Accidents ........................ 14 Speed ............................ 14 Time clock ....................... 15 Test cars ........................ 16 HOW THE CARS BEHAVE ................. 16 HINTS ............................... 18 Re-starting the RUN mode ......... 18 Car-speed facts .................. 18 Synchronizing .................... 18 CONCLUSION .......................... 19 INTRODUCTION Did you ever think, when you were out there driving in the traffic, that you could set the traffic lights much better than the clowns who are paid to do the job? You probably think that your parakeet could do it better. Well, here's a chance to see what you can do. GRIDLOCK gives you a whole section of town, the Morass district in the great metropolis of Quagmeyer City, PU, with lots of cars driving around in it. You can decide what kind of lights or stop signs to put at what intersections and you get to set the lengths of the cycles. Your district consists of some eleven avenues crossed by twelve streets and one expressway. (There is a common misconception that it's called an expressway because you can zip along on it at high speed and not have to stop at a lot of red lights. So when you find yourself poking along it in bumper-to-bumper traffic and being stopped - maybe two or three times - at every intersection, you tend to invent all sorts of new ways to express your feelings. And that's why it's called an expressway. On a good day, you can see thousands of drivers all in a row muttering a fantastic variety of expressions.) You can look at the game in two ways. You can try to design systems that will make traffic flow as smoothly and quickly as possible. Or, if you think that you might want to apply for a job with your city's Department of Setting Traffic Lights, you can practice setting lights in such a way that every car will get to every intersection just as the light turns red and just generally foul up the traffic and achieve - - - gridlock. There are two ways to measure your success or failure as a traffic designer. One way is to see whether you can get maximum (100%) traffic to flow without getting hopelessly blocked intersections, accidents, and police cars out in force. That isn't easy to do. Even if you succeed for a while, sooner or later, something could go wrong. Maybe a more realistic test would be to see how long you can run at maximum traffic before something bad happens. The other way to measure your success is to see how long it takes for one of your test cars to go from point A to B under different traffic conditions. You can try your ideas on the normal traffic in your sector. The computer controls these cars. The only thing you can control is the number of cars that are driving around. There are also two special cars, called test cars, that you CAN control. You 1 get to program their routes and the computer times their trips for you. The test cars are your only means of accurately comparing different systems. That is, of course, by running the same test routes with the different systems of traffic controls and seeing which take more time. (The computer automatically generates appropriate expressions for the drivers of the test cars to mutter. But due to certain regulations, they cannot be put on the screen or printed out.) Being a computer simulation, this town is not a hundred percent realistic. Unlike yourself, the cars obey the speed limit. They don't try to beat the red light the way you would. They do sometimes make left turns on yellow lights, though. Especially if they have been prevented by oncoming traffic from turning when the light was green. There are no pedestrians. So there are none of those buttons that slow down a light so that even a very old lady on crutches can make it across and have time to get home, cook herself a cup of tea, and drink it before the light comes back to life. Of course, with no pedestrians, there is no way of hitting one. Sorry about that. But cars can occasionally hit each other. The program is run from menus and most things that you have to do are explained right on the screen so that you should be able to blunder your way along. For the three of you who actually read instructions, the following pages give you more detail than you get on the screen. The traffic in GRIDLOCK drives on the right side of the road. That means the game would not be useful in, say, England, where, as the great writer Dave Barry reports, they drive on both sides. Ironically, it will also not be popular in Japan where most of our cars are made. COMPUTER REQUIREMENTS To run GRIDLOCK takes an IBM (or compatible) computer with at least 512K of RAM and EGA or VGA color graphics. Computers with clock speeds of over 16 MHz run the program at full speed. Below that speed, as speeds drop lower, the action slows down. The slow-down is hardly noticeable at 12.5 MHz. Below that speed it becomes more and more apparent. 2 THE FILES The GRIDLOCK disk holds the following disks: README The first thing you should read GL.EXE The main gridlock program file GRIDLOCK.RTS Stores car routes GRIDLOCK.DAT Stores all traffic conditions GRIDLOCK.DOC This instruction file (ASCII text) The .RTS, .DAT, and .EXE files must be on the same disk drive when the program file GL.EXE is being run. STARTING THE PROGRAM The GRIDLOCK program is in the file GL.EXE. It can be run from the hard disk or a floppy. The data files GRIDLOCK.RTS and GRIDLOCK.DAT must be on the same drive as the .EXE file. To run, get the prompt of the drive you want to use and enter GL. That starts the program which then reads the two data files. One of these, .DAT, stores the conditions and settings that were in use the last time the program was run and was terminated with option 6 (Quit this program) of the main menu. That allows you to continue the program as it was when you left it. If you don't want to continue the program as it was when you left it, start the program by entering GL SKIP instead of GL. That causes the program to skip the reading of GRIDLOCK.DAT so that the conditions such as traffic light settings and cars on the road will all be cleared when the program starts. This way of starting takes less time. If you want to save a number of your solutions to the traffic problem, one way to do it is to start each time with a fresh diskette that contains the .EXE, .RTS, and .DAT files. When you have finished, put the entire diskette away (after labeling it appropriately) and use a new disk for the next solution. Another way is, when you have finished one solution and quit the program with option 6 of the main menu (the one that saves the conditions in the file GRIDLOCK.DAT), to copy the file GRIDLOCK.DAT to a file with some other name (for example, GRIDDATA.001). Then the next time you want to play with this solution, copy it back to the file GRIDLOCK.DAT before starting the program. 3 YOUR SECTOR OF THE CITY Figure 1 at the back of these instructions is a crude map of the Morass district of the city. (You might make copies of this map or the much better map that you get when you pay for the program. The copies can be used to keep paper records of your traffic light systems or your test routes. And it might be easier to design your systems and your test car routes on paper before entering them on the computer.) There are twelve streets running east and west. They are named A Street to L Street. Between K and L streets there is an expressway labeled X. Running north and south are eleven avenues named 1st Avenue to 11th Avenue. There is a mall and a park. Roads run into them but do not run through them. Each intersection is marked with an x. note that there are only three intersections on the street X, the expressway. The other crossings on the expressway are underpasses. The numbers at the top and the right of the map show the number of lanes in each road. If there is an odd number of lanes, the center lane is used for left turns only. MAIN MENU The first menu you will see is the main menu. You can return to this menu from any point in the program by pushing the F1 key. (You might have to push F1 more than once if you are more than one menu away from the main menu.) The Esc key also gets the main menu. The main menu looks like this: MAIN MENU 1 SET INTERSECTIONS 2 PLAN A TRIP 3 RUN 4 Clear things 5 Turn sound off 6 Quit this program 7 Quit without saving 4 The first three choices are the main activities. That's why they are capitalized. They will be explained in the next three chapters. The other choices are the supporting activities which will be explained in this chapter. But they are easier to explain if we start at the end and work backward. Quit without saving (7) Quit without saving lets you quit the program without putting the current traffic, traffic light settings, and test car routes onto the disk (the file GRIDLOCK.DAT). So the next time you start the program, it will start with any conditions that you had previously saved on the disk. If you don't care one way or the other, this is the faster way to quit. Quit this program (6) Quit this program lets you quit the program AND save the current traffic, traffic light settings, and test car routes on the disk (in the file GRIDLOCK.DAT). So next time you start the program, it will be as though you are continuing exactly where you left off when you quit. Turn sound off (5) Turn sound off lets you turn off the occasional beeps that the program produces. The menu will then say "Turn sound on" and you can turn sound on again. Clear things (4) Clear things lets you clear anything that you might want to clear. If you select this choice, you get the following menu: 1 Clear green test car route 2 Clear magenta test car route 3 Clear traffic light settings 4 Clear traffic from streets 5 Return to main menu Whatever you clear with these selections will be cleared when you return to the RUN mode of the program. But the conditions stored on the disk will not be affected. If you want to clear what is stored on the disk also, you have to do your clearing and then quit the program using selection 6 of the main program. (There is also a way to start the program with all of these conditions cleared even if they are not cleared on the disk. Instead of entering GL to start the program, enter GL SKIP. That tells the computer to skip the reading of the disk file GRIDLOCK.DAT.) Now for the explanations of the three main choices of the main menu. 5 SET INTERSECTIONS (1) This first item of the main menu lets you decide what kind of controls to put at each intersection and to set the timing. Of course, these choices depend on how much traffic the intersection has to handle. That depends somewhat on the width of the streets but also on which part of town they are in. You should put the program into the RUN mode and watch the traffic until you see where it normally flows and where it is the heaviest. It is a little harder to learn, by watching, where the most left turns are made so that you can decide on what kind of turning lights to put. Table 1 at the end of these instructions can be helpful there. It lists the numbers of left turns made at all intersections by a sample of 200 car trips. The turns are listed by the directions that the cars were driving before the turns. Those who pay for the program will get a map with these numbers on it. It is much easier to use than Table 1. If you watch the traffic for a while, you will see how cars behave at intersections that have no traffic controls at all. Cars on a smaller road approaching a bigger one will tend to wait until it's clear before crossing. The cars on the bigger road will take the right-of-way. If the roads are of equal size, where there are more cars waiting, they will tend to go first. Turning cars go pretty much when they can. Since the cars are not controlled, there is a small chance of an accident at these intersections. The first screen you see in this SET INTERSECTIONS mode asks you to select an intersection by typing first the number of the avenue and then the letter of the street. (You will notice that the computer does an annoying little hesitation before it responds when you type a 1. That's because it wants to be sure whether you are just entering a 1 or trying to enter a 10 or an 11. So if you are entering 10 or 11, enter the second digit without waiting for the computer to respond to the first. If you are entering a 1, be patient. The computer will realize it in a second or so.) The next screen then shows a square in which you can make your selections. To the right of the square is a picture of the intersection drawn in such a way that you can see the number of lanes in each road. This picture will illustrate the traffic lights and the traffic flow as you make your selections. The selections you can make are as follows: 6 Type You can select one of the ten types on the table shown below. Don't worry about having to remember all of those many types and phases. The computer will illustrate them for you while you are setting them. Type Phase Description ---- ----- --------------------------------------- 0 No stop signs or lights 1 Stop signs for N and S directions 2 Stop signs for E and W directions 3 Stop signs for all four directions 4 1 N and S green lights (turns ok if clear)# 2 E and W green lights (turns ok if clear)# 5 1 N green and N left-turn lights 2 S green and S left-turn lights 3 E and W green lights (turns ok if clear)# 6 1 N and S green lights (turns ok if clear)# 2 W green and W left-turn lights 3 E green and E left-turn lights 7 1 N green and N left-turn lights 2 S green and S left-turn lights 3* E left-turn and W left-turn lights # 4 E and W green lights (no turns) 8 1* N left-turn and S left-turn lights # 2 N and S green lights (no turns) 3 W green and W left-turn lights 4 E green and E left-turn lights 9 1* N left-turn and S left-turn lights # 2 N and S green lights (no turns) 3* E left-turn and W left-turn lights # 4 E and W green lights (no turns) * Only if there is demand for the lights # Turns continue through 2/3 of yellow light A more graphic chart of these types will be sent to you if you buy this program. It makes things much clearer. 7 After you select the type, the cursor does not automatically advance to the next item as it does for the other selections. That allows you to watch the picture at the right of the screen demonstrate the "type" you have selected and, if you aren't happy with that type, lets you change it any number of times without having to move the cursor back each time. When you are ready to continue, push Tab or PgDn to move the cursor. (PgUp moves it up.) The computer then puts into the square the other items and settings that are appropriate for that particular type. Phase Next, you can assign the number of seconds that the green light will stay on in each of the phases. Move the cursor to the phase that you want to change. Note that the picture on the right now illustrates the traffic flow at only this particular phase. Type a number and push ENTER. The computer automatically puts a three-second yellow light after each green light. Be sure to take that into account when you calculate the total time of the cycle. (When you calculate how much time to allow for left turns, don't forget that, in certain phases, turns continue to be made for two seconds or so after the light turns yellow.) Slave light You can use this item to synchronize lights. Any other intersection that you designate here will become a slave and this one (the one you are now programming) becomes the master. That means that the slave intersection will be made to start its first phase when the master starts its first phase. Of course, it's best to program the phases of the two intersections to be the same. At least the total time of all of their phases should be the same. (When calculating the total time, don't forget to add a three-second yellow light after each phase.) If you want to synchronize more than two intersections, the second one must be programmed to be the master of the third, the third must control the fourth, and so on. It is best (but not absolutely necessary) that a slave intersection be to the east (right) and/or south (below) a master. If you don't synchronize intersections, the computer purposely distributes the starting times of their cycles randomly. If you want to introduce even more randomness, you can, of course, program the total cycle-times of lights to be different. 8 Slave delay Any number you put here will be the number of seconds by which the slave intersection lags the master. For example, if you enter a 10, the slave intersection will be made to start its first phase ten seconds after the master starts its firs phase. If you leave this item at zero, the lights should switch simultaneously. Demand This is a 'yes or no' choice. If you say 'yes' here, a green light will be terminated if there is no more demand for it and there is demand in other directions. (If you are wondering how the light senses the presence of cars, notice that there occasionally are gray lines across the roads. Those are car sensors.) Since the demand feature can shorten the duration of the light cycle, we wouldn't want to use it if the intersection is synchronized with another. The computer doesn't let you say 'yes' here if the intersection has been programmed to have a slave. It's up to you to see that you don't ask for demand if the intersection is a slave to another. If the type of traffic light that you have chosen has a turn-only light phase, demand is automatic. That is, the turn lights won't even come on if there is no demand for them. But in this case, the total cycle time is not affected. The extra time is given to the next phase. Normal-time demo After you have moved the cursor through all of the selections, it will turn into an arrow pointing to the picture and the right and say "Normal-time Demo". The picture then illustrates the light cycle with the times as you have assigned them. When you are satisfied, you can push F1 to select another intersection to program or you can make more changes by moving the cursor. Copying intersections When you have finished programming an intersection (or, if you have already pushed F1, you can bring the information back to the screen by just selecting the intersection again), you can copy the settings you have made to an adjacent intersection just by pushing an arrow key. For instance, pushing a right arrow, selects the intersection to the right and puts the same data in it. The only settings that will not copy from one intersection 9 to another are the Slave Light, Slave Delay, and Demand. They will copy over as no slave, 0 delay, and no demand. If you then want to change them, you can. The computer automatically skips any intersections that don't exist (because of the park or mall) and that are underpasses. Even if you don't plan to assign each intersection on a street the same traffic controls, it might save time to set an intersection at one end, copy it along the entire street, and then change those intersections that you want to be different. Paper work If you like to plan your systems or record them on maps of the district, the following procedure is recommended. At each intersection, write your settings as illustrated below. | | Duration Type | Phase 1 and 2 | ------------------------- street Slave/delay | or | Duration Demand | Phase 3 and 4 | avenue For the Type, put a number. For the Slave/delay entry, write the slave station and the delay as, for example, 5G15. If you program Demand there instead of a slave light, put the letter D. In the Duration spaces write the durations like 10/15. Here are some sample intersections. | | | | | 4 |10/10 3 | 9 | 8/15 | 5 |7/8 ---------- ----------- ----------- --------- ----------- D | | | 5/15 | 6E0 | 7 | | | | | If you buy this program, you will receive a map of the area with a fairly well designed traffic system on it using the symbols above. If you are having trouble designing a good system, it will help you. Or you might be able to make improvements on it. 10 PLAN A TRIP (2) This second item of the main menu lets you program the routes of the two test cars. So that you can easily spot them on the roads, test car 1 is bright green and test car 2 is magenta. The first screen that you see asks you to select one of these test cars by pushing 1 or 2. You don't have to program any test cars if you don't want to. In fact, it will save time to first use only the normal traffic to test any new traffic light set-up. If you do select a test car, you are given a table in which you can enter up to ten roads and directions. There is also a map of your section of the city. Any route that you program will begin at an edge of this section and end at an edge unless you program it to go into the mall or the park. The directions on the screen tell you how to make your entries. When you have finished entering a route, push the F1 key. An example of a route might look like this: Road Direction X east 6 north G east 11 north D west 4 north This trip starts on the expressway at the left edge of the map. The car then turns left on 6th avenue and right on G street. It goes around the park, heading west on D street. Finally, it turns into the mall at 4th. The computer tries to prevent you from putting in directions that don't make sense. Depending on your error, it either doesn't respond at all or gives you an error message. When you push F1, it analyzes the route again and gives you a message if it still finds a problem. (By the way, when you enter avenues, you will again notice that annoying little hesitation before the computer responds when you type a 1. That's because it wants to be sure whether you are just entering a 1 or trying to enter a 10 or an 11. So if you are entering 10 or 11, enter the second digit without waiting for the computer to respond to the first.) 11 RUN (3) In this third item of the main menu, you get to test all of the things that you have programmed in the first two modes. Traffic The first screen lets you set the amount of traffic. The number you enter is the percentage of maximum traffic. You can select anything from 0 to 100 percent. The maximum traffic is 998 cars (which becomes 1000 if you add the two test cars). Then you are asked to decide whether you want everything to speed up before the amount of traffic you have asked for is on the screen. If the computer is very slow, you won't see much difference. With a fast computer, it can shorten the time you have to wait for the traffic to become normal. If the computer is too fast, you might not like the effect. You will have to try both ways and see which you like better. Day or Night The next screen lets you set day or night. At night you see only the headlights of cars. So if you select night, cars (except for the test cars) will all be bright yellow. You can't distinguish one car from the next if they are close together. If you select day, cars will have a small variety of colors but they will be harder to see. The choice is up to your personal preference and might depend on how good your color monitor is. The next screen is the main screen that shows the roads with all of your intersection controls, the mall, and the park. Mall lights Not long after things start to run, you will see a row of little square lights of various colors at the bottom of the mall area. Not every player will be interested in them but this is a good place to explain what they are. They are a way of putting some numbers on the screen without taking up much room. So they are codes. There is a group of two dots on the right and a group of four on the left. The group of two has to do with how long it takes the computer to move all cars and service all lights. More about that when we get to the paragraph on Speed. The group of four lights is the number of cars on the screen. The number is like a normal decimal number except that the digits are color coded using the code that was used to mark electrical resistors when they were still big enough to see. The code is as follows: 12 0 black 5 green 1 brown 6 blue 2 red 7 violet 3 orange (red and yellow) 8 gray 4 yellow 9 white For example, black, green, orange, and brown would be 531. You're not expected to learn this code. You might find the lights useful anyway because they show whether the number of cars is changing or has stabilized. Or you can just consider the lights to be decorations for the mall. Running The computer controls the routes of all of the cars except the two test cars. The computer has a large number of pre-programmed routes to chose from. It selects from these routes at random so that the traffic is entirely different each time the RUN mode is run. The things that are similar in different runs are the statistical patterns. That is, the traffic tends to be heavier in some areas, there tend to be more cars on the bigger roads, and there are more left turns at some intersections than at others. At the start, there are no cars. All cars come into the sector from the edges. If you elected to let the computer do it, it attempts to speed things up (if the computer is fast enough to be able to do that) by running cars and lights as fast as possible until amount of traffic is what you have specified. Then it switches to normal speed. At that time, you will hear three beeps and, if you have programmed any test cars, they will start their trips. (in that case, there would be another beep for each test car). The numbers of minutes the test cars have been running are displayed in the park area. The display is updated only once each minute because the computer is very busy at that time. When a test car finishes its run, the total time of the trip is displayed to the tenth of a minute. Any time a test car is not already running, you can start it yourself by pushing the space bar (or most other keys). Pushing F1 gets the main menu. If you then go back to the RUN mode without doing any clearing in the meantime, things will continue from where they were when you pushed F1. 13 Accidents It is possible for cars to crash. A crash is most likely to happen in heavy traffic, at an intersection with no traffic controls (type 0), and where both roads are the same width. Another likely spot for a crash is at an intersection in which traffic has backed up due to another intersection having a problem or just not being able to handle its traffic. Unless you happen to be looking in just the right spot when it happens, you will first notice an accident by the backup of traffic around it. Some time after an accident a police car should appear. You can recognize it by its rotating blue light. The police also sometimes appear if an intersection is clogged due to a problem at another intersection. Sometimes the cops can un-clog an intersection and go away after a while. Sometimes there is no way to clear an accident scene except to push F1, clear the traffic, and start the run over again. (The computer tries to keep on the screen the total number of cars that you specified. So if a lot of cars are stuck at accident scenes, fewer cars will be driving around.) Speed The computer should be able to do one cycle of moving every car once, servicing every traffic light, and doing a few other things (like starting new routes and stopping old ones) in less than half a second. If a computer is fast enough to do that and you have elected to let it, the computer is allowed to run as fast as it can until the required numbers of cars are on the screen. After that, if it finishes a cycle before a half second is up, the computer waits until it is up before starting the next cycle. In other words, a fast computer will do one cycle every half second. One block along a street (a long, horizontal block) is a tenth of a mile long. A car takes an average of 29 half- second steps to travel one block. So the speed of a normally moving car, except on the expressway, is 25 miles per hour. on the expressway, the speed is 50 miles per hour. If a computer is too slow, or becomes too slow as the number of cars on the screen increases, everything - cars and traffic light cycles - slows down. You begin to see the scene in slow motion. You can get a reading of how much things are slowed down from the two light dots at the right end of the row of dots at the mall. The dot on the left side of the pair is black. It will stay black unless the cycle gets to be over 5 seconds long. As long as one cycle takes a half second or less, the dot on the extreme right end is brown. If it takes longer than a half second (actually 0.6 seconds) the light becomes red, and so on. The table below shows a few more of the colors and what they mean. 14 Time of a cycle Color Number ---------------- ------ ------ 0 to 0.6 sec brown 1 0.6 to 1.1 sec red 2 1.1 to 1.6 sec orange 3 1.6 to 2.1 sec yellow 4 2.1 to 2.6 sec green 5 2.6 to 3.1 sec blue 6 3.1 to 3.6 sec violet 7 and so on The program has been tested with computers of various speeds. With the worst traffic and the most traffic lights, the following cycle times were normal. Computer speed Worst-case cycle time --------------- ------------- 5 MHz 3.4 sec 12.5 MHz .75 sec 16 MHz and above .50 sec There is some slow-down at 12.5 MHz but it is not noticeable. Time clock At the top right side of the screen (between 10th and 11th avenues), there is a number that shows how long the RUN mode has been on. If you stop the RUN mode, the timing also stops so that, if you start the RUN mode again, the count continues from where it stopped. The only exception to that rule occurs if you clear the traffic before starting to RUN again. The count is then reset. So actually, it is a timer that shows how long the traffic has been running. This timer really counts computer cycles - a cycle being what it takes to move all of the cars once, service the traffic lights, etc. Actually, the number displayed on the screen is the number of cycles divided by 120. So if your computer is fast enough to do one cycle in half a second, the displayed number represents minutes. If the computer is too slow, the count also slows down and no longer indicates minutes but something longer. By the same token, if you start the run mode and ask the computer to move cars as fast as it can until the designated amount of traffic is on the screen, the count will speed up if the computer can move all cars in less than a half second. In that case the count will represent something shorter than minutes until right amount of traffic is on the screen. In either case, the number can still provide a useful measure of how long traffic has been running. 15 Test cars Any test car routes that you have programmed begin automatically when the traffic reaches the amount that you have set. Or you can start the test cars by pushing a key. There will be a beep when a test car starts. In the park area, a number appears for each test car that indicates how long the test car has been running. If you push F1 to get the menu and then go back to the RUN mode, everything continues as it was before EXCEPT FOR THE TEST CARS. The test car trips are stopped and start over again when the RUN mode is resumed. As in the case of the time clock described in the previous section, the timer that times the trips of the test cars counts cycles and divides them by 120 before displaying them. That means that the times shown in the park area are in minutes as long as the computer is fast enough to do one cycle in half a second. While the test cars are running, the time is updated only once each minute because the computer is very busy at that time. But at the end of a test car route, the total time of the trip is displayed to the tenth of a minute. if your computer is too slow and slows everything down, the timer that times the test cars also slows down. In that case, if you were to time a trip with a clock also, the results would not agree. (For example, if the computer takes an entire second to move all cars, a real clock reads two minutes when the computer's timer reads one minute.) The good thing about this method is that, under the same traffic conditions, you will get the same readings on slow computers that you would on computers that are fast enough. HOW THE CARS BEHAVE It will be useful for you to know what rules the computer normally follows in driving the cars along the roads. (Some of the rules have been mentioned before.) Rules that are obvious will not be repeated. For example, that cars will stop at red lights and go on green, or that they will stop at stop signs, and so on. Of course they will do those things. Even you probably would. Most of the time. All cars These rules apply to cars that are going straight across and intersection as well as those which want to turn left. At intersections with traffic lights, cars will be guided by the lights. Any special things that you should know are explained below. 16 Where there are two-way stop signs, each car will come to a stop and then proceed if there is no close cross traffic coming. (Actually, if no car has reached the gray sensor line across the street.) The case of cars turning left is described below. You will notice that, if there are many cars in line at a stop sign, out of consideration for the cars behind them, cars won't stop as long. (In real life they would stop longer thinking, "I had to wait a long time to get here. Now I'll take my sweet old time and you can all wait".) At four-way stop signs, each car will come to a stop and then proceed when its turn comes. The turn alternates between N-S and E-W so that an east and a west-going car could cross and then a north and a south-going car. A car that arrives at an intersection first generally gets to go first. At an intersection with no controls, cars on a smaller road approaching a larger one will proceed only if there is no close cross traffic coming. Otherwise they will stop and wait until there is no close cross traffic before proceeding. Cars on the larger road will proceed full speed. If the two roads at an intersection are the same size, the direction where more cars are coming will go first. If the traffic is equal, the E-W going cars will tend to proceed and the N-S cars will wait for an opening in the traffic. Straight-going cars Cars going straight through an intersection will stop when the light turns yellow. At a stop sign, a car will come to a stop and then proceed across if it is its turn. However, if the car going the opposite direction wants to turn left, the right-of-way alternates between the two directions. Left-turning cars At a traffic light where both directions have green lights and there are no turning lights but turns are allowed, a turning car in a turning lane will wait until there is no oncoming traffic. If it has to wait until the yellow light, it will turn then. On a two-lane road where there is no turning lane, the computer crosses its fingers and lets the turning car turn even if there is oncoming traffic. Otherwise, a car trying to turn at a busy intersection, could permanently block the traffic behind it. At intersections with turn-only lights, cars do continue to turn for some two seconds after the lights become yellow. The reasoning is that these are probably intersections where a lot of 17 cars want to turn left and it would be better to get them on their way before they start to block the traffic behind them. That's more or less the way it is in real life. When cars going in opposite directions have stop signs and some cars are turning and others are not, the right-of-way alternates between the two directions. At an intersection with no controls, turning cars don't hesitate to cut in front of cars coming the opposite way. HINTS Re-starting the RUN mode after changing a light If you have a lot of traffic on the screen, stop the RUN mode to change a traffic light, and then re-start the RUN mode, there is a small chance that cars in the changed intersection could find themselves in trouble and have an accident. To prevent that, it would be a good idea to clear the traffic before you re-start the RUN mode. Car-speed facts When setting traffic lights, remember these facts. If your computer is fast enough to run things at normal speed, each car moves every half-second. So for a car that travels un-impeded, * It takes an average of 14 moves to cover a short (N-S) block * That means it takes about 7 seconds to go a short block * It takes an average of 29 moves to cover a long (E-W) block * That means it takes about 14.5 seconds to go a long block * On the expressway, one block takes about 7 seconds If you use these numbers to calculate the lengths of your light cycles and your computer is not fast enough to run things at normal speed, you don't need to worry. It's all right because when the cars slow down, so do the traffic light cycles. Synchronizing If you want to synchronize a string of lights, consider making the delay between synchronized lights equal to the time it takes a car to go from one to the other and making the total cycle time of the lights equal to twice that time. 18 CONCLUSION Maybe when you have finished playing GRIDLOCK, you will be able to answer the key questions here. Is it really as hard as it seems to set lights in a way that keeps traffic moving? Or is it impossible? If you were an oil company, would you really like to see cars spending a lot less time sitting at red lights? If you were an old lady on crutches, would you push that button? Would you let your son or daughter marry one of those people who set traffic lights? And how many of them does it take to change a light bulb in one of those traffic lights? And what is red and red and red and red and green and yellow and red and red and red and red and red all over? Please don't send in your answers. These are only retorical.... ritorical.... rhetor.............. This is not a quiz. No prizes. If you must send them in, send them to your local traffic department. Thank you. 19 Figure 1. Map of your sector of the city Lanes: 2 2 5 2 2 3 2 2 5 2 3 ___ | | | | | | | | | | | | | A --x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-- 2 | | | | | | | | | | | B --x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-- 2 | | | | | | | | | | | C --x-----x-----x-- MALL --x-----x-----x-----x-----x-----x-----x-- 2 | | | | | | | | | | | D --x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-- 5 | | | | | | | | | | | E --x-----x-----x-----x-----x-----x-----x-----x-----x-- --x-- 2 | | | | | | | | | PARK | F --x-----x-----x-----x-----x-----x-----x-----x-----x-- --x-- 2 s | | | | | | | | | | | t G --x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-- 3 r | | | | | | | | | | | e H --x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-- 2 e | | | | | | | | | | | t I --x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-- 2 s | | | | | | | | | | | J --x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-- 2 | | | | | | | | | | | K --x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-- 2 | | | | | | | | | | | X --------------x-----------------x-----------------x-------------- 7 | | | | | | | | | | | L --x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-- 2 | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 avenues 20 Table 1. Left turns made in sample of 200 car trips AV ST E W N S AV ST E W N S AV ST E W N S 1 A - 4 - - 4 J - - 1 1 8 E 2 1 1 1 1 B - 4 - 1 4 K - 1 - 2 8 F 2 - 1 - 1 C - 2 - 2 4 X - - - - 8 G 2 - 2 3 1 D - 6 - 5 4 L - - - 1 8 H 1 1 1 1 1 E - 1 - 1 5 A - 3 2 - 8 I 1 1 1 - 1 F - 1 - 1 5 B 1 2 6 1 8 J 1 - - 1 1 G - 4 - 8 5 C - 1 1 1 8 K 2 - 1 2 1 H - 2 - 1 5 D 2 2 2 3 8 X - - - - 1 I - 2 - 1 5 E 2 1 3 1 8 L 1 - - - 1 J 1 1 - 2 5 F 1 1 1 1 9 A - 1 4 - 1 K - - - 3 5 G 3 1 1 1 9 B 1 2 5 - 1 X - - - - 5 H 1 - - 1 9 C 1 1 1 - 1 L - - - 3 5 I 1 - 1 1 9 D 7 5 12 2 2 A - 2 1 - 5 J - - - 1 9 E 1 - 2 2 2 B - 3 1 1 5 K 1 - 1 1 9 F 1 - - 3 2 C 2 1 1 1 5 X - - - - 9 G 9 3 4 5 2 D 2 4 1 2 5 L 2 - - - 9 H - 1 2 1 2 E - 1 1 1 6 A - 4 7 - 9 I 3 1 - 1 2 F - 1 - 3 6 B 1 4 10 - 9 J 3 1 1 2 2 G - 2 2 4 6 C 1 1 1 1 9 K 2 - 1 1 2 H 1 1 1 1 6 D 4 6 6 5 9 X 12 4 7 3 2 I 1 1 1 1 6 E 3 1 2 1 10 L 4 - - 1 2 J 2 - - 1 6 F 2 - 1 1 10 A - - 1 - 2 K 1 - - 1 6 G 9 5 5 5 10 B - - 1 - 2 X - - - - 6 H 2 2 1 1 10 C - - - - 2 L - - - 2 6 I 1 1 2 1 10 D 2 2 - 1 3 A - 5 2 - 6 J 1 - 1 1 10 E - - - - 3 B - 14 4 2 6 K 3 2 1 2 10 F - - - - 3 C 2 - 3 8 6 X 9 6 5 9 10 G 2 - 1 - 3 D 4 13 9 10 6 L 3 - - 1 10 H 1 1 1 - 3 E 1 2 1 1 7 A - 1 2 - 10 I - - 2 - 3 F 3 1 2 2 7 B 1 1 3 1 10 J 1 1 1 - 3 G 5 4 3 10 7 C 1 1 - 1 10 K 1 - - 1 3 H 1 1 2 1 7 D - 3 1 1 10 X - - - - 3 I 2 1 1 2 7 E 1 2 1 1 10 L 1 - 1 - 3 J 2 3 1 1 7 F 2 1 1 2 11 A - - 2 - 3 K 3 1 - - 7 G 1 1 - 2 11 B - - 1 - 3 X 6 7 2 12 7 H 2 1 - 1 11 C - - 3 - 3 L 2 1 - 5 7 I 1 - 1 1 11 D 3 - 9 - 4 A - 4 1 1 7 J - - 1 2 11 E - 1 - - 4 B 1 3 - 1 7 K 1 1 - 1 11 F - - 1 - 4 C - - - - 7 X - - - - 11 G 7 - 2 - 4 D 6 2 2 - 7 L - - - 1 11 H 1 - 2 - 4 E 1 2 1 1 8 A - 1 2 - 11 I 3 1 1 - 4 F 1 2 1 1 8 B 1 2 2 - 11 J 1 - 1 - 4 G 1 1 - 1 8 C - 1 - - 11 K 3 - 1 - 4 H 1 1 - 1 8 D 1 1 2 1 11 X - - - - 4 I 1 1 1 2 21 11 L 1 - - -