1

I am using an existing model in netlogo called Chemical Equilibrium and am adding some more code. I want to add turtles (catalyst) which have no effect on the reaction/other turtles but speeds up the FORWARD reaction, which has been defined as follows:

to react-forward [t]
  ask t [ set color red ]
  set color green
  rt random-float 360
  jump 2
end

I was thinking that I should put a switch and a slider, make the turtles into whitemols or I do a turtles-own [catalyst] and then define that like I have done with temperature and pressure. I tried the following but it didnt work.

turtles-own [speed catalyst]
  crt whitemols
  [ set color white
    randomize
    set speed 1
  ]

I know the above code is incorrect but am not sure how to code this particular feature.

JenB
  • 17,620
  • 2
  • 17
  • 45
user286190
  • 41
  • 3

1 Answers1

2

There are many ways to do this, of course. I can't tell what is going on in your program from the little snipped you include.

One way would be to have the catalyst be of a different breed:

breed [catalysts catalyst]
breed [chemical-x chemical-x]
;and so on

;then the forward reaction is sped up by the existence of catalysts

to react-forward
  let num-catalysts count catalysts
  ;speed up by num-catalysts
  ;...
end
Jose M Vidal
  • 8,816
  • 6
  • 43
  • 48
  • and i also want to make it so that the catalyst can be switched on and off..so one can see the effects with and without the catalyst..i tried putting a switch in but catalyst has already been defined hence i didnt want to use breed otherwise the code does works – user286190 Mar 06 '10 at 17:23