Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defclass random-world (world)
- ((initial-random-state :initarg :initial-random-state :accessor initial-random-state))
- (:default-initargs :initial-random-state (make-random-state t)))
- (defmethod shared-initialize :after ((world random-world) slot-names &rest initargs &key)
- (declare (ignore slot-names initargs))
- (let ((*random-state* (make-random-state (initial-random-state world))))
- ;; Add random objects to the world
- ))
- (defmethod reinitialize-instance :before ((world random-world) &rest initargs)
- (declare (ignore initargs))
- (clear-objects world)) ; tbd
- (defun random-worlds-generator (n)
- (let ((worlds (map-into (make-array n) (lambda () (make-instance 'random-world)))))
- (lambda (index)
- (reinitialize-instance (aref worlds (mod index n))))))
Add Comment
Please, Sign In to add comment