RoadRoute1.6 - A start at a "trip planner" Jim Butterfield .. August 1990 Ya got this file of cities (Called "Cities") showing a lot of places in North America, but not all of 'em. (Add the ones you want, using your favorite editor). Ya got this file of road segments (Called "Routes") showing roads connecting the cities; most of the interstates, and quite a few others that seem handy. (Add your own road segments if they are not already there). The segments show mileage and driving time, this last worked out via conservative and legal spped framework. If you're a speed demon, try not to change the numbers .. just divide the time by two or whatever your thing is. And when you add routes, keep 'em consistent, so that back roads don't start to look like throughways. Program RoadRoute (compiled from Lattice C) reads the above files and sez how ya might get from one place to another. The first version in Basic sorted out the logic flow but wasn't too quick; you'll like the speed of this C version much better. The 1.6 update is no major trauma ... but since RoadRoute was used in a Computer Fair environment, where the objective was to output the resulting itinerary on a piece of paper, and have the papaer ejected from the printer so as to allow it to be torn off and handed to the fair visitor .. I added the code to do this. You've always been able to output to the printer by CLI command "RoadRoute >prt:" and can still do so. The CLI method does NOT eject the paper after printing. Your choice: save paper or set up so as to produce handouts... There is no limit to the number of cities or road links that may be put into RoadRoute. I note, however, that a file set from West Germany that uses 911 cities and over 2000 roads generates a .l.o.n.g. pause before it asks the first question. This time is spent linking roads to cities in an easily-trackable form; once that is done, the routing itself is calculated FAST. I do NOT plan to do a regular revision of RoadRoute .. but new stuff floating in (esp from Germany) made it seem advisable .. this time. So .. you're interested in places not given in the original files? Say, you live in Erie, PA, and love to visit your auntie in Lake Havasu City, Arizona? So you wanta add these? No problem. Step 1: Add the city names to the Cities file using your favorite editor. For someplace like Lake Havasu, you might like to slip in a few nearby cities, such as Needles and Kingman. Step 2: Start up your editor on the Routes file. Don't worry about those numbers ahead of the city names .. the computer will know what to do if the numbers are not there. Give road links hooking up to nearby points in all directions. For Erie, this would be: Buffalo to the east, Cleveland to the West, and Youngstown to the South (three new lines). For Lake Havasu, you'd first want to hook up Kingman to Flagstaff, Las Vegas, and Needles; then Needles to Barstow. Finally, you can put in the details for Lake Havasu to Kingman and Needles; a total of six new lines. Be sure to give for each line: two city names, distance, (sedate) driving time, and highway designation. No need to give state designation on the Routes file unless you have a city name that matches that of a city in another state. More on that in a moment. Some users have loaded up the data base with their local towns. That's fine, but try to keep the information consistent. If my data sez Los Angeles to San Francisco is 7 hours, try not to supplement the list with LA-Bakersfield 30 minutes; Bksfield -SF 4 hours. You might drive that way, but the data base would start to have inconsistencies. See program RoadScan which helps to watch for this kind of thing. If you want to add, say, Jacksonville, North Carolina, you'll need to think about the name: there's also a Jacksonville, Florida, in the system. No worry: pop it in the Cities file anyway, and the computer will know what to do. You can designate which Jacksonville you want by using a slash followed by the state name, e.g., Jacksonville/North Carolina. If you don't do this, the computer will complain, showing you the Jacksonville entry in the Routes file. Athough it's finicky about file contents, it tries to show you the problem areas. If programming stuff interests you: this should be a simple program. But "user friendliness", in the form of dialog on poorly identified places, takes up a little space. A more important area is speed: with hundreds of cities and many hundreds of routes in the system, linear searches become slow and painful. As a result, you'll find several examples of "linked lists" here, one of them partly prioritized. These help find duplicate city names; greatly speed the search for which routes apply to a given city; and direct the computer as to which city point should be searched next. The program has no limit on the number of cities or routes that may be used; if your data base gets big you'll notice a hesitation when the program starts up. To help with huge menu lists, which scrolled off the screen in version 1.0, the menu now comes in chunks of 15 items. If you miss the desired city, you can roll the whole list again. As I note with amazement that huge data bases are being built, I've expanded the max itinerary size to 100 lines. Feel free to play with this. If you want to rip out the existing map, and build a highly detailed map of your area, be my guest. (Street maps, I suspect, wouldn't work too well because one-way streets are not allowed for here). Building the files substantially bigger will cost you run time. I agonized as to what should be left in and what taken out (Sorry if your city is not there .. but you can add it easily enough). My data base is built from comparing a variety of sources: various maps, AAA data, and others. Class of road, number of lanes, whether flat or hilly country; all are factored in. The information allows for "pit stops" - meals, gas, coffee - so that average speeds might seem lower than you would expect. Hey - but you know your own countryside better than I possibly could - cut it to your own style. A map? It's quite possible, if you add "north/south, east/west" coordinates to the Cities file. I did not do it here because it would be harder for you to add new cities... you'd have to know (and type in) the coordinates for each.