Escolar Documentos
Profissional Documentos
Cultura Documentos
Net Log On Test Ado
Net Log On Test Ado
[ postoAt
; variavel qtds de paciente q se dirigem ao posto de atendim
ento.
zonaA
; variavel para guardar a qtds de pacientes q se dirigem no
s hospitais de especialidade.
zonaB
; variavel para guardar a qtds de pacientes q se dirigem ao
hospital privado.
preso ]
;qtds de pesso q morrem.
;---------------------------------------------------------------------------------------------------------------------to setup
; metodo inicializar
ca
import-pcolors-rgb Imagem
; importa uma imagem no chooser
criar_comandosP
; metodo criar hospitais e clinicas
criar_populacao
criar_criminosos
criar_agentes
; metodo criar paciente
set postoAt 0
; iniciaza variavel posto para zero
end
;---------------------------------------------------------------------------------------------------------------------to executar
; metodo executar
;ask turtles[atender_populacao]
; executa o procedimento atender_populao
;ask turtles[crime]
; ask turtles[cadeia]
;ask turtles[detecao]
end
;---------------------------------------------------------------------------------------------------------------------to criar_comandosP
ask patch -120 345
[
sprout 1 [ set size 10
EL "Comando Provincial" ]
]
ask patch 160 375
[
sprout 1 [ set size 10
EL "Comando Municipal" ]
]
ask patch 160 -375
[
sprout 1 [ set size 10
ra Policial" ]
]
ask patch 0 418
[
sprout 1 [ set size 10
" ]
]
ask patch -120 -400
[
sprout 1 [ set size 10
" ]
]
set color yellow SET SHAPE "house two story" SET LAB
set color yellow SET SHAPE "house two story" SET LAB
END
;---------------------------------------------------------------------------------------------------------------------------------
to criar_posto_atendimento
ask patch 20 0
[
sprout 1 [ set size 10 set color black SET SHAPE "telephone" SET LABEL "Cen
tral de Atendimento" ]
] ; Posto de Atendimento
end
;----------------------------------------------------------------------------------------------------------------------------------------TO criar_populacao
create-turtles Municipes
[ set color brown setxy random -190 random 150 set size 20 fd 25 set shape "
person" ;random Pacientes
if who = 2 or who = 3 or who = 4 or who = 5 or who = 6 or who = 7 or who =
8 or who = 9 or who = 10[set color black]
]
end
TO criar_criminosos
create-turtles Criminosos
[ set color red setxy random -160 random 120 set size 20 fd 25 set shape "pe
rson" ;random Pacientes
]
end
TO criar_agentes
create-turtles Agentes
[ set color blue setxy random 160 random 160 set size 20 fd 25 set shape "pe
rson" ;random Pacientes
]
end
;---------------------------------------------------------------------------------------------------------------------to atender_populacao
if shape = "person" and color = brown
[ forward random 100
set color lime
set heading random 360
without-interruption [
if any? other turtles-here with [shape = "telephone"][set postoAt posto
At + 1 ]
]]
end
;---------------------------------------------------------------------------------------------------------------------to crime
if shape = "person" and color = black [
without-interruption [
if any? turtles-here with [shape = "target"] [ set color red]
plot (count turtles with [color = red])
]]
end
to cadeia
if shape = "person" and color = red [
without-interruption [
if any? turtles-here with [shape = "police"] [ die ]
plot (count turtles with [color = red])
]]
end
to detecao
if shape = "person" and color = red [
without-interruption [
if any? turtles-here with [shape = "person" and color = blue] [ die ]
plot (count turtles with [color = red])
]]
end