Greek Life Model

No preview image

1 collaborator

Default-person Edgar Vazquez (Author)

Tags

(This model has yet to be categorized with any tags)
Model group MAM-2015 | Visible to everyone | Changeable by group members (MAM-2015)
Model was written in NetLogo 5.2.0 • Viewed 281 times • Downloaded 24 times • Run 0 times
Download the 'Greek Life Model' modelDownload this modelEmbed this model

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


Comments and Questions

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

Click to Run Model

turtles-own [greek? antigreek? year bias just-changed]  
;; greek? and antigreek? holds a 1 or a 0 indicating whether a turtle is greek or antigreek
;; year holds a turtle's year
;; bias holds the bias, or inclination of a turtle towards or against Greek life
;; just-changed is used to determine if a turtle's year was recently update in the update-year procedures
;; just-changed is used to prevent from having turtles updated all the way through all 4 years when the model
;; executes the update-year procedure

globals[rush? new-year? neg-tick-counter pos-tick-counter rush-tick-counter]
;; rush? holds a 1 or a 0 indicating if there's a rush period taking place
;; new-year? holds a 1 or 0 indicating if a new year has started
;; neg-tick-counter is the counter that counts the ticks that pass
;; it is used to determine when to set off a negative event-tick-marker
;; pos-tick-counter is the counter that counts the ticks that pass
;; it is used to determine when to set off a positive event-tick-marker
;; rush-tick-counter is used to determine when a rush period starts

;; this setup should be used in a 50 max x-cor by 50 max y-cor world space 

