我正在模拟我所在城市(智利比尼亚德尔马)发生的危急情况,如果发生海啸,“地铁”(地铁)可能会出现严重问题,因为疏散出口没有做好准备,也没有妥善管理。
这个例子是一个简单的真实模型,但是我试图让海龟从地铁(蓝色斑块)移动,使用门(石灰补丁)然后跳进铁路(灰色)时遇到了很大的问题。补丁)。当我最终让他们做出这些行动时,我发现了两个问题:(1)刻度线不能按我需要的方式工作。我需要它像一个时钟一样运行,数秒。 (2)我创建了3个名为“check-vecinos-azul / lime / grey”的动作,他们需要检查是否有任何乌龟(邻居)。如果乌龟周围有一个空的空间,它会移动到那个空位,否则它会一直存在,直到它找到一个空的位置。
如果你们中的任何人能够给我一个关于我模特的帮助/提示,我会很高兴。
谢谢你们,
亲切的问候,
菲利普。
breed [pasajeros pasajero]
turtles-own [
distancia
speed
speed-limit
speed-min
evacuacion
]
patches-own
[
pvacio
]
to setup
ca
setup-patches
setup-pasajeros
reset-ticks
end
to setup-patches
ask patches with [pycor <= 0]
[set pcolor blue - 1]
ask patches with [pycor > 0]
[set pcolor gray + 2]
ask patch 0 0 [set pcolor lime]
end
to setup-pasajeros
ask n-of num-pasajeros (patches with [pcolor = blue - 1])
[
sprout-pasajeros 1
[set size 1
set color orange
set speed 0.1 + random-float 0.9
set speed-limit 1
set speed-min 0
set evacuacion 0
]
]
end
to go
ask pasajeros [
ifelse evacuar?
[
go-puerta
salir-puerta
move-chancado
]
[
stop
]
]
tick
end
to go-puerta
ask turtles with [pcolor = blue - 1]
[
set evacuacion 1
if evacuacion = 1
[
check-vecinos-azul
face min-one-of patches with [pcolor = lime][distance myself]
fd speed ;;
]
]
end
to salir-puerta
ask turtles with [pcolor = lime]
[
set evacuacion 1
if evacuacion = 1
[
check-vecinos-lime
face min-one-of patches with [pcolor = gray + 2][distance myself]
fd speed
]
]
end
to move-chancado
ask turtles with [pcolor = gray + 2]
[
set evacuacion 1
check-vecinos-gray
]
end
to check-vecinos-azul
ifelse not any? turtles-on one-of neighbors
[
wait 0
move-to min-one-of patches with [pcolor = blue - 1][distance myself]
fd speed
]
[
wait 0.5
]
end
to check-vecinos-lime
ifelse not any? turtles-on one-of neighbors
[
wait 0
face one-of patches with [pcolor = gray + 2]
fd speed
]
[
wait 0.5
]
end
to check-vecinos-gray
ifelse not any? turtles-on one-of neighbors
[
wait 0
face min-one-of patches with [pcolor = gray + 2][distance myself]
fd speed
]
[
wait 0.5
]
end