FormulaT - Pitboss

No preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

(This model has yet to be categorized with any tags)
Model group LS 426-2009 | Visible to everyone | Changeable by everyone
Model was written in NetLogo 4.1RC4 • Viewed 272 times • Downloaded 26 times • Run 4 times
Download the 'FormulaT - Pitboss' modelDownload this modelEmbed this model

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


VERSION

$Id: FormulaT-pitboss.nlogo 44496 2009-09-27 21:09:30Z nholbert $

WHAT IS IT?

FormulaT Racing is a NetLogo racing simulation designed to move the playerÕs qualitative understanding of velocity and acceleration beyond early intuitive interpretations. The game design is based on qualitative research data of kids playing racing games and highlights important design components uncovered in these interviews and observation sessions. The design components themselves are subtle alterations of typical commercial game designs that should nudge the player to connect intuitive interpretations to more formally acceptable explanations.

HOW TO USE IT

This model in FormulaT takes racing in a very different direction. Here the player will step into the shoes of the pitboss and do their best to help the player car reach the finish line. The player has two main options: they can create a graph to dictate the speed and velocity to the player car, or they can "paint the track." Their choice is determined by the DATA-SOURCE chooser.

Before doing anything else, the player should decide which track they are going to race on by selecting the track in the CHOOSE-TRACK chooser, and then choose how they will direct their car in the DATA-SOURCE chooser--either "Graph" or "Paint." Then press the SETUP button.

Because this track presents a very different challenge you may find your first graph or track painting doesn't work. Keep trying! Think of each crash as a learning opportunity!

Driving by graph:

If you choose to drive using a graph as a data source, your must first create a graph in the FormulaT-graphing model. If you've already done this, once you choose your track and press SETUP, simply press the LOAD DATA button, select the .txt file that contains your graph data, click "Open" and then click "OK" when you see the "File Loading Complete" dialogue. Your graph data is now loaded and you're ready to race!

If you haven't yet created a graph, press the "Graph Tool" button to go to the FormulaT-graphing model.

Driving by paint:

If you choose to drive by paint, you have an addition choice to make. Do you want your paint job to tell the car how to accelerate, or do you want the paint to tell the car what it's top speed should be? Make your choice using the PAINT-SETS chooser.

After pressing SETUP to create the track, press the PATCH-DRAW button to begin painting. Select your BRUSH-SIZE using the slider and your SPEED-COLOR using the chooser. Notice the "scale" below that explains what each color means. When you're ready to paint simply move your mouse over the track and click to paint! If you need to change a section you've already painted, simply paint over it with a different color (or choose "Black" to "erase"). If you've made too many mistakes, or you decide to drive by graph, feel free to press the CLEAR PAINT button to reload the original track.

---Buttons and Controls---

Buttons:

- SETUP is usually the first button to press. This sets up the track and gives the player model goals.

- GO starts the race!

- LOAD DATA loads data from a .txt file created in the FormulaT-graphing model for driving by graph.

- RESET CAR resets the car to the starting line without completely wiping the track and marker turtle's data. Very useful if you've crashed and you want to make a small change before trying again.

- NEXT TRACK automatically opens the next model in the game.

- PATCH-DRAW click to allow the user to paint on the track using their mouse

- CLEAR PAINT reloads the original track

- EXPORT VIEW press to save the view as an image file (be sure to add .png to the end of your file name)

Switches:

- FULL-GRAPH? when "On" turns on "autoplot" for the graph, when "Off" sets the graph to scroll with the most recent data

Sliders:

- BRUSH-SIZE sets the brush size when painting the track

Monitors:

- CAR-STATS plots the player car's speed

- TIMER a constant timer that resets when you press the GO button

- LAST-TIME shows the time of your most recent run

- BEST-TIME shows the time of your best run

Choosers:

- CHOOSE-TRACK choose the track to race on!

- DATA-SOURCE choose whether you'll use a graph or paint to determine your car's velocity and acceleration.

