不同坐标x y的平滑运动与gaped滴答时间

时间:2015-01-05 03:14:09

标签: netlogo

简化问题

每个代理都有离散的tick-list,x-list,y-list。 例如,代理人1     t-list [1 5 10 15]     x-list [2 3 4 5]     y-list [6 7 8 9] 我们想要 1,检查此代理是否在当前刻度和下一刻之间移动 2,如果移动,填写未命中的勾选之间的移动路径。 3,首先填补路径然后避开障碍和避开人群

代码是

to go
; check if updates are needed

ask turtles [

   let dex item 1 x-list - item 0 x-list
   let dey item 1 y-list - item 0 y-list

  if ( first t-list = ticks and dex = 0 and dey = 0 )  [
    ; update agent's location
    set xcor first x-list
    set ycor first y-list    
    set t-list but-first t-list
    set x-list but-first x-list
    set y-list but-first y-list
  ]
  if (ticks > first t-list and dex != 0 or dey != 0)[
    move-to patch-at (xcor + dex) (ycor + dey)
    ;; according to raw data, the interval of recorded t is fixed and equal to 12
    fd ( dex + dey ) / 12 
    set t-list but-first t-list
    set x-list but-first x-list
    set y-list but-first y-list 
    ]       
 pendown
 ]
 ; stop if lists for all agents are empty
 if all? turtles [ ticks > last t-list ] [
 stop
 ]
 tick 
 end

检查dex后我需要帮助! = 0并干! = 0,我想让代理人一步一步地移动(xcor + dex / det)(ycor + dry / det)每次打勾t-list + 1

感谢您的帮助!

0 个答案:

没有答案