home *** CD-ROM | disk | FTP | other *** search
- RoadRoute - A start at a "trip planner"
- Jim Butterfield .. December 20, 1988
-
- 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 within the conservative 55mph 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.
-
- And then .. ya got this program (in Basic, at least for the time
- being) which tells ya how ya might get from one place to another.
- Takes a while to bring in all those cities and routes.
-
-
-
- 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.
- When the program runs, it will spot the new items and will
- attach prefix numbers to them .. this will save it lookup
- time in the future. You'll see the message "File needs Reforming"
- .. don't panic next time you look and see new stuff there.
-
- 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 ask you which Jacksonville you mean. Again,
- if this is an item in the Routes file, the program will rewrite
- ("Reform") the file so that you won't need to answer again.
-
-
-
-
- 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 "prefixed numbers" in the routes file are of
- course a significant time saver. Should you remove a city name
- from early in the Cities file, together with the appropriate
- links in the Routes file, the computer will not get confused
- ... but it WILL need to look up most of the cities named in
- the Routes file in order to get their new numbers. You'll see
- the dramatic slowdown this produces .. one time only, since a
- "Reformed" file will be written.
-
-
- 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, won'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).
- 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.
-
-