模拟2维沙堆效果

源代码在线查看: manual.txt

软件大小: 266 K
上传用户: kyzgq
关键词: 模拟
下载地址: 免注册下载 普通下载 VIP

相关代码

				1. INTRODUCTION
				
				This is the documentation for Sand - a sandpile simulation, 
				programmed in Borland Delphi 2.0. This document describes how 
				the program works, and which parameters the simulation uses. See 
				the file theory.doc if you want some theoretical background on 
				sandpile models.
				
				You use the program at your own risk. The program is not 100% 
				stable, though I've done my best to make it safe. To increase speed 
				I've disabled range checking in the program.
				
				The source code has been included as freeware. Do with it whatever 
				you like. You don't have to credit me if you publish your changes, 
				but it would be a nice gesture.
				
				2. CONCEPT
				
				The simulation illustrates the principles of how a (much simplified) 
				sandpile behaves, when grains are added to it. The grains that are 
				added cause the sandpile to grow higher, but it may also cause grains 
				to fall down the sides of the pile, causing more grains to fall down, 
				etc. etc. Even though grains are added in random locations, the pile 
				will eventually become almost symmetric (it will become cone-
				shaped).
				
				The simulation was originally created to illustrate some underlying 
				principles of why the sandpile behaves like it does (how do ava-
				lanches increase in size as the pile grows; how does the calculation 
				time increase; and the like).
				
				The sandpile model used in the simulation doesn't have much to do 
				with a real sandpile (the model is quite flat, and grains can fall 
				uphill). However, you might like the patterns that the simulation 
				produces as it runs (watch out you don't get hypnotized ;). Also, the 
				model is an example of a certain kind of models, simply known as sandpile 
				models (see file theory.doc for more details).
				
				3. HOW THE PROGRAM WORKS
				
				You see the sandpile from the top. The height in each point on the 
				pile is between 0 and 8. If the height exceeds 4 the point topples, 
				which means that one grain moves to each of the neighbor points to 
				the north, south, east, and west. When one point topples, it may 
				cause one or more neighbors to topple too, causing an avalanche you 
				can follow on the screen.
				
				You can specify which colors will represent the different heights 
				(click on the colored rectangles in the color dialog box). As you will 
				not be able to spot points of height > 4 because they topple 
				immediately, these colors are left out. The "trace" color is used when 
				you trace (with the trace function you can follow how the grains 
				move in the pile).
				
				The sandpile has three parameters:
				  Surface:    the maximum size of the sandpile (can be up to 255). 
				  Add inside: the diameter in the center of the pile in which to add 
				              grains (cannot exceed the pile size).
				  Rounds:     the maximum number of rounds you want the simulation 
				              to run (the same as: the maximum number of grains to add).
				
				During the simulation you can see some statistics of the pile:
				  Added:      tells how many grains are added (number of rounds).
				  Lost:       grains that slide off the surface which the pile is placed 
				              on.
				  Toppled:    points that have toppled because they contained more 
				              than 4 grains.
				
				You can load and save piles. Some files have been included with the 
				program as examples.
				
				Important: Note that drawing the sandpile is very time-consuming 
				(extremely so, if you ask me). Closing the window that shows the pile 
				will speed up calculations considerably, especially as the avalanches 
				get bigger.
				
				Finally, a word of caution: for some reason I don't know, except it 
				probably has something to do with thread synchronization, the 
				program may crash if you press one of the buttons while the 
				simulation is running, and the window showing the pile is closed. I 
				advice you to stop/pause the simulation or make this window visible 
				before you load, save, exit, or change colors (these buttons seem to 
				give the most trouble). If you have any idea of the reason for this 
				problem, I'd be very happy to hear from you!
				
				However, I've never personally experienced conflicts or other 
				problems between the program and other applications. I assume it's 
				safe to run the simulation in the background, while you do other 
				things. You might want to turn off your screen saver, though, as it 
				could steal the resources from the simulation when it's active.
				Enjoy! (By the way, don't strain yourself looking for subliminal 
				messages in the sand. There aren't any ;)
				
				
				Troels Jakobsen
				tjak@get2net.dk
							

相关资源