Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP Monad Research
Message
De
19/01/2009 13:13:55
 
 
À
19/01/2009 12:29:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01375100
Message ID:
01375151
Vues:
8
Unless you seed the rand() function by using a negative number, like rand(-1), you will ALWAYS get the same series of values.

>>>I use an algorithm that manipulate monads.
>>>
>>>I begin with 50+ randomly placed monads.
>>>
>>>They always seem to break into groups of two.
>>>
>>>The rules, the initial conditions, and some of the results I've gotten are accessible here:
>>>
>>>http://cloudmusiccompany.com/science/research.htm
>>>
>>>My question is, why do the monads split into clusters of two?
>>
>>On the URL you specify, I can find neither the rules, nor the initial conditions. If you state them there, it isn't very clear.
>
>The initial conditions are listed there.
>
>The rules can be found by following the hyper link on Listing A, which is this page:
>
>http://cloudmusiccompany.com/paper.htm
>
>Find Listing A, that's the rules.
>
>Here's the program I've been running for the majority of those results:
>
>
>clear 
>set decimals to 6
>
>* For da loop
>public lquit, ndotcolor, nstep
>lquit = .F.
>nstep = 0
>
>SetupScreen()
>
>* Setup Initial Conditions
>public oAbsoluteMatter
>oAbsoluteMatter = createobject("collection")
>rand(0)
>for ln1 = 1 to 300
>	oAbsoluteMatter.Add(createobject("absoluteMatter", 1, ranstr() , ranstr() , ranstr() , ;
>		ranstr() , ranstr() , ranstr() ))
>endfor 
>
>
>
>* Perform rules
>do while not lquit
>	_screen.Caption = "VFP Monads Step: " + transform(nstep)
>
>	RefreshScreen()	
>	ndotcolor = rand() *   16777215 
>
>	for each oA in oAbsoluteMatter
>		oA.DoStuff()
>	endfor 	
>	nstep = nstep + 1
>enddo
>* end of program
>
>function ranstr
>return rand() * 100000 - 50000
>
>*class definitions
>define class absoluteMatter as Custom
>	nType = 0
>	nX = 0
>	nY = 0
>	nZ = 0
>	nDx = 0
>	nDy = 0
>	nDz = 0
>
>	procedure Init(tnType, tnX, tnY, tnZ, tnDx, tnDy, tnDz)
>	
>		this.nType = tnType
>		this.nX = tnX
>		this.nY = tnY
>		this.nZ = tnZ
>		this.nDx = tnDx
>		this.nDy = tnDy
>		this.nDz = tnDz
>		
>	endproc 
>	
>	procedure DoStuff
>
>		* draw us visuall on the screen
>*		?str(this.nType) + str(this.nX) + str(this.nY)
>		_screen.FillStyle = 0 
>		_screen.FillColor = ndotcolor && iif(this.nType = 1, rgb(255, 0, 0), rgb(0, 0, 255))
>		_screen.Circle(2, this.nX / n_scale + x_offset, this.nY / n_scale + y_offset)
>* This is for mapping z
>*		_screen.Circle(2, this.nZ / n_scale + x_offset, this.nY / n_scale + y_offset)
>
>	
>		* move inertially
>		this.nX = this.nX + this.nDx
>		this.nY = this.nY + this.nDy
>		this.nZ = this.nZ + this.nDz
>		
>		* see if there's anything to interact with
>		for each oB in oAbsoluteMatter
>			lnDx = oB.nDx
>			lnDy = oB.nDy
>			lnDz = oB.nDz
>			oB.nDx = this.nDx
>			oB.nDy = this.nDy
>			oB.nDz = this.nDz
>			this.nDx = lnDx
>			this.nDy = lnDy
>			this.nDz = lnDz
>		endfor 
>	
>	endproc
>enddefine
>
>
>function SetupScreen
>	public n_scale, x_offset, y_offset
>	n_scale = 5000
>	x_offset =	_screen.Width / 2
>	y_offset =	_screen.Height / 2
>
>
>	* Buttons
>	if type("_screen.cmdZoomIn") = "O"
>		_screen.RemoveObject("cmdZoomIn")
>	endif 	
>	_screen.AddObject("cmdZoomIn", "zoomin")
>	_screen.cmdZoomIn.Caption = "+"
>	_screen.cmdZoomIn.Visible = .T.
>
>	if type("_screen.cmdZoomOut") = "O"
>		_screen.RemoveObject("cmdZoomOut")
>	endif 	
>	_screen.AddObject("cmdZoomOut", "zoomout")
>	_screen.cmdZoomOut.Caption = "-"
>	_screen.cmdZoomOut.Top = 60
>	_screen.cmdZoomOut.Visible = .T.
>
>	if type("_screen.cmdQuit") = "O"
>		_screen.RemoveObject("cmdQuit")
>	endif 	
>	_screen.AddObject("cmdQuit", "quit")
>	_screen.cmdQuit.Caption = "exit"
>	_screen.cmdQuit.Top = 80
>	_screen.cmdQuit.Visible = .T.
>
>
>	if type("_screen.cmdUp") = "O"
>		_screen.RemoveObject("cmdUp")
>	endif 
>	_screen.AddObject("cmdUp", "mup")
>	_screen.cmdUp.Caption = ""
>	_screen.cmdUp.Visible = .T.
>	_screen.cmdUp.Width = 40
>	_screen.cmdUp.Top = 20
>	_screen.cmdUp.Left = 40
>
>	if type("_screen.cmdDown") = "O"
>		_screen.RemoveObject("cmdDown")
>	endif 
>	_screen.AddObject("cmdDown", "mdown")
>	_screen.cmdDown.Caption = ""
>	_screen.cmdDown.Visible = .T.
>	_screen.cmdDown.Width = 40
>	_screen.cmdDown.Top = 40
>	_screen.cmdDown.Left = 40
>
>	if type("_screen.cmdLeft") = "O"
>		_screen.RemoveObject("cmdLeft")
>	endif 	
>	_screen.AddObject("cmdLeft", "mleft")
>	_screen.cmdLeft.Caption = ""
>	_screen.cmdLeft.Visible = .T.
>	_screen.cmdLeft.Width = 40
>	_screen.cmdLeft.Top = 30
>	_screen.cmdLeft.Left = 0
>
>	if type("_screen.cmdRight") = "O"
>		_screen.RemoveObject("cmdRight")
>	endif
>	_screen.AddObject("cmdRight", "mright")
>	_screen.cmdRight.Caption = ""
>	_screen.cmdRight.Visible = .T.
>	_screen.cmdRight.Width = 40
>	_screen.cmdRight.Top = 30
>	_screen.cmdRight.Left = 80
>
>return
>
>function RefreshScreen
>*	clear 
>	doevents
>	_screen.Line(0, y_offset, _screen.Width, y_offset)
>	_screen.Line(x_offset, 0, x_offset, _screen.Height)
>return 
>
>define class zoomin as CommandButton
>	procedure click
>		n_scale = n_scale - 25000
>	return 
>enddefine
>define class zoomout as CommandButton
>	procedure click
>		n_scale = n_scale + 25000
>	return 
>enddefine
>define class mup as CommandButton
>	procedure click
>		y_offset = y_offset + 100
>	return 
>enddefine
>define class mdown as CommandButton
>	procedure click
>		y_offset = y_offset - 100
>	return 
>enddefine
>define class mright as CommandButton
>	procedure click
>		x_offset = x_offset - 100
>	return 
>enddefine
>define class mleft as CommandButton
>	procedure click
>		x_offset = x_offset + 100
>	return 
>enddefine
>define class quit as CommandButton
>	procedure click
>		lquit = .t.
>	return 
>enddefine
>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform