Toss-a-coin

Toss-a-coin preview image

1 collaborator

Default-person Pradeep Ankem (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0 • Viewed 493 times • Downloaded 8 times • Run 0 times
Download the 'Toss-a-coin' 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

globals
[
  toss
  marker
]

to setup
  clear-all
  create-turtles 10
  ask turtles [set shape "bug"]
  ifelse heads = TRUE [set toss 1] [set toss 0]
  ifelse heads = TRUE [set marker "heads"][set marker "tails"]
  reset-ticks
end 

to go
  ifelse heads = TRUE [set toss 1] [set toss 0]
  ifelse heads = TRUE [set marker "heads"][set marker "tails"]
  ifelse toss = random 2 [output-print word marker  " it is ,You have won"] [output-print word marker  " it is  ,You have lost"]
  ask turtles [
    pendown
    rt random 360      ; wander around aimlessly
    fd 10
  ]
  tick
end 

;; the actual plotting code is in the plot in the Interface tab.
;; the plot has setup code and the pen in it has update code.


; Public Domain:
; To the extent possible under law, Uri Wilensky has waived all
; copyright and related or neighboring rights to this model.

There is only one version of this model, created over 5 years ago by Pradeep Ankem.

Attached files

File Type Description Last updated
Toss-a-coin.png preview Preview for 'Toss-a-coin' over 5 years ago, by Pradeep Ankem Download

This model does not have any ancestors.

This model does not have any descendants.