small basic
Watch
Announcements
Page 1 of 1
TextWindow.WriteLine("How many times do you want to throw the dice")
tries=TextWindow.Read()
NumberOfDoubleSixes=0
NumberOfDoubleSixes2=0
attempts=0
DieRoll=Math.GetRandomNumber(6)
DieRoll2=Math.GetRandomNumber(6)
tenthousands=0
tries1=tries-remainder
remainder=math.Remainder(tries,1 0000)
if remainder<>0 Then
While attempts<> remainder
attempts=attempts+1
DieRoll=Math.GetRandomNumber(6)
DieRoll2=Math.GetRandomNumber(6)
If DieRoll+DieRoll2=12 Then
NumberOfDoubleSixes2=NumberOfDou bleSixes2+1
Else
TextWindow.WriteLine("You got "+NumberOfDoubleSixes2+" double sixes in "+remainder+" dice rolls")
For attempts=1 To tries1
For newcounter=1 To 10000
DieRoll=Math.GetRandomNumber(6)
DieRoll2=Math.GetRandomNumber(6)
If DieRoll+DieRoll2<>12 then
attempts=attempts+1
tenthousands=tenthousands+1
Else
attempts=attempts+1
NumberOfDoubleSixes=NumberOfDoub leSixes+1
tenthousands=tenthousands+1
EndIf
EndFor
TextWindow.WriteLine("In "+tenthousands+ " rolls you got "+NumberOfDoubleSixes+ " double sixes")
EndFor
EndIf
EndWhile
This is my coding i am not sure why it is not running do you know why?
tries=TextWindow.Read()
NumberOfDoubleSixes=0
NumberOfDoubleSixes2=0
attempts=0
DieRoll=Math.GetRandomNumber(6)
DieRoll2=Math.GetRandomNumber(6)
tenthousands=0
tries1=tries-remainder
remainder=math.Remainder(tries,1 0000)
if remainder<>0 Then
While attempts<> remainder
attempts=attempts+1
DieRoll=Math.GetRandomNumber(6)
DieRoll2=Math.GetRandomNumber(6)
If DieRoll+DieRoll2=12 Then
NumberOfDoubleSixes2=NumberOfDou bleSixes2+1
Else
TextWindow.WriteLine("You got "+NumberOfDoubleSixes2+" double sixes in "+remainder+" dice rolls")
For attempts=1 To tries1
For newcounter=1 To 10000
DieRoll=Math.GetRandomNumber(6)
DieRoll2=Math.GetRandomNumber(6)
If DieRoll+DieRoll2<>12 then
attempts=attempts+1
tenthousands=tenthousands+1
Else
attempts=attempts+1
NumberOfDoubleSixes=NumberOfDoub leSixes+1
tenthousands=tenthousands+1
EndIf
EndFor
TextWindow.WriteLine("In "+tenthousands+ " rolls you got "+NumberOfDoubleSixes+ " double sixes")
EndFor
EndIf
EndWhile
This is my coding i am not sure why it is not running do you know why?
0
reply
X
Page 1 of 1
Quick Reply
Back
to top
to top