SixFaces

SixFaces preview image

1 collaborator

Tags

dice 

Tagged by Francisco Restivo over 6 years ago

statistics 

Tagged by Francisco Restivo over 6 years ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0 • Viewed 134 times • Downloaded 12 times • Run 0 times
Download the 'SixFaces' 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

; How many times you need to throw a dice to obtain the 6 possible face values?
; At least 6 times, of course
; Mean value is 14.7 sharp

; Simulation by Francisco Restivo, frestivo@gmail.com

globals [valor faces serie nseries media fim]

to setup
 clear-all
 crt 33 ; 33 turtles, for lengths from 1 to 33
 ask turtles [
   set label (who + 1)
   setxy (who - 16) -16
   set heading 0
   set pen-size 9
   pd ]
 reset-ticks
 set faces [0 0 0 0 0 0]
 set serie 0
 set nseries 0
 set fim 0
end 

to throw
  tick
  set valor random 6
  set serie serie + 1
  if item valor faces = 0 [
    set faces replace-item valor faces 1 ]
  if faces = [1 1 1 1 1 1] [ ; got the 6 faces?
    if serie <= 33 [
      ask turtle (serie - 1) [
        forward 10 ^ step
        if ycor >= 16 [ ; race ended?
          set fim 1] ] ]
    set faces [0 0 0 0 0 0]
    set nseries (nseries + 1)
    set media (ticks / nseries)
    set serie 0 ]
end 

to go
  if fim = 0 [
    throw ]
end 

There is only one version of this model, created over 6 years ago by Francisco Restivo.

Attached files

File Type Description Last updated
SixFaces.png preview Preview for 'SixFaces' over 6 years ago, by Francisco Restivo Download

This model does not have any ancestors.

This model does not have any descendants.