- PAINT-SETS choose whether the color of the track determines how the car accelerates or the car's max-speed.

- SPEED-COLOR choose the color of your "paint brush" (notice the scale below the chooser when painting!)

THINGS TO NOTICE

Take a look at the plot after the race. Does the plot look like what you expected? Can you explain the high and low points? If you're having trouble finishing a race use the information from the plot to help you understand what you may be doing wrong.

Notice anything strange about the plot behavior when you're painting the max-speed. Why does the graph look like this? How does this effect your painting choices?

If you're driving by graph, compare the race plot to the graph you made in the graphing model. Do they look the same? How are they different? Can you explain why it is different in certain points?

If you're crashing a lot when driving by paint, consider adjusting your speed earlier. The speed the car is going at each marker greatly impacts the path it will take later on.

THINGS TO TRY

There are an infinite number of ways to "win" a race, however, some methods are faster than others. If you find a method that works (allows you to complete the track) try tweaking your method until you get the fast time possible!

Try all three methods of control: graphing, painting max-speed, and painting acceleration. You'll find that they each require you to think about motion very differently.

Feel free to "look under the hood" and play in the procedure's tab. Remove the crashing procedure, add or subtract from the slide variable, change the painting colors, or add competition cars to race against!

EXTENDING THE MODEL

Add new maps by creating a new image of a race track.

Try changing the equations governing your car and the competition's movement.

Add more competition or alter the way the competition drives around the track.

Add a timer to change the goal of the game to be about beating your best time.

RELATED MODELS

FormulaT models are all labeled with FormulaT at the beginning. The following all belong to the FormulaT racing simulation:

FormulaT - pass

FormulaT - constantacc

FormulaT - matchvelocity

FormulaT - passthenmatch

FormulaT - finishsolo

FormulaT - competition

FormulaT - editable

FormulaT - graphing

FormulaT - pitboss

Also try out the RaceTrack model created by Seth Tissue.

CREDITS AND REFERENCES

Created by Nathan R. Holbert 6/6/09

Comments and Questions

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

Click to Run Model

extensions [
   sound
]
globals [
  speed-out                                                    
  speed-out2
  slide
  best-time
  last-time
  previous-heading
  velocity-data
  car-ahead
  next-turtle
]
turtles-own [
  speed
  speed-other
  max-speed
  ring-done?
  square-done?
  hard-done?
  vel-data
  acc-data
  min-speed
  sound-flag?
  old-heading
]
breed [ player-cars player-car ]
breed [ other-cars other-car ]

;;;;;;;;;;;;;;;;;;;;;;
;; Setup procedures ;;
;;;;;;;;;;;;;;;;;;;;;;

to setup
  clear-all
  reset-timer
  set-up-track
  make-cars
  speed-legend
  create-markers
  user-message "Ok kid now lets see if you've got what it takes to be a pitboss! You have two main options, you can drive by paint, or drive by graph. If you choose to paint, choose whether you're painting velocity or acceleration. If you're going to drive by graphing, be sure to make a velocity graph in the FormulaT-graphing model. Good luck! "
end 

to make-cars
  create-player-cars 1 [                                       ;; set up the player's car
    set size 20
    set shape "car"
    set heading 0
    set color blue
    set xcor max-pxcor * 0.85
    set ycor 6
    set speed 0
    set max-speed 12
    set sound-flag? false
  ]
end 

to set-up-track
  if Choose-Track = "Ring" [                                   ;; load maps
    import-pcolors "ringtrack.png"
  ]
  if Choose-Track = "Square" [
    import-pcolors "squaretrack.png"
  ]
  if Choose-Track = "Hard" [
    import-pcolors "hardtrack.png"
  ]
  
  ask patches with [ pcolor = 0.3 ] [                           ;; tweak patch colors so they're easier to identify (may not be necessary)
    set pcolor black
  ]
  ask patches with [ pcolor = 64.4 ] [
    set pcolor green
  ]

  ask patches with [pxcor > 200 and abs pycor <= 5 and pcolor = black] [   ;; make finishing line
    set pcolor yellow
  ]
