I wanna play, too.
I am glad my useless pointless nothing but bloated window dressing app and the OP have inspired you to play.
Although... you are playing with an ages old toy that very few people can join in on the play... so you are only playing by yourself unfortunately.
I had to rummage through my pile of old hard drives and plug it into an old computer to be able to find a working version of a BASIC from 13 years ago that is 1000 times better than QBasic (aahh the halcyon days) and runs on CURRENT Windows 10.
And I had to modify your code just a tad to fit the syntax of this better BASIC interpreter/compiler.... and I fixed a spelling error.
Notice it is 9 lines of code now... so jt512 still has you beat 8 times over.
And the Bash version of theprestive has you beat 1000 times over in that at least one can run it on a modern Linux machine.
Here is the modified less ancient BASIC code...
Code:
flips = 10 \ heads = 0\ mark = 1
For cntr = 1 To flips
If random(1) >= .5 then heads++
If cntr == mark
Print "Iterations =", cntr, " and heads are at ", 100 * heads / cntr, "%"
mark++
endif
Next
Print "All done at ", flips, " and heads are at ", 100 * heads / flips, "%"
And I ran it and here is the result....
Code:
Iterations =1 and heads are at 100%
Iterations =2 and heads are at 100%
Iterations =3 and heads are at 100%
Iterations =4 and heads are at 100%
Iterations =5 and heads are at 80%
Iterations =6 and heads are at 83%
Iterations =7 and heads are at 71%
Iterations =8 and heads are at 62%
Iterations =9 and heads are at 66%
Iterations =10 and heads are at 70%
All done at 10 and heads are at 70%
================
Iterations =1 and heads are at 0%
Iterations =2 and heads are at 50%
Iterations =3 and heads are at 66%
Iterations =4 and heads are at 50%
Iterations =5 and heads are at 40%
Iterations =6 and heads are at 33%
Iterations =7 and heads are at 42%
Iterations =8 and heads are at 37%
Iterations =9 and heads are at 44%
Iterations =10 and heads are at 50%
All done at 10 and heads are at 50%
================
Iterations =1 and heads are at 0%
Iterations =2 and heads are at 0%
Iterations =3 and heads are at 33%
Iterations =4 and heads are at 50%
Iterations =5 and heads are at 60%
Iterations =6 and heads are at 66%
Iterations =7 and heads are at 71%
Iterations =8 and heads are at 62%
Iterations =9 and heads are at 66%
Iterations =10 and heads are at 60%
All done at 10 and heads are at 60%
Last edited:
