Netlogo programming

145 views
Skip to first unread message

Snehal Shinde

unread,
Aug 1, 2018, 9:32:46 AM8/1/18
to netlogo-users
Hi everyone,

I'm new to the group but I've been using Netlogo for a couple years now. 
I'm pretty proficient and my code currently works, but I want to make sure
that it works how I think it does.  

My main chunk of code includes the following (in pseudocode):

Hi all,


I am working in the netlogo. I am stuck in my code. 

 ask turtles
    [

      if (color = yellow )[
      ask turtles-on neighbors
      [
        if (color = red)
          [set  color[blue] of myself
          ;  set type "AMF"
        ]

      ] ]

    ]

I want to refer the turtle of color yellow 

And I want to change  [set  color[blue] of myself] this command for turtles with color yellow.
In this code turtles with color red are changed to blue, As it accesses current red colored turtles

Please help me out in this.
It will be of great help.
What is to be done

Nelson Kemboi

unread,
Aug 1, 2018, 10:28:18 AM8/1/18
to Snehal Shinde, netlogo-users
can someone recommend me some online course that teaches netlogo from A to Z

--
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-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netlogo-users/059d30a4-f57a-4bc3-b585-0c45cbe9b47d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--


Best Regards,
Nelson Kemboi Yego,
+254 723 695 775/ +250783124018

Alan Isaac

unread,
Aug 1, 2018, 10:40:07 AM8/1/18
to netlog...@googlegroups.com
On 8/1/2018 10:28 AM, Nelson Kemboi wrote:
> can someone recommend me some online course that teaches netlogo from A to Z


All of NetLogo is too big for a single course.

My online summer course teaches a good amount of NetLogo,
but it is too late for this summer. However, the syllabus
might serve as a guide for independent study:
https://subversion.american.edu/aisaac/syllabi/450syl.html
You will note that the course uses Railsback and Grimm as a textbook.
This book is also quite good for introductory independent study.
I would also point you to Wurzer's extensive online tutorials.

Cheers, Alan Isaac

Swannack, Todd M CIV USARMY CEERD-EL (US)

unread,
Aug 1, 2018, 11:09:29 AM8/1/18
to netlogo-users
I'm not sure your code is doing what it should be doing. Do you want to change the yellow turtles to blue or the red turtles to blue? I would approach this a little differently. I'd ask the yellow turtles to ask their neighbors if they had any red turtles, then I'd change the color of the turtles. I've written some code that will either turn the asking agent blue (noted by *), or the neighboring turtles blue (noted by **)

I'm sure there's a more elegant way to do this, but I'm still learning the self/myself primitives

Ask turtles with [color = yellow][

Ask neighbors [
If any? Turtles-here with [color = red] [

*Ask myself [set color blue]]]]

**Ask turtles-here with [color = red]
**[set color blue]
**]]]
--
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 Blockedhttps://groups.google.com/d/msgid/netlogo-users/059d30a4-f57a-4bc3-b585-0c45cbe9b47d%40googlegroups.com <Blockedhttps://groups.google.com/d/msgid/netlogo-users/059d30a4-f57a-4bc3-b585-0c45cbe9b47d%40googlegroups.com?utm_medium=email&utm_source=footer> .
For more options, visit Blockedhttps://groups.google.com/d/optout.

Miguel Pais

unread,
Aug 1, 2018, 11:19:27 AM8/1/18
to netlogo-users
Another way to do it:

  ask turtles with [color = yellow] [
    if any? (turtles-on neighbors) with [color = red] [set color blue]
  ]

Miguel Pais

unread,
Aug 1, 2018, 11:22:06 AM8/1/18
to netlogo-users
can someone recommend me some online course that teaches netlogo from A to Z

Nelson, check out Bill Rand's course here: still open and ongoing: https://www.complexityexplorer.org/courses/90-introduction-to-agent-based-modeling 

quarta-feira, 1 de Agosto de 2018 às 14:32:46 UTC+1, Snehal Shinde escreveu:

