clear set decimals to 6 * For da loop public lquit, lrestart, ndotcolor, nstep lquit = .F. lrestart = .T. nstep = 0 SetupScreen() * Setup Initial Conditions public oAbsoluteMatter RAND(-1) _screen.BorderStyle = 0 _screen.FillStyle = 0 ndotcolor1 = rand() * 16777215 ndotcolor2 = rand() * 16777215 _screen.FillColor = ndotcolor1 && iif(this.nType = 1, rgb(255, 0, 0), rgb(0, 0, 255)) _screen.ForeColor = ndotcolor2 && iif(this.nType = 1, rgb(255, 0, 0), rgb(0, 0, 255)) * Perform rules do while not lquit if lRestart GetColors() oAbsoluteMatter = .NULL. oAbsoluteMatter = createobject("collection") rand(0) for ln1 = 1 to 30 oAbsoluteMatter.Add(createobject("absoluteMatter", 1, ranstr() , ranstr() , ranstr() , ; ranstr() , ranstr() , ranstr() )) endfor lRestart = .F. endif _screen.Caption = "VFP Monads Step: " + transform(nstep) RefreshScreen() 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.Circle(GetRandRadious(), this.nX / n_scale + x_offset, this.nY / n_scale + y_offset) * This is for mapping z _screen.Circle(GetRandRadious(), 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 if type("_screen.cmdRestart") = "O" _screen.RemoveObject("cmdRestart") endif _screen.AddObject("cmdRestart", "restart") _screen.cmdRestart.Caption = "restart" _screen.cmdRestart.Top = 100 _screen.cmdRestart.Visible = .T. if type("_screen.tmrColorTimer") = "O" _screen.RemoveObject("tmrColorTimer") endif _screen.AddObject("tmrColorTimer", "ColorTimer") _screen.tmrColorTimer.interval = GetRandInterval() _screen.tmrColorTimer.enabled = .t. return function RefreshScreen * clear doevents *_screen.Line(0, y_offset, _screen.Width, y_offset) *_screen.Line(x_offset, 0, x_offset, _screen.Height) return FUNCTION GetRandRadious() gnLower = 2 gnUpper = 10 return INT((gnUpper - gnLower + 1) * RAND( ) + gnLower) ENDFUNC FUNCTION GetRandInterval() gnLower = 100 gnUpper = 10000 return INT((gnUpper - gnLower + 1) * RAND( ) + gnLower) ENDFUNC FUNCTION GetColors() ndotcolor1 = rand() * 16777215 ndotcolor2 = rand() * 16777215 IF ndotcolor2 = ndotcolor2 ndotcolor2 = rand() * 16777215 ENDIF _screen.FillColor = ndotcolor1 && iif(this.nType = 1, rgb(255, 0, 0), rgb(0, 0, 255)) _screen.ForeColor = ndotcolor2 && iif(this.nType = 1, rgb(255, 0, 0), rgb(0, 0, 255)) ENDFUNC 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 define class restart as CommandButton procedure click lrestart = .t. return enddefine define class ColorTimer as timer procedure timer GetColors() this.Interval = GetRandInterval() return enddefine>I use an algorithm that manipulate monads.