All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sim.app.scheme.tutorial2.scm Maven / Gradle / Ivy

Go to download

MASON is a fast discrete-event multiagent simulation library core in Java, designed to be the foundation for large custom-purpose Java simulations, and also to provide more than enough functionality for many lightweight simulation needs. MASON contains both a model library and an optional suite of visualization tools in 2D and 3D.

The newest version!
;;; Copyright 2006 by Sean Luke
;;; Licensed under the Academic Free License version 3.0
;;; See the file "LICENSE" for more information

(define-simple-class  ()
  
  (display type: )
  (displayFrame type: )
  (gridPortrayal type: 
		 init-form: ())            
  
  ((*init*)
   (invoke-special  (this) '*init*
		   ( (:currentTimeMillis))))
  
  ((*init* (state :: ))
   (invoke-special  (this) '*init* state))

  ((getName) :: 
   allocation: 'static
   (*:toString "Tutorial2: Life"))
  
  ((setupPortrayals) :: 
   (gridPortrayal:setField (:.grid state))
   (gridPortrayal:setMap 
    (
     ( ( 0 0 0 0)
		     :blue))))
  
  ((start) :: 
   (invoke-special  (this) 'start)
   (setupPortrayals)
   (display:reset)
   (display:repaint))
  
  ((init c :: ) :: 
   (invoke-special  (this) 'init c)
   (let ((tut ::  (as  state)))
     (set! display ( 
		    (* tut:gridWidth 4) 
		    (* tut:gridHeight 4) 
		    (this) 1))
     (set! displayFrame (display:createFrame))
     (c:registerFrame displayFrame)
     (displayFrame:setVisible  #t))
   (display:attach gridPortrayal (*:toString "Life"))
   (display:setBackdrop :black))
  
  ((load state :: ) :: 
   (invoke-special  (this) 'load state)
   (setupPortrayals)
   (display:reset)
   (display:repaint)))

        
                    




© 2015 - 2025 Weber Informatics LLC | Privacy Policy