to setup-default ;; default setup has 5 buildings with the greek house in the bottom left corner
  ca
  set rush? 0 ;; rush is initiated to 0 since rush doesn't immediately start at the beginning of the year
  set new-year? 1 ;; a new year starts when the model first runs so this variable is set to 1
  set neg-tick-counter 0  ;; the counters for rush, negative events, and positive events is set to 0
  set pos-tick-counter 0
  set rush-tick-counter 0
  set-default-shape turtles "person" ;; turtle shape is defined
  crt population  [ ;; slider with variable POPULATION determines how many turtles are made
    setxy random-xcor random-ycor ;; turtles are placed randomly in the world
    set just-changed 0 ;; no turtle's year has been updated so this is set to 0
    if random 100 < percent-greek  ;; slider used to determine what percentage of the population is Greek
    [set greek? 1 ;; set the appropriate variables to 1 and 0 if a turtle is Greek
     set antigreek? 0
      ]
    if random 100 < probability-of-antigreek and greek? != 1 ;; if a turtle isn't Greek, use a probability to assign turtles as antiGreek
    [ set antigreek? 1
      set greek? 0
      ]
    set year one-of [1 2 3 4] ;; give turtles their year
    set size 2 ;; size is 2 so that they can be seen better
    ]
  
  ask turtles [
    if greek? = 1 [set bias 10] ;; if a turtle is greek, set it's bias to 10
    if antigreek? = 1 [set bias -10] ;; if it's antigreek, set it to -10
     if (greek? != 1 and antigreek? != 1) [set bias 0] ;; if it's neither, set it to 0
    color-year ;; go to this procedure to give turtles their color based on their year
    color-greeks ;; go to this procedure to give turtles their color if they're greek or antigreek
    ]        ;; this color takes presedence over their year color
 
  ask patches[
                   ;;; draws the buildings for this setup
    ;; top left building
    if pxcor > -45 and pxcor < -18 and pycor < 47 and pycor > 44[set pcolor yellow]
    if pxcor > -45 and pxcor < -42 and pycor < 47 and pycor > 17[set pcolor yellow]
    if pxcor > -19 and pxcor < -16 and pycor < 47 and pycor > 17[set pcolor yellow]
    if pxcor > -45 and pxcor < -32 and pycor < 18 and pycor > 15[set pcolor yellow]
    if pxcor > -28 and pxcor < -16 and pycor < 18 and pycor > 15[set pcolor yellow]
    
    ;; top right buiding
    if pxcor < 45 and pxcor > 18 and pycor < 47 and pycor > 44[set pcolor yellow]
    if pxcor < 45 and pxcor > 42 and pycor < 47 and pycor > 17[set pcolor yellow]
    if pxcor < 19 and pxcor > 16 and pycor < 47 and pycor > 17[set pcolor yellow]
    if pxcor < 45 and pxcor > 32 and pycor < 18 and pycor > 15[set pcolor yellow]
    if pxcor < 28 and pxcor > 16 and pycor < 18 and pycor > 15[set pcolor yellow]
    
    ;; bottom right building
    if pxcor < 45 and pxcor > 18 and pycor > -47 and pycor < -44[set pcolor yellow]
    if pxcor < 45 and pxcor > 42 and pycor > -47 and pycor < -17[set pcolor yellow]
    if pxcor < 19 and pxcor > 16 and pycor > -47 and pycor < -17[set pcolor yellow]
    if pxcor < 45 and pxcor > 32 and pycor > -18 and pycor < -15[set pcolor yellow]
    if pxcor < 28 and pxcor > 16 and pycor > -18 and pycor < -15[set pcolor yellow]
    
    ;; bottom left building (greek house)
    if pxcor > -45 and pxcor < -35 and pycor > -47 and pycor < -44[set pcolor yellow]
    if pxcor > -29 and pxcor < -18 and pycor > -47 and pycor < -44[set pcolor yellow]
    if pxcor > -45 and pxcor < -42 and pycor > -47 and pycor < -17[set pcolor yellow]
    if pxcor > -19 and pxcor < -16 and pycor < -17 and pycor > -30[set pcolor yellow]
    if pxcor > -19 and pxcor < -16 and pycor > -47 and pycor < -35[set pcolor yellow]
    if pxcor > -45 and pxcor < -32 and pycor > -18 and pycor < -15[set pcolor yellow]
    if pxcor > -28 and pxcor < -16 and pycor > -18 and pycor < -15[set pcolor yellow]
    
    ;; middle building    
    if pxcor < 13 and pxcor > 2 and pycor < 13 and pycor > 10[set pcolor yellow]
    if pxcor > -15 and pxcor < -2 and pycor < 13 and pycor > 10[set pcolor yellow]
    if pxcor < 15 and pxcor > 12 and pycor < 13 and pycor > 3[set pcolor yellow]
    if pxcor < 15 and pxcor > 12 and pycor > -13 and pycor < -3[set pcolor yellow]
    if pxcor > -15 and pxcor < -2 and pycor > -13 and pycor < -10[set pcolor yellow]
    if pxcor < 15 and pxcor > 2 and pycor > -13 and pycor < -10[set pcolor yellow]
    if pxcor > -15 and pxcor < -12 and pycor < 13  and pycor > 3[set pcolor yellow]
    if pxcor > -15 and pxcor < -12 and pycor < -3  and pycor > -13[set pcolor yellow]
    if pxcor < 13 and pxcor > 2 and pycor < 13 and pycor > 10[set pcolor yellow]
    
    ;; color patches that define greek house (bottom left)
    if pxcor > -43 and pxcor < -18 and pycor < -17 and pycor > -45[set pcolor 97]
    ]
  
  reset-ticks
end 

;; this setup should be used in a 50 max x-cor by 50 max y-cor world space 

