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

sim.app.scheme.tutorial1.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  ()

  (grid type: )
  (gridWidth type:  init-form: 100)
  (gridHeight type:  init-form: 100)
  
  ;; the bHeptomino
  (bHeptomino type: 
	      allocation: 'static
	      init-form: (
			      ( 0 1 1)
			      ( 1 1 0)
			      ( 0 1 1)
			      ( 0 0 1)))

    ;;; constructor
  ((*init* seed :: )
   (invoke-special  (this) '*init* seed))
  
  ;; void seedGrid
  ((seedGrid) :: 
   (let ((b ::  bHeptomino)
	 (f ::  grid:field))
     (do ((x ::  0 (+ x 1))) ((= x b:length))
       (do ((y ::  0 (+ y 1))) ((= y (b x):length))
	 (set! ((f (+ x (/ f:length 2) (- (floor (/ b:length 2)))))
		(+ y (/ (f x):length 2) (- (floor (/ (b x):length 2)))))
	       ((b x) y))))))
  
  ;; public void start()
  ((start) :: 
   (invoke-special  (this) 'start)
   (set! grid ( gridWidth gridHeight))
   (seedGrid)
   (schedule:scheduleRepeating ())))




© 2015 - 2025 Weber Informatics LLC | Privacy Policy