"expected closing bracket" error?

791 views
Skip to first unread message

Unruh Lee

unread,
Apr 18, 2021, 10:25:30 PM4/18/21
to netlogo-users
Hello, 

With the following procedure, I get an "expected closing bracket" error, with highlighting on first use of the word "magenta". 

Can anyone please help me figure out what I'm doing wrong? 

Thanks!
Lee


to grow-food-crops
  if (pcolor = green) and (corn-amount <= 1000) [ ; only work to grow food if running low
    ifelse not any? (patches with [ pcolor magenta ]) [
      move-to one-of patches with [ pcolor = yellow ] ; start new food crop garden 
      set pcolor magenta  ; to designate new garden with new pcolor
      ]
      [ move-to one-of patches with [ pcolor = magenta ]
      ] ; go to work on food crop garden another started
    set energy energy - 1 ; work on food crops takes energy
    set food-crop-growth food-crop-growth + 1 ; as food crops worked on, crop grows
    if food-crop-growth >= 100 [
       set food-crop-growth 0
       set corn-amount 1000
    ]
]
end

Dale Frakes

unread,
Apr 18, 2021, 11:00:31 PM4/18/21
to netlog...@googlegroups.com
Hi Lee,

right before where you highlighted "magenta" you need to put an "=" sign (just like the line below).

Also it's helpful to post the whole model/code when asking for help since that allows for quicker answers.

Dale
--
You received this message because you are subscribed to the Google Groups "netlogo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netlogo-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netlogo-users/81e87c82-7905-4370-ac0a-5b750e1d1df0n%40googlegroups.com.

-- 
Dale Frakes
Adjunct Instructor, PhD Candidate
PSU Systems Science
dfr...@pdx.edu - http://web.pdx.edu/~dfrakes/

Unruh Lee

unread,
Apr 18, 2021, 11:03:17 PM4/18/21
to Dale Frakes, netlog...@googlegroups.com
Thank you!

You received this message because you are subscribed to a topic in the Google Groups "netlogo-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/netlogo-users/gXC6xvfrBF4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to netlogo-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netlogo-users/4584a684-f45a-ec34-fcee-3a9457588e96%40pdx.edu.
Reply all
Reply to author
Forward
0 new messages