to setup-greek-house-middle 
  ca
  set rush? 0 ;; rush is initiated to 0 since rush doesn't immediately start at the beginning of the year
  set new-year? 1 ;; a new year starts when the model first runs so this variable is set to 1
  set neg-tick-counter 0  ;; the counters for rush, negative events, and positive events is set to 0
  set pos-tick-counter 0
  set rush-tick-counter 0
  set-default-shape turtles "person" ;; turtle shape is defined
  crt population  [ ;; slider with variable POPULATION determines how many turtles are made
    setxy random-xcor random-ycor ;; turtles are placed randomly in the world
    set just-changed 0 ;; no turtle's year has been updated so this is set to 0
    if random 100 < percent-greek  ;; slider used to determine what percentage of the population is Greek
    [set greek? 1 ;; set the appropriate variables to 1 and 0 if a turtle is Greek
     set antigreek? 0
      ]
    if random 100 < probability-of-antigreek and greek? != 1 ;; if a turtle isn't Greek, use a probability to assign turtles as antiGreek
    [ set antigreek? 1
      set greek? 0
      ]
    set year one-of [1 2 3 4] ;; give turtles their year
    set size 2 ;; size is 2 so that they can be seen better
    ]
  
  ask turtles [
    if greek? = 1 [set bias 10] ;; if a turtle is greek, set it's bias to 10
    if antigreek? = 1 [set bias -10] ;; if it's antigreek, set it to -10
     if (greek? != 1 and antigreek? != 1) [set bias 0] ;; if it's neither, set it to 0
    color-year ;; go to this procedure to give turtles their color based on their year
    color-greeks ;; go to this procedure to give turtles their color if they're greek or antigreek
    ]        ;; this color takes presedence over their year color
 
  ask patches[
    ;;; draws the buildings for this setup
    ;; top left building
    if pxcor > -45 and pxcor < -18 and pycor < 47 and pycor > 44[set pcolor yellow]
    if pxcor > -45 and pxcor < -42 and pycor < 47 and pycor > 17[set pcolor yellow]
    if pxcor > -19 and pxcor < -16 and pycor < 47 and pycor > 17[set pcolor yellow]
    if pxcor > -45 and pxcor < -32 and pycor < 18 and pycor > 15[set pcolor yellow]
    if pxcor > -28 and pxcor < -16 and pycor < 18 and pycor > 15[set pcolor yellow]
    
    ;; top right buiding
    if pxcor < 45 and pxcor > 18 and pycor < 47 and pycor > 44[set pcolor yellow]
    if pxcor < 45 and pxcor > 42 and pycor < 47 and pycor > 17[set pcolor yellow]
    if pxcor < 19 and pxcor > 16 and pycor < 47 and pycor > 17[set pcolor yellow]
    if pxcor < 45 and pxcor > 32 and pycor < 18 and pycor > 15[set pcolor yellow]
    if pxcor < 28 and pxcor > 16 and pycor < 18 and pycor > 15[set pcolor yellow]
    
    ;; bottom right building
    if pxcor < 45 and pxcor > 18 and pycor > -47 and pycor < -44[set pcolor yellow]
    if pxcor < 45 and pxcor > 42 and pycor > -47 and pycor < -17[set pcolor yellow]
    if pxcor < 19 and pxcor > 16 and pycor > -47 and pycor < -17[set pcolor yellow]
    if pxcor < 45 and pxcor > 32 and pycor > -18 and pycor < -15[set pcolor yellow]
    if pxcor < 28 and pxcor > 16 and pycor > -18 and pycor < -15[set pcolor yellow]
    
    ;; bottom left building (greek house)
    if pxcor > -45 and pxcor < -35 and pycor > -47 and pycor < -44[set pcolor yellow]
    if pxcor > -29 and pxcor < -18 and pycor > -47 and pycor < -44[set pcolor yellow]
    if pxcor > -45 and pxcor < -42 and pycor > -47 and pycor < -17[set pcolor yellow]
    if pxcor > -19 and pxcor < -16 and pycor < -17 and pycor > -30[set pcolor yellow]
    if pxcor > -19 and pxcor < -16 and pycor > -47 and pycor < -35[set pcolor yellow]
    if pxcor > -45 and pxcor < -32 and pycor > -18 and pycor < -15[set pcolor yellow]
    if pxcor > -28 and pxcor < -16 and pycor > -18 and pycor < -15[set pcolor yellow]
    
    ;; middle building    
    if pxcor < 13 and pxcor > 2 and pycor < 13 and pycor > 10[set pcolor yellow]
    if pxcor > -15 and pxcor < -2 and pycor < 13 and pycor > 10[set pcolor yellow]
    if pxcor < 15 and pxcor > 12 and pycor < 13 and pycor > 3[set pcolor yellow]
    if pxcor < 15 and pxcor > 12 and pycor > -13 and pycor < -3[set pcolor yellow]
    if pxcor > -15 and pxcor < -2 and pycor > -13 and pycor < -10[set pcolor yellow]
    if pxcor < 15 and pxcor > 2 and pycor > -13 and pycor < -10[set pcolor yellow]
    if pxcor > -15 and pxcor < -12 and pycor < 13  and pycor > 3[set pcolor yellow]
    if pxcor > -15 and pxcor < -12 and pycor < -3  and pycor > -13[set pcolor yellow]
    if pxcor < 13 and pxcor > 2 and pycor < 13 and pycor > 10[set pcolor yellow]
    
    ;; color patches that define greek house (middle)
    if pxcor < 13 and pxcor > -13 and pycor < 11 and pycor > -11[set pcolor 97]
    ]
  
  reset-ticks
