mardi 28 novembre 2017

How incorporate random-float into a command? NETLOGO

To eat ;to kill prey and eat it
  let kill one-of prey-here in-radius smell
  ;need to code in a variable for success too
  if kill != nobody
    [ask kill [ die ]
      set energy energy + 10000]
end

At present this is my command for my turtle to eat prey when they run into them on the map. I want to add a variable so that there is a chance they don't get to eat. I know I need to use random-float 1

if random float is > .4 [what happens] 

but i do not know where to add it into my eat commands so that it works.

can someone please advise?




Aucun commentaire:

Enregistrer un commentaire