car race

No preview image

1 collaborator

Default-person Ashley Choi (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.3.1 • Viewed 291 times • Downloaded 19 times • Run 0 times
Download the 'car race' 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

;Ashley Choi
;IntroCS1 pd08
;HW#51 - Be creative! (Hunger Games Style)
;2016-12-31

to setup
  ca
  ask patches [if pxcor = -15 [set pcolor green]; makes the start line
    if pxcor = 15 [set pcolor white]]; makes the finish line
  crt num_turtles
  ask turtles [set xcor -15]; makes your turtles to be on the start line
  ask turtles [set ycor 16 + who * 33 / num_turtles];Evenly spaces out your turtles so that no two turtles are on the same location
  ask turtles [set heading 90]; Makes your turtles face towards the finish line
  ask turtles [set shape "car top"]
end 

to locomote
  every .1
    [ fd random 10 / 10 ]; basically wiggle but in a straight path
end 

to GO
  locomote
  if xcor >= 15;If the location of one turtle reaches or goes past the finish line
    [ask other turtles [die]]; then the turtles that did not make it to the finish line die
  if count turtles = 1; if there is one turtle left
    [stop]; stop the function
          ;do not know how to incorporate celebratory dance :(
end 


There is only one version of this model, created almost 8 years ago by Ashley Choi.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.