end 

;; this setup should be used in a 100 max x-cor by 50 max y-cor world space 

to setup-mock-nu 
    ca
  set rush? 0 ;; rush is initiated to 0 since rush doesn't immediately start at the beginning of the year
  set new-year? 1 ;; a new year starts when the model first runs so this variable is set to 1
  set neg-tick-counter 0  ;; the counters for rush, negative events, and positive events is set to 0
  set pos-tick-counter 0
  set rush-tick-counter 0
  set-default-shape turtles "person" ;; turtle shape is defined
  crt population  [ ;; slider with variable POPULATION determines how many turtles are made
    setxy random-xcor random-ycor ;; turtles are placed randomly in the world
    set just-changed 0 ;; no turtle's year has been updated so this is set to 0
    if random 100 < percent-greek  ;; slider used to determine what percentage of the population is Greek
    [set greek? 1 ;; set the appropriate variables to 1 and 0 if a turtle is Greek
     set antigreek? 0
      ]
    if random 100 < probability-of-antigreek and greek? != 1 ;; if a turtle isn't Greek, use a probability to assign turtles as antiGreek
    [ set antigreek? 1
      set greek? 0
      ]
    set year one-of [1 2 3 4] ;; give turtles their year
    set size 2 ;; size is 2 so that they can be seen better
    ]
  
  ask turtles [
    if greek? = 1 [set bias 10] ;; if a turtle is greek, set it's bias to 10
    if antigreek? = 1 [set bias -10 ];; if it's antigreek, set it to -10
     if (greek? != 1 and antigreek? != 1) [set bias 0] ;; if it's neither, set it to 0
    color-year ;; go to this procedure to give turtles their color based on their year
    color-greeks ;; go to this procedure to give turtles their color if they're greek or antigreek
    ]        ;; this color takes presedence over their year color
  
  ask patches[
    ;;; draws the buildings for this setup
    ;; top right-most building
    if pxcor < 98 and pxcor > 64 and pycor < 49 and pycor > 46[set pcolor yellow]
    if pxcor < 98 and pxcor > 95 and pycor < 47 and pycor > 17[set pcolor yellow]
    if pxcor < 67 and pxcor > 64 and pycor < 47 and pycor > 38[set pcolor yellow]
    if pxcor < 67 and pxcor > 64 and pycor < 30 and pycor > 17[set pcolor yellow]
    if pxcor > 64 and pxcor < 77 and pycor < 18 and pycor > 15[set pcolor yellow]
    if pxcor < 98 and pxcor > 85 and pycor < 18 and pycor > 15[set pcolor yellow]
    
    ;; top 1st from right-most buiding
    if pxcor > 23 and pxcor < 56 and pycor < 47 and pycor > 44[set pcolor yellow]
    if pxcor > 23 and pxcor < 26 and pycor < 47 and pycor > 28[set pcolor yellow]
    if pxcor > 23 and pxcor < 26 and pycor < 22 and pycor > 17[set pcolor yellow]
    if pxcor > 53 and pxcor < 56 and pycor < 47 and pycor > 36[set pcolor yellow]
    if pxcor > 53 and pxcor < 56 and pycor < 29 and pycor > 17[set pcolor yellow]
    if pxcor > 23 and pxcor < 37 and pycor < 18 and pycor > 15[set pcolor yellow]
    if pxcor > 44 and pxcor < 56 and pycor < 18 and pycor > 15[set pcolor yellow]
    
    ;; top 2nd from the right-most building
    if pxcor > -17 and pxcor < 17 and pycor < 47 and pycor > 44[set pcolor yellow]
    if pxcor > -17 and pxcor < -14 and pycor < 47 and pycor > 17[set pcolor yellow]
    if pxcor > 14 and pxcor < 17 and pycor < 47 and pycor > 17[set pcolor yellow]
    if pxcor >  -17 and pxcor < -4 and pycor < 18 and pycor > 15[set pcolor yellow]
    if pxcor > 4 and pxcor < 17 and pycor < 18 and pycor > 15[set pcolor yellow]
    
    ;; top 3rd from right-most buiding
    if pxcor < -20 and pxcor > -56 and pycor < 47 and pycor > 44[set pcolor yellow]
    if pxcor < -20 and pxcor > -23 and pycor < 47 and pycor > 28[set pcolor yellow]
    if pxcor < -20 and pxcor > -23 and pycor < 22 and pycor > 17[set pcolor yellow]
    if pxcor < -55 and pxcor > -58 and pycor < 47 and pycor > 36[set pcolor yellow]
    if pxcor < -55 and pxcor > -58 and pycor < 29 and pycor > 17[set pcolor yellow]
    if pxcor < -20 and pxcor > -37 and pycor < 18 and pycor > 15[set pcolor yellow]
    if pxcor < -45 and pxcor > -58 and pycor < 18 and pycor > 15[set pcolor yellow]
    
    ;; top left-most building (a greek building)
    if pxcor > -97 and pxcor < -64 and pycor < 47 and pycor > 44[set pcolor yellow]
    if pxcor > -67 and pxcor < -64 and pycor < 47 and pycor > 32[set pcolor yellow]
    if pxcor > -67 and pxcor < -64 and pycor < 25 and pycor > 17[set pcolor yellow]
    if pxcor > -97 and pxcor < -94 and pycor < 47 and pycor > 15[set pcolor yellow]
    if pxcor > -76 and pxcor < -64 and pycor < 18 and pycor > 15[set pcolor yellow]
    if pxcor > -97 and pxcor < -84 and pycor < 18 and pycor > 15[set pcolor yellow]
    if pxcor > -97 and pxcor < -84 and pycor < 18 and pycor > 15[set pcolor yellow]
    if pxcor > -95 and pxcor < -66 and pycor < 45 and pycor > 17[set pcolor 97] 
    
    ;; bottom right-most building (a greek building)
    if pxcor < 97 and pxcor > 64 and pycor > -47 and pycor < -44[set pcolor yellow]
    if pxcor < 67 and pxcor > 64 and pycor > -47 and pycor < -32[set pcolor yellow]
    if pxcor < 67 and pxcor > 64 and pycor > -25 and pycor < -17[set pcolor yellow]
    if pxcor < 97 and pxcor > 94 and pycor > -47 and pycor < -15[set pcolor yellow]
    if pxcor < 76 and pxcor > 64 and pycor > -18 and pycor < -15[set pcolor yellow]
    if pxcor < 97 and pxcor > 84 and pycor > -18 and pycor < -15[set pcolor yellow]
    if pxcor < 97 and pxcor > 84 and pycor > -18 and pycor < -15[set pcolor yellow]
    if pxcor < 95 and pxcor > 66 and pycor > -45 and pycor < -17[set pcolor 97]    
    
    ;; bottom 1st from the right-most building
    if pxcor > 23 and pxcor < 59 and pycor > -47 and pycor < -44[set pcolor yellow]
    if pxcor > 23 and pxcor < 26 and pycor > -47 and pycor < -17[set pcolor yellow]
    if pxcor > 56 and pxcor < 59 and pycor > -47 and pycor < -17[set pcolor yellow]
    if pxcor > 23 and pxcor < 37 and pycor > -18 and pycor < -15[set pcolor yellow]
    if pxcor > 46 and pxcor < 59 and pycor > -18 and pycor < -15[set pcolor yellow]
    
    ;; botom 2nd from right-most buiding
    if pxcor > -17 and pxcor < 17 and pycor > -47 and pycor < -44[set pcolor yellow]
    if pxcor > -17 and pxcor < -14 and pycor > -47 and pycor < -28[set pcolor yellow]
    if pxcor > -17 and pxcor < -14 and pycor > -22 and pycor < -17[set pcolor yellow]
    if pxcor > 14 and pxcor < 17 and pycor > -47 and pycor < -36[set pcolor yellow]
    if pxcor > 14 and pxcor < 17 and pycor > -29 and pycor < -17[set pcolor yellow]
    if pxcor > 3 and pxcor < 17 and pycor > -18 and pycor < -15[set pcolor yellow]
    if pxcor > -17 and pxcor < -4 and pycor > -18 and pycor < -15[set pcolor yellow]
    
    ;; bottom 3rd from the right-most building
    if pxcor < -20 and pxcor > -56 and pycor > -47 and pycor < -44[set pcolor yellow]
    if pxcor < -20 and pxcor > -23 and pycor > -47 and pycor < -17[set pcolor yellow]
    if pxcor < -55 and pxcor > -58 and pycor > -47 and pycor < -17[set pcolor yellow]
    if pxcor < -20 and pxcor > -37 and pycor > -18 and pycor < -15[set pcolor yellow]
    if pxcor < -45 and pxcor > -58 and pycor > -18 and pycor < -15[set pcolor yellow]
    
    ;; bottom left-most building
    if pxcor > -97 and pxcor < -64 and pycor > -47 and pycor < -44[set pcolor yellow]
    if pxcor > -67 and pxcor < -64 and pycor > -47 and pycor < -28[set pcolor yellow]
    if pxcor > -67 and pxcor < -64 and pycor > -22 and pycor < -17[set pcolor yellow]
    if pxcor > -97 and pxcor < -94 and pycor > -47 and pycor < -36[set pcolor yellow]
    if pxcor > -97 and pxcor < -94 and pycor > -29 and pycor < -17[set pcolor yellow]
    if pxcor > -97 and pxcor < -94 and pycor > -18 and pycor < -15[set pcolor yellow]
    if pxcor > -97 and pxcor < -81 and pycor > -18 and pycor < -15[set pcolor yellow]
    if pxcor > -74 and pxcor < -64 and pycor > -18 and pycor < -15[set pcolor yellow] 
   ]
  
  reset-ticks
