username5396224
Badges: 12
Rep:
?
#1
Report Thread starter 1 month ago
#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?
0
reply
X

Quick Reply

Attached files
Write a reply...
Reply
new posts
Back
to top
Latest
My Feed

See more of what you like on
The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

Personalise

Have you experienced financial difficulties as a student due to Covid-19?

Yes, I have really struggled financially (53)
17.67%
I have experienced some financial difficulties (83)
27.67%
I haven't experienced any financial difficulties and things have stayed the same (115)
38.33%
I have had better financial opportunities as a result of the pandemic (39)
13%
I've had another experience (let us know in the thread!) (10)
3.33%

Watched Threads

View All