English 中文(简体)
(Line 36) 这里的预计数,而不是一个清单或框架
原标题:(Line 36) Expected a number here, rather than a list or block
  • 时间:2024-01-23 19:54:01
  •  标签:
  • netlogo

Don t know what this really means or what s causing this. My code is heavily modeled from the community model "Fire" The Error:

(Line 36) Expected a number here, rather than a list or block.
globals [
  initial-plants  
  triggered-plants    
]

breed [signals signal]   

to setup
  clear-all
  set-default-shape turtles "square"
  ask patches with [(random-float 100) < density]
    [ set pcolor green ]
  ask patches with [pxcor = min-pxcor]
    [ transmit ]
  set initial-plants count patches with [pcolor = green]
  set triggered-plants 0
  ask patches with [ pcolor = red ] [
    ; See if there is any possible neighbor patch
    ; to whom I can spread my lack of concentration
    let target one-of neighbors4 with [ pcolor = green ]

    ; if the target exists, have them change their color
    if target != nobody [
      ask target [ 
        set pcolor red
      ]
    ]
  ]
  reset-ticks
end

to go
  if not any? turtles  
    [ stop ]
  ask signal
    [ask neighbors4 with [pcolor = green]
      [ transmit ] ]
  tick
end

to transmit  
  start signal 1
    [ set color blue ]
  set pcolor black
  set triggered-plants triggered-plants + 1
end
问题回答

你们使用“信号”这样说,但需要使用多元的“信号”。 或具体指明了哪些信号,例如who- number (ask sign 1 [...)。 这就是你描述的错误来自何处。

此外,由于你使用的未定义的<条码><>>>>>> /代码,你犯了一个错误,但我认为这是你正在做的事吗?

页: 1

globals [
  initial-plants  
  triggered-plants    
]

breed [signals signal]   

to setup
  clear-all
  set-default-shape turtles "square"
  ask patches with [(random-float 100) < density]
    [ set pcolor green ]
  ask patches with [pxcor = min-pxcor]
    [ transmit ]
  set initial-plants count patches with [pcolor = green]
  set triggered-plants 0
  ask patches with [ pcolor = red ] [
    ; See if there is any possible neighbor patch
    ; to whom I can spread my lack of concentration
    let target one-of neighbors4 with [ pcolor = green ]

    ; if the target exists, have them change their color
    if target != nobody [
      ask target [ 
        set pcolor red
      ]
    ]
  ]
  reset-ticks
end

to go
  if not any? turtles  
    [ stop ]
  ask signals
    [ask neighbors4 with [pcolor = green]
      [ transmit ] ]
  tick
end

;to transmit  
;  start signal 1
;    [ set color blue ]
;  set pcolor black
;  set triggered-plants triggered-plants + 1
;




相关问题
netlogo runtime error turtles on

while running the following code if any? (turtles-on patch-ahead q) [ some commands ] where q is a number variable there is a run time error saying: turtles-on expected the input to be agent or ...

netlogo programing help on traffic simulation

I am trying to find if there is a turtle on patch-ahead n whose speed - acceleration is <= 0. The code I came up with is: if any? turtles on patch-ahead n with [speed <= (speed - acceleration)]...

NetLogo - reading and writing to a text file for Java API use

I want to use the Java API in my NetLogo program. For that, I need to write to a text file and read input from a text file. How can this be done in NetLogo? Additionally - what are the ways by which ...

Using the NetLogo API to get turtle coordinates

I am trying to get coordinates for turtles in NetLogo by using the Java API. I have managed to get the workspace loaded and have been using the following code that I made: public static int getX(...

How to create maze walls in NetLogo?

I am trying to create a 5x5 grid with 2 exits and put some walls in it. In other words, I want to create a maze or a labyrinth. I was wondering if there is a way to make a border line thicker or ...

热门标签