Sugarscape模型仿真

源代码在线查看: program instructions.txt

软件大小: 53 K
上传用户: C69222090
关键词: Sugarscape 模型仿真
下载地址: 免注册下载 普通下载 VIP

相关代码

					Contents
					--------
				1) Project Overview
				2) System requirements
				3) Compiling & executing the program
				4) Test Run
				
				
				Project Overview
				----------------
				The Sugarscape project a.k.a. Game of Life (GoL) has been coded as a Java package and is
				executable as an applet using either the 'AppletViewer' included in most Java SDK
				installations or inside a webpage through any Java-compatible browser. A sample HTML file
				is included in the distribution.
				
				It is recommended that the Java SDK be installed on your system in order to completely
				explore, tweak & understand the program. Configuring simulation parameters no longer
				requires re-compiling. However, if you wish to examine/modify the code, you will need the
				Java SDK & a text editor.
				
				
				System Requirements
				-------------------
				The only requirement to use GoL is a working JRE or JDK, version 1.2.2 or greater. A
				JDK/JRE version 1.3 or greater is recommended. The idea behind writing it in Java was for
				it to be available on all major platforms.
				
				Program Environment
				1) Download and install JDK 1.4. if Java is not already present on your computer.
				Check for the existence of the CLASSPATH variable by opening a DOS window and typing:
					set CLASSPATH 
				
				The response should look something like this:
					CLASSPATH=C:\j2sdk1.4.2\bin;C:\j2sdk1.4.2\jre\lib\ext;.;
				Note: the response may not match exactly as shown above but should include the directory
				containing the java executables, the path to the 'jre\lib\ext' folder and the '.'
				(period)
				representing the current directory. Each pathname should be seperated by semi-colon
				characters.
				
				2) Download & unzip the Sugarscape project into a folder on your computer. Ensure that
				the
				directory structure given in the Zip file is maintained. All Java files except
				"GameOfLife.java" should exist within the "GameOfLife" folder. All other project
				files/folders must reside in the parent folder of the "GameOfLife" folder. Text files
				contain information or instructions & usually reside in the 'Documentation' subfolder.
				
				
				Compiling & executing the program
				---------------------------------
				You can execute the code inside a browser or the appletviewer (recommended) provided
				as
				part of the Java SDK. To execute the program simply open "GameOfLife.html" in your
				Java-enabled browser OR
				open a DOS window, go to the GoL folder and type,
					appletviewer GameOfLife.html
				
				If you wish to compile the program files, you may do so in the following manner:
				-> open a DOS window & change to the GoL folder
				-> type the following commands in the given order:
					javac GoLconst.java 
					javac Citizen.java 
					javac Cellspace.java 
					javac GameOfLife.java 
				If no errors are generated, you can execute the compiled program as described in the
				preceding paragraph.
				Note: The a.bat file automates this process & combines compilation & execution in one
				command, type:
					a GameOfLife 
				...to automatically compile & execute the program.
				
				
				Test Run
				--------
				-> Start the program as described above, you should see a blank grid with a text display
				area and command line beneath it.
				The size of the grid can be changed in the GoLconst.java file (requires re-compiling).
				The size of the text display area can be changed by typing one of the following:
				
					TEXTAREA + n
					TEXTAREA - n
				..where 'n' refers to an integer number of rows that the display area is to be enlarged
				or reduced by. For eg.,
				
					TEXTAREA + 2 will increase this display by 2 lines.
				The command line cannot be resized.
				
				While the program can run either the Sugarscape or one of about a dozen variations
				implementing Conway's original ruleset. These are described at
				http://www.bitstorm.org/gameoflife/
				This demo will focus on the Sugarscape (Ss).
				
				-> Type '?' or 'HELP' to get a list of commands that can be executed from the command
				line to control the simulation.
				
				-> You can setup the Ss by selecting 'Sugarscape' from the dropdown list on the toolbar
				or typing, 'SS' at the command line.
				This will generate a random sugar distribution & populate the grid with citizens. The
				simulation now awaits the command to begin.
				
				-> Type 'GO' or click the 'Start' button on the toolbar to execute the simulation. If you
				wish to execute just one
				or few generations worth of processes, type 'NEXT' at the command line or click 'Next' on
				the toolbar instead.
				
				-> Type 'S' or click the 'Stop' button on the toolbar to pause the simulation.
				
				-> You can activate/deactivate feedback by toggling any one of the debugging switches. By
				default only critical errors are displayed. These switches are toggled by simply typing
				their names on the command line. For eg. typing,
				
					DEBUG SEARCH SUGAR
				..will activate feedback for this particular set of processes. The program will display
				messages detailing the events occurring as each citizen goes about its search for sugar.
				
				Note: The program does not offer an option to quit, either on the toolbar or on the
				command line. This stems from a security feature in Java that does no allow programs to
				terminate their execution. You can safely terminate at any time by closing the window of
				your browser or appletviewer.			

相关资源