Immigration Policy

No preview image

1 collaborator

Nobita_square Brian Young (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 4.1 • Viewed 454 times • Downloaded 28 times • Run 4 times
Download the 'Immigration Policy' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

-----------

This section could give a general understanding of what the model is trying to show or explain.

HOW IT WORKS

------------

This section could explain what rules the agents use to create the overall behavior of the model.

HOW TO USE IT

-------------

This section could explain how to use the model, including a description of each of the items in the interface tab.

THINGS TO NOTICE

----------------

This section could give some ideas of things for the user to notice while running the model.

THINGS TO TRY

-------------

This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.

EXTENDING THE MODEL

-------------------

This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.

NETLOGO FEATURES

----------------

This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab. It might also point out places where workarounds were needed because of missing features.

RELATED MODELS

--------------

This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.

CREDITS AND REFERENCES

----------------------

This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

breed [cops cop]
breed [immigrants immigrant]


;; negative freedom = remaining ticks in jail

immigrants-own [freedom]

to setup
 clear-all

 
 ;; sets the background to yellow

 ask patches [ set pcolor yellow 
 
   if ( pycor = -12 ) and ( pxcor <= -12 ) [ set pcolor black ]
    if ( pycor = -16 ) and ( pxcor <= -12 ) [ set pcolor black ]
     if ( pxcor = -12 ) and ( pycor <= -12 ) [ set pcolor black ]
      if ( pxcor = -16 ) and ( pycor <= -12 ) [ set pcolor black ]
      
 ]
 
 ;; sets the turtles to use the person icon

 set-default-shape cops "person"
 create-cops initial-number-cops
[
 setxy random-xcor random-ycor
 set color blue
 ]

 ;; creates the immigrant variable

 set-default-shape immigrants "person"
 create-immigrants initial-number-immigrants
[
 setxy random-xcor random-ycor
 set color red
 set freedom 1
 ]

ask immigrants [ if xcor <= -12 and ycor <= -12 
  [ set xcor 0
    set ycor 0
  ]
]

ask cops [ if xcor <= -12 and ycor <= -12 
  [ set xcor 0
    set ycor 0
  ]
]
end  

to go
  ask cops [
    move
    catch-immigrants
  ]
  check-freedom
  tick
end 

to move
  ask cops
  [ 
    let x-orig xcor
    let y-orig ycor
    
    rt random 100
    lt random 100
    fd 1
    if pcolor = black [set xcor x-orig
      set ycor y-orig]
    
  ]
  
   ask immigrants
  [ 
    let x-orig xcor
    let y-orig ycor
    
    rt random 100
    lt random 100
    fd 1
    if pcolor = black [set xcor x-orig
      set ycor y-orig]
    
  ]
end 

to check-freedom 
ask immigrants 
[
  if freedom = 0 [ 
    set xcor 100
        set ycor 100]
  if freedom < 1 [ set freedom (freedom + 1)] 

  
]
end   

to catch-immigrants
    let illegal one-of immigrants-here
    if illegal != nobody
    [ ask illegal
      [set freedom (-1 * jail-time)
        set xcor -14
        set ycor -14]
 ;;     [set color green]

 ;;    ask turtles with [color = green]

  ;;   [ pd ]

      
        ]
end 

There is only one version of this model, created almost 14 years ago by Brian Young.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.