Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

;; code écrit par Dr Paul Python Ndekou pour le cours de mardi 15 Fevrier 2021

globals[temperature compteurPatch trouve?]


patches-own[
tmperature ctpatch]
turtles-own[
listT
etatSanitaire
nbTurtlesPatch
]
to setup1
clear-all
ask patches [set pcolor green]
create-turtles 4 [set color white set size 2 set shape "cow" setxy 10 12]
reset-ticks
end

to setup2
clear-all
ask patches [set pcolor green]
create-turtles nbturtles [set color white set size 2 set shape "cow" setxy random
20 random 15]
reset-ticks
end

to setup3
clear-all
ask patches [set pcolor green]
create-turtles 4 [set color white set size 2 set shape "cow" move-to one-of
patches]
reset-ticks
end

to setup4
clear-all
ask patches [set pcolor one-of [blue brown]]
create-turtles 4 [set color white set size 2 set shape "cow" move-to one-of
neighbors with [pcolor = brown]]
reset-ticks
end
to setup5
clear-all
ask patches [set pcolor one-of [blue brown]]
create-turtles 4 [set color white set size 2 set shape "cow" move-to one-of
patches at-points [[-10 10] [-10 11] [-10 12] [-10 13] [-10 14]]]
reset-ticks
end

to setup6
clear-all
ask patches [set pcolor green]
create-turtles 4 [set color one-of [white blue] set size 2 set shape "cow" move-
to one-of neighbors]
;;ask turtles with[color = white][die]
ask turtles with[color = blue][die]
reset-ticks
end

to setup7
clear-all
ask patches[set tmperature one-of [10 15 20 25 30 35 40 45] set pcolor red set
ctpatch count patches with [tmperature = 25]]
reset-ticks
end

to setup8
clear-all
ask patches[set tmperature one-of [10 15 20 25 30 35 40 45] set pcolor red set
ctpatch count patches with [tmperature = 25]]
create-turtles 100 [set color yellow set size 2 set shape "person" move-to one-of
patches]
ask turtles[ set etatSanitaire one-of ["sain" "infecte" "sain" "infecte" "sain"
"sain"]]
;; ask turtles[ set etatSanitaire one-of ["sain" "infecte"]]
reset-ticks
end
to setup9
clear-all
ask patches [set pcolor green]
create-turtles 5 [set color white set size 2 set shape "cow" setxy 10 12 set
nbTurtlesPatch 0 set listT [] ]
ask turtles[ set etatSanitaire one-of ["sain" "sain" "sain" "sain" "sain"
"sain"]]
reset-ticks
end
to listContact

ask turtles [set listT turtles-on patch-here set nbTurtlesPatch count turtles-on
patch-here if any? turtles-here with [etatSanitaire = "infecte"][set color red]]
end

to go

ask turtles[ set etatSanitaire one-of ["sain" "infecte" "sain" "infecte" "sain"
"sain"]]
tick
end

You might also like