Russell Gonnering

unread,
Aug 1, 2018, 11:22:48 AM8/1/18
to Alan Isaac, netlog...@googlegroups.com
There is a Fundamentals of NetLogo on SFI’s ComplexityExplorer:

This is a tutorial so you can enroll at any time.  The ABM course is also excellent, but it started July 9 and would be hard to catch up.  It is offered periodically.

Russ
Russell S. Gonnering, MD, MMM, FACS, CPHQ

rsgonn...@me.com




--
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/28ab0557-337e-f254-982c-451c07d28d1d%40gmail.com.

Todd S

unread,
Aug 1, 2018, 11:24:55 AM8/1/18
to netlogo-users
Oh, this is better. Do this. 

--
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.

Snehal Shinde

unread,
Aug 1, 2018, 11:25:43 AM8/1/18
to Todd.M....@usace.army.mil, netlog...@googlegroups.com
Thank you so much...

I want to change yellow turtles to blue. 
The rule is in this way:
If any one of the neighbors of yellow is of red color.
Then the yellow turtle changes its color to blue.
For this scenario,
Ask myself [set color blue]]]] it should work.

Thank you very much for your kind consideration and quick response.





Regards,
Snehal Shinde
PhD Research Scholar
Computer Science and Engineering
Visvesvaraya National Institute of Technology
Mobile:  +91 7387127480




rsgo...@gmail.com

unread,
Aug 1, 2018, 11:28:32 AM8/1/18
to netlogo-users

There is a Fundamentals of NetLogo on SFI’s ComplexityExplorer:

https://www.complexityexplorer.org/courses


This is a tutorial so you can enroll at any time.  The ABM course at the same site is also excellent, but it started July 9 and would be hard to catch up.  It is offered periodically.


Russ


On Wednesday, August 1, 2018 at 9:28:18 AM UTC-5, Nelson Kemboi wrote:
can someone recommend me some online course that teaches netlogo from A to Z
On Wed, Aug 1, 2018 at 11:34 AM, Snehal Shinde <ssnehal...@gmail.com> wrote:
Hi everyone,

I'm new to the group but I've been using Netlogo for a couple years now. 
I'm pretty proficient and my code currently works, but I want to make sure
that it works how I think it does.  

My main chunk of code includes the following (in pseudocode):

Hi all,


I am working in the netlogo. I am stuck in my code. 

 ask turtles
    [

      if (color = yellow )[
      ask turtles-on neighbors
      [
        if (color = red)
          [set  color[blue] of myself
          ;  set type "AMF"
        ]

      ] ]

    ]

I want to refer the turtle of color yellow 

And I want to change  [set  color[blue] of myself] this command for turtles with color yellow.
In this code turtles with color red are changed to blue, As it accesses current red colored turtles

Please help me out in this.
It will be of great help.
What is to be done

--
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.

Johnson, Rodger [MV]

unread,
Aug 3, 2018, 1:51:20 PM8/3/18
to Nelson Kemboi, Snehal Shinde, netlogo-users

Snehal,

 

You can also check out STEMCCM.COM which has loads of tutorials, materials and lessons using netlogo.

 

Rodger

--

To unsubscribe from this group and stop receiving emails from it, send an email to netlogo-user...@googlegroups.com.




--

 


Best Regards,
Nelson Kemboi Yego,
+254 723 695 775/ +250783124018

--

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/CALrBqYTp8vKt8fk%2Bb77p%3DObR%2Bu-KCfryK%2B4rFw%2B%2Bcy9GEBOPcg%40mail.gmail.com.

Shayryl Mae Ramos

unread,
Aug 11, 2018, 1:26:31 PM8/11/18
to Snehal Shinde, netlog...@googlegroups.com
You can try this:

ask turtles with [(color = yellow) and (any? (turtles-on neighbors) with [color = red])][set color blue] 

Reply all
Reply to author
Forward
0 new messages