dimanche 29 mars 2015

NetLogo - Random setup - Random value to each patch - Error

As part of the setup procedure I am trying to use a slider to set the density of patches which will be displayed and assigned a random value. The slider on the interface for density ranges 0 to 100 and the random value of the patch is set using an input on the interface. This will normally be set in the region go 4. So, if 50% is set the the procedure will assign 50% of the patches with a random value.


When i do i get the following error: "Expected command" and the variable 'error-count' is highlighted in the code.



;; The density of patches to be set with a random value is set using variable init-errors on interface.
;; Every patch uses a task which reports a random value.
;; The random value is set using variable error-count on interface
to setup-random
ask patches [
if (random-float 100.0) < init-errors
[setup task random error-count]
]
end




Aucun commentaire:

Enregistrer un commentaire