Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make two turtles in one patch both visible?

Tags:

netlogo

I have two turtles - seller and buyer in one patch, and they have shape "face happy". But on interface when I run setup if there are two turtles in one patch i can see only one of them. my question is, how can i code it so that to see both of them. if its not possible at least to see in some patches one agent in others another one.

and here is my code:

ask sellers
         [move-to one-of patches with [not any? turtles-here]] 

  ask buyers
         [move-to one-of patches with [not any? buyers-here]] 
    ask buyers [if any? sellers-here [set shape "face happy"]]
  ask buyers [if not any? sellers-here [set shape "face sad"]]
  ask buyers [if any? sellers-here [set color 67]]
  ask sellers [if any? buyers-here [set shape "face happy"]]
  ask sellers [if not any? buyers-here [set shape "face sad"]]
  ask sellers [if any? buyers-here [set color 137]]
like image 654
runle Avatar asked Jan 09 '23 06:01

runle


2 Answers

First of all, note that you can actually tell if both are present from your face and color cues. If you want to see both, you will need to set transparent colors, or offset the locations, or both. E.g.,

ask buyers [
  move-to one-of patches with [not any? buyers-here]
  ifelse (any? sellers-here) [
    set shape "face happy"
    set color [255 0 0 125]
    fd 0.45
  ][
    set shape "face sad"
  ]
] 
like image 60
Alan Avatar answered Jan 17 '23 06:01

Alan


Assuming patches with two turtles at the center of patch:

 to spread-out   
   ask patches with [count turtles-here = 2]
    [ask one-of turtles-here [
        fd .25 
        ask one-of other turtles-here [face myself fd -0.25]]]
 end
like image 30
StephenGuerin Avatar answered Jan 17 '23 06:01

StephenGuerin