0

I wrote this net logo code, but having an error all the time. It's expecting commands on the economic conditions and other parameters, but I don't know how to put the command. Can someone identify me the problems?

to setup-interface
 ; Set up the view
  resize-world 0 100 0 100 ; Adjust the world size as per your requirements
  set-patch-size 5 ; Adjust the patch size as per your requirements
end

  
to create-monitor
  ; Create monitors `your text`
  create-monitor "Economic Conditions" [
    set label "Economic Conditions: "
    set "economic-conditions"
  ]
  create-monitor "Resource Availability" [
    set label "Resource Availability: "
    set "resource-availability"
  ]
end

to create-buttons
  ; Create buttons
  create-button "Start" [ ;; Replace with the actual simulation procedure
    set label "Start"
    set action "simulate"
    set target "go"
  ]
  create-button "Pause" [ ;; Replace with the actual pause procedure
    set label "Pause"
    set action "stop"
    set target "go"
  ]
  create-button "Reset" [ ;; Replace with the actual reset procedure
    set label "Reset"
    set action "setup"
    set target "go"
  ]
  
  ; Customize button positions
  let button-spacing 10
  let button-height 20
  let button-width 60
  let button-offset 30
  set-button 1 "Start" (- button-width - button-spacing) (- button-height - button-spacing - button-offset)
  set-button 2 "Pause" (- button-spacing) (- button-height - button-spacing - button-offset)
  set-button 3 "Reset" (button-width + button-spacing) (- button-height - button-spacing - button-offset)
  
  ; ...
end

After the setup-interface, it's just the codes for the interface.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
  • I feel like I'm missing something. What exactly are you trying to do? Did you actually define `create-monitor` and `create-button` somewhere else? Or are you using breeds for them? – LeirsW May 26 '23 at 06:59
  • in create-Monitor "Economic Conditions" it's expecting command..how do I give command here? –  May 26 '23 at 08:53
  • 2
    A command is the term for a procedure that does something. For example `set`, `forward`, resize-world` etc. `create-monitor` doesn't exist.Now you did create a procedure called `create-monitor`, and you are calling `create-monitor` within `create-monitor` (horrible idea, you get stuck in a loop referencing itself once Netlogo actually lets you run it). So anyway, `create-monitor` is technically a command but it is a command that doesn't take any input, so once Netlogo has executed `create-monitor`, it expects to find the next command procedure, but instead it finds a string. – LeirsW May 26 '23 at 09:53
  • 1
    Your code reads like it was generated by an LLM like ChatGPT. For example, the `create-monitor` procedure calls a `create-monitor` command as if it is a plural breed name. Is it a recursive procedure? Is it a breed name? If it is a recursive function, you should rename your breed. If `monitor` is a plural breed name, you should rename your procedure + pass it a number, not a string. In any case, ChatGPT is known to make a lot of errors when generating NetLogo code. I'd recommend you learn the basics of NetLogo programming before generating code with LLMs to be able to catch such issues. – umit1010 May 26 '23 at 16:53
  • @LeirsW the structure of the code shows rather a panic, not a systematic work. The as-was code seemed to me to might have had an idea of someone else, copy/paste'd into what looked as an infinite self-recurrent calls, whereas the original might had another idea - a structured approach of calling en bloc ... `to create-monitors ... end` ( in which a call to `create-monitor` makes sense, yet a copy/paste-error in text-alike manipulation, without a proper insight into the *ABM*, into the computing-tools, into the strategy of how to setup the simulation ecosystem, was the root cause of this. – user3666197 May 26 '23 at 16:55
  • @umit1010 let me present you a different view **(a)** ChatGPT, as other "pre-trained" transformers, have zero cognition, these engines are self-tuning masochists, who guestimate, what (transformation)-choices cost them the least ( the least pain from penalty function during many trial-error runs over a so far seen training DataSET ). That does not create insight, knowledge, the less a capability to create ( copy/paste alike "attempts" are neither a capability to create, the less correctly solve a given problem, just a guess, for which the transformer was least penalised in training ... – user3666197 May 26 '23 at 17:04
  • @user3666197 thank you for the follow-up. I did not indent to criticize people who use LLMS to learn programming (or Tawsif for posting this question). I just wanted to caution that although LLMs like ChatGPT and GitHub Copilot do amazing for languages like Python and Javascript, they are not yet ready to have the same utility for NetLogo. GPT v4 is better than v3.5, but still not there. I am looking forward to LLMs that know NetLogo well. I think it'll be fantastic. Until that happens, it may be better to caution new learners so that they do not get stuck in their learning process. – umit1010 May 26 '23 at 17:13

1 Answers1

2

It looks like OP tried using ChatGPT or something similar in order to generate a NetLogo interface (including buttons and monitors), which completely failed since those things aren't meant to be setup from the code tab in the first place.

Instead, you just go to the interface and right click somewhere, after which you select the interface element you want to add

enter image description here

user3666197
  • 1
  • 6
  • 50
  • 92
LeirsW
  • 2,070
  • 4
  • 18
  • IIRC, the Netiquette promotes our answers ought be fact-based, not guesses - thank you for your kind reconsideration of the posted pair of opinions – user3666197 May 26 '23 at 17:40
  • @user3666197 I'm not sure what you want me to do here. I do believe my answer is a solid one if the assumption for the chatGPT holds true. If it turns out that this was not the case, I will gladly remove it. – LeirsW May 26 '23 at 21:21