end 

to load-data                                                        ;; Loads data from previously made .txt file
  let file user-file                                            ;; user chooses file from a pop up window

  if ( file != false )
  [
    set velocity-data []                                            ;; creates a list and dumps the graphing data into the list
    file-open file

    while [ not file-at-end? ]
      [ set velocity-data sentence velocity-data (list (list file-read file-read file-read)) ]

    user-message "File loading complete!"
    file-close
  ]
end 

to train-turtles                                                     ;; takes the data from the list we just created and sets turtle variables
  ifelse ( is-list? velocity-data )
    [ foreach velocity-data [ ask turtle first ? [ set vel-data item 1 ? set acc-data last ? ] ] ]  ;; [ # (turtle who) # (vel-data) # (acc-data) ]...find the turtle then set the variables
    [ user-message "You need to load in patch data first!" ]
end 

to speed-legend
  ifelse paint-sets = "Max-Speed" [
    output-print "              Max-Speed"
    output-print "Violet            1"
    output-print "Blue              2"
    output-print "Cyan              3"
    output-print "Orange            4"
    output-print "Red               5"
    output-print "Black            Max"
  ] [
    output-print "              Acceleration"
    output-print "Violet           -0.07"
    output-print "Blue             -0.05"
    output-print "Cyan             -0.03"
    output-print "Orange           +0.03"
    output-print "Red              +0.05"
    output-print "Black              0"
  ]
end 


;;;;;;;;;;;;;;;;;;;
;; go procedures ;;
;;;;;;;;;;;;;;;;;;;

to go
  ask turtle 0 [                                                   ;; reset timer at the beginning of the race
    if speed = 0
      [ reset-timer ]
  ]
  if time-limit? = true [
    ask turtle 0 [                                                   ;; reset timer at the beginning of the race
      if speed = 0
        [ reset-timer ]
      if Choose-Track = "Ring" [                                     ;; sets an effective time limit for races depending on the track
        if timer > 6                                                ;; this is done to encourage the player to get around the track at the highest speed possible
          [ set speed 0
            set shape "x"
            user-message "You took too long!  Try again letting the car get a bit faster this time!  Press 'Halt' and 'Reset Car'." ]
      ]
      if Choose-Track = "Square" [
        if timer > 5
          [ set speed 0
            set shape "x"
            user-message "You took too long!  Try again letting the car get a bit faster this time!  Press 'Halt' and 'Reset Car'." ]
      ]
      if Choose-Track = "Hard" [
        if timer > 7
          [ set speed 0
            set shape "x"
            user-message "You took too long!  Try again letting the car get a bit faster this time!  Press 'Halt' and 'Reset Car'." ]
      ]
    ]
  ]
  
  if data-source = "Graph"                                         ;; look at the chooser to see which data method to use
    [ drive-by-graph ]
  if data-source = "Paint"
    [ drive-by-color ]
  
  ask turtle 0 [                                                  
    if any? patches in-cone 5 30 with [ pcolor = yellow ]         ;; win if you cross the yellow line
      [ set speed 0                                                
        set last-time timer                                       ;; set up last-time and best-times
        if best-time = 0 or last-time < best-time [ set best-time last-time ]
        set shape "face happy"
        if choose-track = "Ring"                                  ;; a flag that gets set when the player finishes each track
          [ set ring-done? true ]
        if choose-track = "Square"
          [ set square-done? true ]
        if choose-track = "Hard"
          [ set hard-done? true ] ]
              
     if shape = "face happy"                                      ;; checks to see how many tracks you've finished
       [ ifelse Ring-done? = true                                 ;; player has to finish all tracks to move on
         [ ifelse Square-done? = true
           [ ifelse Hard-done? = true
             [ sound:play-sound "win.wav"
               user-message "You completed all the tracks! There are no more challenges! You are the FormulaT Champion!" ]
             [ user-message "You completed this track!  Press 'Halt' choose a new track, then press 'Reset Track' to attempt the next track!"]
           ]
           [ user-message "You completed this track!  Press 'Halt' choose a new track, then press 'Reset Track' to attempt the next track!"]
         ]
         [ user-message "You completed this track!  Press 'Halt' choose a new track, then press 'Reset Track' to attempt the next track!"]  
    ]
  ]
  ask player-cars [
    if [pcolor] of patch-ahead 1 = green                         ;; if the pach ahead is grass, report a crash
      [ set speed 0 
        set shape "x"
        if sound-flag? = false [
          sound:play-sound "crashed.wav"
          set sound-flag? true
        ]
        user-message "You crashed! Press 'halt' then 'Next Track' to try again!"
      ]
   set slide speed * 1.5                                         ;; slide increases as speed increases (this number may still need adjusting)
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;
;;  DRIVE BY GRAPH  ;;      If the player chooses this option they will be using the loaded graph data to determine the vehicle's speed and acceleration
;;;;;;;;;;;;;;;;;;;;;;

to drive-by-graph
  ask player-car 0 [
    let acc-factor 0.03                                                         ;; uses a variable for acceleration so it can be easily tweaked
    if next-turtle = 0 [                                                        ;; sets next-turtle variable to 1
      set next-turtle 1
    ]
    if distance turtle next-turtle > 50 and next-turtle = 1                     ;; if no turtle in range, gradually speed up (so the car doesn't get stuck in the beginning)
      [ set speed speed + acc-factor
        face turtle next-turtle
        fd speed ]
    if distance turtle next-turtle < 50                                         ;; checks to see if "next-turtle" is in range
      [ set vel-data [vel-data] of turtle next-turtle                           ;; sets vel-data & acc-data of player-car to the data in the marker turtle
        set acc-data [acc-data] of turtle next-turtle
        if speed < vel-data
          [ set max-speed vel-data ]                                            ;; sets max-speed to the vel-data if going slower than data
        if speed > vel-data
          [ set min-speed vel-data ]                                            ;; sets min-speed to the vel-data if going faster than data
        if speed != vel-data                                                  ;; if the player-car isn't going the correct speed according to the graph
          [ set speed speed + (acc-data * acc-factor) ]                             ;; adjusts speed using the acc-data (multiplied by the acc-factor for tweaking purposes)
        if speed = vel-data
          [ set speed vel-data ]
        ifelse turtle (next-turtle + 1) = nobody                                ;; looks for the last marker-turtle, if we're on it
          [ 
            set next-turtle 1
            face turtle next-turtle                                             ;; turn towards turtle 1 and adjust heading based on speed
            set heading (heading + (speed ^ 1.5) )
             ]
          [ if distance turtle next-turtle < 25 [                         ;; look ahead to see if next-turtle + 1 is getting close...
            set next-turtle (next-turtle + 1)                             ;; if it is, make that the new "next-turtle"
            set old-heading heading                                       ;; saves this heading to use in the following procedures
            face turtle next-turtle
            ifelse (heading - old-heading) < 190 [                        ;; check to make sure the car is making a slight turn
              if old-heading > heading [                                  ;; if it is and it's turning left
                set heading (heading +  (speed ^ 1.5) )               ;; add to the heading a random value between 0 and speed squared
              ]
              if old-heading < heading [                                  ;; if it's turning right
                set heading (heading - (speed ^ 1.5) )               ;; subtract to the heading a random value between 0 and speed squared
              ] ] [
              if old-heading > heading [                                  ;; if this is a big turn (greater than 190 degree turn)
                set heading (heading + (speed ^ 3) )               ;; do the same kind of stuff but make it a random value between 0 and speed to the fourth
              ]
              if old-heading < heading [
                set heading (heading - (speed ^ 3) )
              ] ]
            fd speed           
            ]
          ]
      ]

    if speed > max-speed [                                      ;; keeps the car from going above max-speed
      set speed speed - acc-factor
    ]
    
    if speed < min-speed [                                      ;; keeps the car from going below the min-speed
      set speed min-speed
    ]

    if speed != vel-data [                                      
      set speed speed + (acc-data * acc-factor)
    ]
    
    if speed < 0 [                                              ;; keeps speed from going negative (probably don't need anymore...)
      set speed 0
    ]
    fd speed
  ]
  colortrail
  tick
  do-plots
end 

;;;;;;;;;;;;;;;;;;;;;;
;;  DRIVE BY COLOR  ;;
;;;;;;;;;;;;;;;;;;;;;;

to drive-by-color
  ask player-car 0 [
     if paint-sets = "Acceleration"                             ;; if paint-acceleration? switch is true, paint changes the car's rate of deceleration
       [
         if [pcolor] of patch-here = violet
           [ set speed speed - 0.07 ]
         if [pcolor] of patch-here = blue
           [ set speed speed - 0.05 ]
         if [pcolor] of patch-here = cyan
           [ set speed speed - 0.03 ]
         if [pcolor] of patch-here = orange
           [ set speed speed + 0.03 ]
         if [pcolor] of patch-here = red
           [ set speed speed + 0.05 ]
       ]
     if paint-sets = "Max-Speed"
       [
         if [pcolor] of patch-here = violet                          ;; if paint-acceleration? switch is false, paint changes the car's max speed
           [ set max-speed 1 ]
         if [pcolor] of patch-here = blue
           [ set max-speed 2 ]
         if [pcolor] of patch-here = cyan
           [ set max-speed 3 ]
         if [pcolor] of patch-here = orange
           [ set max-speed 4 ]
         if [pcolor] of patch-here = red
           [ set max-speed 5 ]
         if [pcolor] of patch-here = black
           [ set max-speed 20 ]
         set speed speed + 0.03                                      ;; gradually speeds up
       ]                

    if ( speed - max-speed ) >= 3                               ;; crashes if the player tries to lower the max-speed too quickly (only happens when painting max-speed)
      [ set speed 0                                             
        set shape "face sad"
        user-message "You can't slow down that fast! Press 'Halt' then 'Next Track' to try again!"
      ]

    if speed > max-speed [                                      ;; keeps the car from going above max-speed
      set speed speed - 0.1
    ]

    if speed < 0 [                                              ;; keeps speed from going negative
      set speed 0
    ]

    if next-turtle = 0 [                                                        ;; sets next-turtle variable to 1
      set next-turtle 1
    ]
    if distance turtle next-turtle > 50 and next-turtle = 1                     ;; if no turtle in range, gradually speed up (so the car doesn't get stuck in the beginning)
      [ face turtle next-turtle
        fd speed ]
    if distance turtle next-turtle < 60                                         ;; checks to see if "next-turtle" is in range
      [ fd speed 
        ifelse turtle (next-turtle + 1) = nobody                                ;; looks for the last marker-turtle, if we're on it
          [ set next-turtle 1
            face turtle next-turtle                                             ;; turn towards turtle 1 and adjust heading based on speed
            set heading (heading + (speed ^ 1.5) )
             ]
          [ if distance turtle next-turtle < 25 [                         ;; look ahead to see if next-turtle + 1 is getting close...
              set next-turtle (next-turtle + 1)                             ;; if it is, make that the new "next-turtle"
              set old-heading heading                                       ;; saves this heading to use in the following procedures
              face turtle next-turtle
              
              ifelse (heading - old-heading) < 190 [                        ;; check to make sure the car is making a slight turn
                if old-heading > heading [                                  ;; if it is and it's turning left
                  set heading (heading + (speed ^ 1.5) )               ;; add to the heading a random value between 0 and speed squared
                ]
                if old-heading < heading [                                  ;; if it's turning right
                  set heading (heading - (speed ^ 1.5) )               ;; subtract to the heading a random value between 0 and speed squared
                ] ] [
                if old-heading > heading [                                  ;; if this is a big turn (greater than 190 degree turn)
                  set heading (heading + (speed ^ 3) )               ;; do the same kind of stuff but make it a random value between 0 and speed to the fourth
                ]
                if old-heading < heading [
                  set heading (heading - (speed ^ 3) )
                ] ]
                
              fd speed                                  
            ]
;;          set next-turtle (next-turtle + 1)
;;          set old-heading heading
;;          face turtle next-turtle
          ]
      ]
  fd speed
]
  tick
  do-plots
end 

to do-plots
  set-current-plot "Car-Stats"
  set-current-plot-pen "velocity"
  plot [speed] of player-car 0                                      ;; plot the velocity of your car
  ask player-car 0 [                                                ;; pen color based on speed of car
    if speed <= 1 [
    set-plot-pen-color 115
  ]
  if ( speed > 1 and speed <= 2 ) [
    set-plot-pen-color 105
  ]
  if ( speed > 2 and speed <= 3 ) [
    set-plot-pen-color 85
  ]
  if ( speed > 3 and speed <= 4 ) [
    set-plot-pen-color 25
  ]
  if ( speed > 4 and speed <= 5 ) [
    set-plot-pen-color 15
  ]
  if speed > 5 [
    set-plot-pen-color 0
  ]]
  if graph-mode = "Scrolling Graph"
    [
      if ticks > 50                                                  ;; creates a rolling plot if full-graph? is turned off
      [ set-plot-x-range (ticks - 50) ticks ]
    ]
end 

;;;;;;;;;;;;;;;;;;;;;
;; button commands ;;
;;;;;;;;;;;;;;;;;;;;;

to patch-draw
  if mouse-down?     ;; reports true or false to indicate whether mouse button is down
    [
      if speed-color = "Violet" [                  ;; sets color based on chooser
        ask patch mouse-xcor mouse-ycor            ;; paints at location of mouse
          [ ask patches in-radius 20       ;; size of painted area based on slider
            [ if pcolor != green and pcolor != yellow                   ;; doesn't paint over grass
              [ set pcolor violet ] ] ] ]
      if speed-color = "Blue" [
        ask patch mouse-xcor mouse-ycor
          [ ask patches in-radius 20        
            [ if pcolor != green and pcolor != yellow
              [ set pcolor blue ] ] ] ]
      if speed-color = "Cyan" [
        ask patch mouse-xcor mouse-ycor
          [ ask patches in-radius 20        
            [ if pcolor != green and pcolor != yellow
              [ set pcolor cyan ] ] ] ]
      if speed-color = "Orange" [
        ask patch mouse-xcor mouse-ycor
          [ ask patches in-radius 20
            [ if pcolor != green and pcolor != yellow
              [ set pcolor orange ] ] ] ]
      if speed-color = "Red" [
        ask patch mouse-xcor mouse-ycor
          [ ask patches in-radius 20
            [ if pcolor != green and pcolor != yellow
              [ set pcolor red ] ] ] ]
      if speed-color = "Black" [
        ask patch mouse-xcor mouse-ycor
          [ ask patches in-radius 20
            [ if pcolor != green and pcolor != yellow
              [ set pcolor black ] ] ] ]                                         
    ]
end 

to reset-track                                            ;; resets track without reseting flags
  clear-all-plots
  set-up-track
  ask player-car 0 [                                       
    set size 20
    set shape "car"
    set heading 0
    set color blue
    set xcor max-pxcor * 0.85
    set ycor 6
    set speed 0
  ]
end 

to save-track-image
  let file user-new-file

  if ( file != false )
  [
    if file-exists? file [  ;; overwrites files of the same name
      file-delete file
    ]
    export-view file
  ]
end 

to next-race
  run "__magic-open \\"FormulaT-graphing\\""              ;; should open the next race...
end 

;;;;;;;;;;;;;;;;;;;;;;
;; COLOR TRAIL CODE ;;  Leaves a trail of color behind the player car that corresponds to the vehicle's velocity
;;;;;;;;;;;;;;;;;;;;;;

to colortrail
  ask player-car 0 [
    rt 180
    if speed <= 1 [
      ask patches in-cone 6 120 [
        set pcolor violet
      ]
    ]
    if speed <= 2 and speed > 1 [
      ask patches in-cone 6 120 [
        set pcolor blue
      ]
    ]
    if speed <= 3 and speed > 2 [
      ask patches in-cone 6 120 [
        set pcolor cyan
      ]
    ]
    if speed <= 4 and speed > 3 [
      ask patches in-cone 6 120 [
        set pcolor orange
      ]
    ]
    if speed <= 5 and speed > 4 [
      ask patches in-cone 6 120 [
        set pcolor red
      ]
    ]
    if speed > 5 [
      ask patches in-cone 6 120 [
        set pcolor black
      ]
    ]
    rt 180                    
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; MARKER MAKING AND MOVING PROCEDURE ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to create-markers                                                ;; creates turtles to split up the track into 20 equal parts
  if Choose-Track = "Ring" or Choose-Track = "Square" [
    
  set previous-heading 0                                        ;; sets to zero so the first turtle is in the correct spot
  repeat 3 [
    crt 1 [
    set heading 90                                              ;; tweaks heading so numbers start from starting line
    set size 5
    set color black
    set label who                                               ;; shows turtle number
    left previous-heading + 14                                  ;; sets up a recursion procedure so that turtles at different areas of the track adjust by different amounts
    set previous-heading previous-heading + 14
    ]
  ]
  repeat 4 [
    crt 1 [
    set heading 90                                              
    set size 5
    set color black
    set label who                                               
    left previous-heading + 24                                  
    set previous-heading previous-heading + 24
    ]
  ]
  
  repeat 6 [
    crt 1 [
    set heading 90                                              
    set size 5
    set color black
    set label who                                               
    left previous-heading + 14                                  
    set previous-heading previous-heading + 14
    ]
  ]
  repeat 4 [
    crt 1 [
    set heading 90                                              
    set size 5
    set color black
    set label who                                               
    left previous-heading + 24                                  
    set previous-heading previous-heading + 24
    ]
  ]
  repeat 3 [
    crt 1 [
    set heading 90                                              
    set size 5
    set color black
    set label who                                               
    left previous-heading + 14                                  
    set previous-heading previous-heading + 14
    ]
  ]
  ask turtles with [ who > 0] [
    repeat 300 [
      ifelse ([pcolor] of patch-here = black or [pcolor] of patch-here =  yellow) and ([pcolor] of patch-ahead 30 = green)  ;; they need to be on black first, then close to the edge of the green
        [ stop ]                                                ;; stop once they're in the correct spot
        [ fd 1 ]
      ]
    ]
  ]
  if Choose-Track = "Hard" [
    crt 20 [
    set size 5
    set color black
    set label who
    ]
    ask turtle 1 [ setxy 282 84 ]
    ask turtle 2 [ setxy 229 153 ]
    ask turtle 3 [ setxy 121 161 ]
    ask turtle 4 [ setxy 27 127 ]
    ask turtle 5 [ setxy -78 155 ]
    ask turtle 6 [ setxy -279 121 ]
    ask turtle 7 [ setxy -288 -10 ]
    ask turtle 8 [ setxy -286 -134 ]
    ask turtle 9 [ setxy -237 -139 ] 
    ask turtle 10 [ setxy -170 -20 ]
    ask turtle 11 [ setxy -181 36 ]
    ask turtle 12 [ setxy -154 85 ]
    ask turtle 13 [ setxy -84 56 ]
    ask turtle 14 [ setxy -3 -39 ]
    ask turtle 15 [ setxy -79 -141 ]
    ask turtle 16 [ setxy -14 -160 ]
    ask turtle 17 [ setxy 33 -121 ]
    ask turtle 18 [ setxy 202 -165 ]
    ask turtle 19 [ setxy 280 -73 ]
    ask turtle 20 [ setxy 283 0 ]
  ]
end 

There is only one version of this model, created over 14 years ago by Uri Wilensky.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.