end 

to go
  set rush-tick-counter ticks mod 400 + 1   ;; keeps track of rush period
  set pos-tick-counter ticks mod pos-event-tick-marker + 1 ;; keeps track of positive tick counter
  set neg-tick-counter ticks mod neg-event-tick-marker + 1 ;; keeps track of negative tick counter
  ask turtles [    
    if new-year? = 1[ ;; if it's a new year,  jump into this procedure
      if rush-tick-counter = 100 ;; if the rush tick counter = 100, start the rush period; set rush? to 1
       [set rush? 1
         check-bias] ;; check turtle biases 
       
      if rush? = 1 and rush-tick-counter <= 175[ ;; if it's rush period and the rush tick counter is less than
        greeks-to-house                          ;; 175, if i'm a greek turtle i'm moving to a greek building
        ]
      if rush-tick-counter > 175[ ;; if the counter is over 175, set new-year? to 0 and rush? to 0 indicating that the rush period is over. 
        set new-year? 0
        set rush? 0
        ]
      ]
    if (neg-tick-counter = neg-event-tick-marker and negative?) ;; if negative events are being using and the negative tick counter = the slider tick marker
    [                                                           ;; jump into the negative event an then reset the negative tick counter
      neg-external-influences
      set neg-tick-counter 0
      ]
     
    if (pos-tick-counter = pos-event-tick-marker and positive?) ;; if positive events are being using and the positive tick counter = the slider tick marker
    [                                                           ;; jump into the positive event an then reset the psoitive tick counter
      pos-external-influences
      set pos-tick-counter 0
      ]
    patch-bias ;; jump into this procedure to determine if i'm over a greek patch (and thus in greek building)
    move ;; move turtle
    interact ;; interact with other turtles
    if ticks mod 400 = 0 and ticks != 0[ ;; if ticks = 400, start a new year
      update-year ;; update the turtles' year variable
      reset-just-changed ;; reset just-changed after updating turtes' year
      set new-year? 1 ;; reset new-year?
    ]
    check-bias ;; check bias again 
  ]
  tick
