【发布时间】:2016-02-23 08:00:39
【问题描述】:
读者,
我是 NetLogo 的初学者。请帮助我解决以下代码的一些问题:
- 我收到错误消息“您不能在海龟上下文中使用刻度,因为刻度是仅观察者。
- 我需要在每只海龟都完成“到达接收、到达分流、go-drroom”这三个操作后更新刻度值。
-
其他人没有在到达接待处走动,到达分流正在运行。
to setup-people set-default-shape turtles "person" set destination ( patch-set patch -2 34 patch 8 34 ) create-turtles uninfected [ set color blue allocate-turtles ] create-turtles infected [ set color red allocate-turtles ] end to allocate-turtles if (pcolor = 9.9 and any? turtles-here) [ set size 1.5 set heading 0 setxy int random-xcor int random-ycor ] end to go move-people arrive-reception arrive-triage go-drroom tick end to move-people ask turtles [ rt 360 forward 1 ] end to arrive-reception ask n-of (random count turtles) turtles [ if windows = 1 [ move-to patch -2 34 ifelse not any? turtles-here [ wait wait-time ] [ wait-in-queue ] ] ] end to wait-in-queue set arrival-time ticks bk 1 if any? other turtles-here [ wait-in-queue ] wait wait-time if ticks - arrival-time > wait-time [ set arrival-time 0 fd 1 ] end to arrive-triage if triage = "Open" [ move-to patch 26 11 if any? other turtles-here [ wait-in-queue] wait wait-time move-to one-of patches with [pcolor = 109 and not any? other turtles-here ] wait wait-time ] end to go-drroom move-to one-of patches with [pcolor = 128] if ( min-one-of other turtles in-radius 5 [distance myself] != nobody) [ move-to one-of patches with [pcolor = 129] if ( min-one-of other turtles in-radius 5 [distance myself] != nobody) [ move-to one-of patches with [pcolor = 5] if any? seats with [turtles = nobody] [ move-to one-of max-n-of 6 neighbors [seats] ] ] ] wait wait-time die end
谢谢。
【问题讨论】:
-
如何让海龟在队列中排成一列,一个接一个地排在另一个 n 服务的 fifo 方式
标签: netlogo