Freeway example program: Description: Freeway simulates traffic flow on a typical California highway. Individual vehicles make decisions about how fast and where to drive based on the conditions around them. The user can control some of the simulation parameters: * Speedlimit in the three zones * Distance between cars * Simulation speed Usage: Freeway Select "Start" to begin the simulation. Example Scenario: Step 1: Make a copy of the program Copy the contents of the Freeway directory to your own private working area with the following command: cp -r /opt/SUNWspro/examples/WorkShop/freeway ~/freeway NOTE: /opt/SUNWspro is the base directory where the product is installed. This directory maybe different in your environment. The Freeway Makefile assumes that Freeway source files are under SCCS control. If you intend to use this Makefile, please ensure the source files have read-only permissions. For fun, you could also use TeamWare to create your own workspace of this program. For more information on how to do that, refer to the manuals. Step 2: Open the Project File for the Freeway Program Start WorkShop with the the "workshop" command. From WorkShop main window, select "Open Project..." from the "Project" menu and open the Project File, "~/freeway/Freeway.prd". This Project file provides some pre-set file, compiler, debugger, and build-related settings for you. Note: If you prefer to build the Freeway program with a make command, instead of using a Project File, a Makefile has been provided for you. In this situation, build Freeway with the provided Makefile, and skip step 3 below. Step 3: Build your own copy of Freeway. From the WorkShop main window, go to the Build menu and select the "Freeway in..." target in the lower part of the menu. This launches a build of the program, bringing up the build-output window. The program should build successfully. Close the Build Output window when done. (or) Point WorkShop's Build window to the freeway directory by selecting 'Build->New Target ...' from either the main window, or from the Build window if it's already open. A dialog pops-up. Change the value of 'Directory' to the location of Freeway and select 'Freeway' as the new 'Target'. Click the 'Build' button on the dialog. Close the Build Output window when done. Step 4: Run the program under the debugger. From the WorkShop main window, click on the Debug button. The debug window along with your editor of choice should come up. Select to the Execute->Start menu item to run the program. Note: If you are not using a project file, select Debug->New Program... and fill out the resulting dialog box to tell the debugger that you want to debug the Freeway executable. Step 5: Play with it. Though the program seems to work correctly, there are some bugs in it. Use the "Checks" facilities to find access errors and potential memory leaks. Try making changes to enhance the program. Explore it with the browsing facility. Have fun. Copyright 2000 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, CA 94303, U.S.A. All rights reserved.