end 

to color-year ;; colors the turtles based on their years
  if year = 1 [set color orange]
  if year = 2 [set color green]
  if year = 3 [set color white]
  if year = 4 [set color brown]
end 


;; go procedures

to color-greeks ;; colors greeks and antigreeks
  if antigreek? = 1 [set color 135]
  if greek? = 1 [set color 95]
end 

to move ;; moves a turtle
  ifelse [pcolor] of patch-ahead 1 = yellow 
    [
      lt random-float 360 ;; if the patch ahead is yellow, turn randomly
    ]
    [ 
      rt random 90 ;; otherwise turn left and right randomly and then move forward 1
      lt random 90
      fd 1   
    ]
end 

to interact ;; procedure that interacts with other turtles
  let int-with one-of turtles in-radius 3 ;; set one of the turles in radius 3 as the turtle to interact with
  let counter 0 ;; counter for while loop
  while [counter != 5][ ;; loop that allows for interaction to happen for a set amount of time
    move-to int-with ;; move to target turtle
    ask int-with[
      let int-with-bias bias ;; get their bias and year
      let int-with-year year
      if greek? = 1 [
        ask myself [
          ifelse greek? = 1 ;; if they're greek and i'm greek
          [set bias bias + (.0025 * int-with-bias)] ;; use this calculation for my bias
          [ifelse (int-with-year - year > 0 and year <= 2) ;; if i'm not greek and they're
            [set bias bias + (.0015 * int-with-bias)] ;; older, use this calculation
            [set bias bias + (.0001 * int-with-bias)] ;; younger, use this calculation
          ]
        ]
      ]
      if antigreek? = 1 [
        ask myself [
          ifelse antigreek? = 1 ;; if they're anti-greek and i'm anti-greek
          [set bias bias + (.0025 * int-with-bias)] ;; use this calculation for my bias
          [ifelse (int-with-year - year > 0 and year <= 2) ;; if i'm not anti-greek and they're
            [set bias bias + (.0015 * int-with-bias)] ;; older, use this calculation
            [set bias bias + (.0001 * int-with-bias)] ;; younger, use this calculation
          ] 
        ]   
      ]
    ]
      set counter counter + 1 ; increase counter
    ]
  
  move
