Road Route Fred Mayes February issue of the CUB Newsletter Commodore Users of Bartlesville Well, I figured that I would demo some games again this year for the Computer Fair, but about two weeks before the event I discovered a program written by Jim Butterfield on Fred Fish disk 251 called RoadRoute. You enter the town you are leaving from, the town you want to go to, and if you want to go through a special town to get there. Then you are given the total length of the trip and how long it will take to drive it. You are also given a listing of the major towns you go through, and the highway you need to take to get there, and how long it will take to drive each segment. I thought this was really neat! In reading Butterfield's documentation, he indicated that the program was written in BASIC and that the data files were easy to modify to add your own favorite towns in. As I played with it more, I found that he had rewritten the program in C language which helps explain why it runs so fast. Also, only interstates and major throughways were entered. For instance to go from Tulsa to Kansas City required going to Oklahoma City and then to Wichita and then to KC. I thought I would add more towns in and around Oklahoma to the program. I got a map of the United States and then printed out the file which contained the routes. I highlighted the US map with these routes to see what was included and what wasn't. Butterfield had entered nearly every major city in the United States and Canada. I was impressed! I obtained an Oklahoma map and started adding Oklahoma cities. There are two files that need to be changed: Roads and Cities. Roads contains data in the format: 'city1,city2,distance,time,highway'. Cities contains data in the format 'city,state'. I highlighted the roads on the state maps as I added the routes to the program. After adding cities to Oklahoma, I needed to tie them in to the surrounding states. Gary Delzer offered to help...he tackled Kansas, Colorado, and New Mexico. I added Texas, Nebraska, Louisiana, Arkansas, Mississippi, and Missouri. The trouble with adding new cities is deciding where to stop. Hopefully, data can be added (by other computer clubs - hint, hint, nudge, nudge, say no more, say no more) to cover the entire US (or world!). It is amazingly quick to tell it you want to go from Key West, Florida to Bangor, Maine via Seattle, Washington and immediately get a listing of the shortest route. Sometimes it will find two routes - one is shorter, but the other is quicker. Gary found that by giving a CLI command of "RoadRoute > par:", the screen prompts are shown on the screen, but the listing of the routes is sent to the printer. By having two versions of the program running at the same time, you can have one running normally, and one directed to the printer parallel port. Play with the normal program until you find a combo you want a printout of and then switch to the other program to reenter those cities to get your printout. I might even send the program back to Fred Fish (and Butterfield) to circulate the SouthMidWest data version around. If any other clubs do expand this program, let me know - I am interested in swapping with you. Send me your disk with a self addressed stamped envelope and I will send you back my version on your disk. Be sure to put a note on it as to what states you have added. Add your cities and routes to the beginning of the files. Include a printout of both files with the cities and routes that you have added highlighted. I have developed a few hints on how to do add to the program. 1) Work with a state map and highlight what you are inputting - otherwise you get hopelessly lost. 2) Know what is already on the program. 3) Add towns that are obvious hubs and will serve as change of direction points. Also add popular vacation sites or places people will want to go to. 4) Use common sense in estimating driving times. If your route is on an interstate, you can use 60 mph (a mile a minute) pretty safely. Estimate time to the nearest 5 minutes. If the route goes through several small towns and is a 'black' road on the map, use 50 mph as an average - or even slower if you know of hills, or other congestion that would slow you down. Don't include 'grey' roads unless you leave a big open area by not doing so. The 'red' roads can be closer to 60 mph if in wide open country. 5) If you add towns in between the towns already in the program, make sure that the mileages and times match. If you are going straight through, the program will take the big jumps. If you need to make turns, it will utilize the intermediate towns. If the times or mileages don't match, you may find that it will give an alternate route that is actually the same route with different driving times. I ended up changing a lot of Butterfield's times in the areas I covered because I felt they were overly conservative. He used 50-55 avg for interstates. I moved the interstates on up to 60. 6) When you add cities, be sure to tie the city in to existing adjacent cities by every usable route - otherwise you will have to go well out of your way to get to an adjacent city. 7) I use WordPerfect to add the routes to 'Roads' first. Then I save the document as a text file (Cntrl F5), use the sizing gadget to reduce the width of the screen and move the screen to the right half of the monitor. Then switch to a new document (Shift F3) and open 'Cities'. Click on the background gadget to put 'Cities' behind 'Roads'. Now you can type on document #2 (Cities) on the left half of the screen while document #1 (Roads) is on the right half of the screen. Add the new towns to 'Cities'. You can scroll 'Roads' up and down as needed to see what you have added. Now, click these in the background so you can get back to Workbench. Open the RoadRoute disk and run the program. If it doesn't run, it will tell you where your problem is. Usually you haven't entered all the cities, you have misspelled something, you have added a city which has a duplicate name in another state (this is easily handled by adding '/state' after the name in the route file. For example, Buffalo/Oklahoma, Buffalo/New York, Buffalo/Texas), you have entered a city twice or entered a city that Butterfield already had entered - most of the errors are obvious except having a city in twice. That one threw me for a while. Once you find the problem, click WordPerfect back to the foreground, make your corrections, save the files, and try running the RoadRoute program again so that it accesses the new version of the files. Not having to quit and reenter your wordprocessor each time by taking advantage of multi-tasking is really a time saver. This new program disk is in the CUB Amiga library under the title RoadRoute. This is a neat program. Thanks, Jim!!! Fred Mayes Commodore Users of Bartlesville 2524 SW Mountain Road Bartlesville OK, 74003 Note to Jim Butterfield: A suggestion for the next version: I have added enough cities for the list of available cities in a state to scroll off screen. There should be some provision to handle this - perhaps show a screen at a time or have the ability to scroll back up the list. ----------------------------------------------------------------------------- The following is the text of the original doc file: 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 "Roads") 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 Roads 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 Roads 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 Roads 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 roads 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 Roads file, the computer will not get confused...but it WILL need to look up most of the cities named in the Roads 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.