ofile := "/tmp/simul.dat" ;; gnuplot := "/usr/bin/gnuplot" ;; type chemical = `Prey | `Predator ;; type population = [chemical]bag ;; S0 := 1500 * `Prey + 50 * `Predator ;; trans rules = { `Prey ={ C = 1. }=> `Prey, `Prey; `Predator ={ C = 1. }=> ; `Predator, `Prey ={ C = 0.001 }=> `Predator; `Predator, `Prey ={ C = 0.001 }=> `Predator, `Predator; } ;; rules[strategy = `gillespie](S0) ;; fun output(S) = ( if iteration % 10 == 0 then let nb_preys = count(`Prey,S) and nb_predators = count(`Predator,S) in ofile << tau << " " << nb_preys << " " << nb_predators << "\n" fi; S ) ;; rules[strategy = `gillespie, prelude = output, interlude = output, postlude = output, iter = 100000 ](S0) ;; gnuplot << " plot \"" + ofile + "\" u 1:2 w l\n" ;; gnuplot << "replot \"" + ofile + "\" u 1:3 w l\n" ;;