end 

to patch-bias
    ask patch-here [
      if pcolor = 97 [
        ask myself [ ;; if i'm on a greek patch, increase my bias
          set bias bias + (house-bias * house-influence)]
      ]
    ]
end 

to check-bias
  if bias > 20[ ;; if bias is over 20, turn greek
    set greek? 1
    set antigreek? 0
    set color 95
    ]
  if bias < -20[ ;; if bias is under -20, turn anti-greek
    set greek? 0
    set antigreek? 1
    set color 135
    ] 
end 

to neg-external-influences
    set bias bias + (media-negative * negative-influence-%) ;; if using negative media coverage, change bias accordingly
    if school? [set bias bias + (school-influence-% * school-bias)] ;; if school bias is being used, adjust bias as well
end 

to pos-external-influences
    set bias bias + (media-positive * positive-influence-%) ;; if using positive media coverage, change bias accordingly
    if school? [set bias bias + (school-influence-% * school-bias)] ;; if school bias is being used, adjust bias as well
end 

to update-year ;; updates turtles year
  if year = 1 [ ;; if a turle has year 1, isn't greek or anti-greek, and they didn't just spawn
    if (color != 135 and color != 95 and just-changed != 1)[ ;; update year and color
      set color green
      set year 2
      set just-changed 1 ;; prevents this turtle from changing again in the next if statement
    ]
    if (just-changed != 1)[  ;; if they're greek or anti-greek, just update the year
      set year 2
      set just-changed 1]
  ]
  
  if year = 2[ ;the same procedure is followed if they have year 2 or 3
   if (color != 135 and color != 95 and just-changed != 1)[
     set color white
     set year 3
     set just-changed 1
   ]
   if (just-changed != 1)[ 
     set year 3 
     set just-changed 1
   ]
  ]
  
  if year = 3[
    if (color != 135 and color != 95 and just-changed != 1)[
      set color brown
      set year 4 
      set just-changed 1
    ]
    if (just-changed != 1)[ 
      set year 4
      set just-changed 1
    ]
  ]
        
  if (year = 4 and just-changed != 1) [ ;; hatch a new turtle with year 1 and then die
    hatch 1 [
      set color orange
      set year 1
      set greek? 0
      set antigreek? 0
      set bias 0
      set size 2
      set shape "person"
      set just-changed 1
    ]
    die
  ]
end 

to reset-just-changed
   set just-changed 0 ;; reset just-changed to 0 after updating the turtles
end 

to greeks-to-house ;; if i'm greek i face a patch that is greek and move towards it
  if color = 95[
    face one-of patches with [pcolor = 97]
    fd 1
  ]
end 

There are 4 versions of this model.

Uploaded by When Description Download
Edgar Vazquez almost 9 years ago Final project implementation Download this version
Edgar Vazquez almost 9 years ago Uses media bias and school bias. Download this version
Edgar Vazquez almost 9 years ago Basic interaction implemented. Download this version
Edgar Vazquez almost 9 years ago Initial upload Download this version

Attached files

File Type Description Last updated
372 Poster.jpg jpeg Poster almost 9 years ago, by Edgar Vazquez Download
Edgar_Vazquez_Slam.pdf pdf Poster Slam Slides almost 9 years ago, by Edgar Vazquez Download
EdgarVazquez_June2nd.docx word Progress Report of more implementations and coming implementations for the final model. almost 9 years ago, by Edgar Vazquez Download
Final Project Report.docx word Final Project Report almost 9 years ago, by Edgar Vazquez Download
Original Project Proposal.docx word Original Project Proposal almost 9 years ago, by Edgar Vazquez Download
Project Progress Report v0.1.docx word Progress Report of general overview of concept. almost 9 years ago, by Edgar Vazquez Download
Project Progress Report v0.2.docx word Progress Report of first implementation of interactions. almost 9 years ago, by Edgar Vazquez Download

This model does not have any ancestors.

This model does not have any descendants.