Skip to content

Info tab incorrectly describes movement in Segregation model #378

Description

@ToonTalk

Info tab says "If agents don’t have enough same-color neighbors, they move to a nearby patch. "

and yet the code is

; move until we find an unoccupied spot
to find-new-spot
  rt random-float 360
  fd random-float 10
  if any? other turtles-here [ find-new-spot ] ; keep going until we find an unoccupied patch
  move-to patch-here  ; move to center of patch
end

Activity

  1. ToonTalk commented on Jan 17, 2019

    @ToonTalk
    Author

    And why this complexity? Could just jump to any empty patch...

  2. Falnesio commented on Jan 17, 2019

    @Falnesio

    I think the info tab is correct. Don't know why not to just jump to any empty patch (EDIT: could be to make turtles remain close to their neighborhood, maybe mimic house hunting).

    ; run the model for one tick
    to go
      if all? turtles [ happy? ] [ stop ]
      move-unhappy-turtles <---------------------this
      update-turtles
      update-globals
      tick
    end
    
    ; unhappy turtles try a new spot
    to move-unhappy-turtles
      ask turtles with [ not happy? ]
        [ find-new-spot ] <------------------------leads to this
    end
    
    to update-turtles
      ask turtles [
        ; in next two lines, we use "neighbors" to test the eight patches
        ; surrounding the current patch
        set similar-nearby count (turtles-on neighbors)  with [ color = [ color ] of myself ]
        set other-nearby count (turtles-on neighbors) with [ color != [ color ] of myself ]
        set total-nearby similar-nearby + other-nearby
        set happy? similar-nearby >= (%-similar-wanted * total-nearby / 100) <-------------if this shows that the turtle is unhappy on the last tick
        ; add visualization here
        if visualization = "old" [ set shape "default" set size 1.3 ]
        if visualization = "square-x" [
          ifelse happy? [ set shape "square" ] [ set shape "X" ]
        ]
      ]
    end
    
  3. ToonTalk commented on Jan 18, 2019

    @ToonTalk
    Author

    I guess this depends on what one thinks "nearby" means. It can go fd up to 10 steps in a 51x51 space for each attempt to find a free space. And with the default density of 95% it will do this on average 10 times before finding an empty space.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions