Click here to Skip to main content
15,913,140 members

Comments by OzWaz (Top 10 by date)

OzWaz 12-Aug-20 19:07pm View    
Thanks
Interesting experience for me.

I effected the changes as advised and uploaded it to my web server.

Strangely enough entering one value (Say 10000) will returns a "Percentage" result to two decimal places, yet entering a subsequent value (Say 11000) will returns a result to 12 decimal places.

It also gives the same result without the change.

You might like to tested it yourself but it is beyond my understanding-any further suggestion?

Regards
OzWaz 12-Aug-20 5:11am View    
Richard

Maybe best to look here http://warrenbolton.com/site/fliper3.php
OzWaz 12-Aug-20 5:02am View    

Probabilities




Enter Number :






';
echo "Of which the following resulted:-";
?>







";

}
}

flipper($tell);


?>

Consecutive Heads No. of times % of Total Tested $i $sets[$i] $per
OzWaz 12-Aug-20 4:59am View    
The program is working fine but I am sorry to report Richard that I think there is a couple of things that php cannot do that my basic program could.
For example, here is print out of my Basic
Number of flips undertaken was: 5000000
Number of 1 consecutive heads was:2498815 @ 49.9763 % of Flips
Number of 2 consecutive heads was:1249607 @ 24.99214 % of Flips AND @ 50.22 % of 1
Number of 3 consecutive heads was:624458 @ 12.48916 % of Flips AND @ 49.85 % of 2
Number of 4 consecutive heads was:311990 @ 6.2398 % of Flips AND @ 51.26 % of 3

As you can see - as well as recording the consecutive data (A) it also calculates and prints the percentage of each particular consecutive relevant to the total (B) PLUS it then calculates and prints the percentage of each particular consecutive relevant to the one immediately prior (C).
I was able to deduce how to modify your program to achieve the achieve B but to achieve C maybe a bridge to far I think
Viz:
Consecutive Heads No. of times % of Total Tested
1 500173 50.0173
2 249894 24.9894
3 124893 12.4893
4 62705 6.2705
5 31249 3.1249

The other deficiency is that it cannot analyse 1,000,000,000 cycles it returns this
“Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\coin\fliper3.php on line 42”
About 75,000,000 cycles is all it will do I have not idea why
I have supplied the program in case you want to take it for run

Regards
OzWaz 11-Aug-20 2:10am View    
Yes, that is correct it is now a PHP program that does exactly the same as small basic does - but with a few limitations.

Firstly, small basic also has an input facility so that you can enter the number of flips from the front end as would do with php and the HTML form tag into a database- But I can work on that one.

Secondly, it’s not correct to say “And crucially, when it goes wrong it is much easier to debug.”

It’s only easier to debug for those who have a good grasp of PHP but for me just starting to learn about PHP and without constructing the program myself and understanding how it all works - it would be a horror, whereas small basic is very easy for me to debug.

But it is a solid base and by analyzing it and playing with it, I am sure that I can deduce what all the functions are and eventually I will be able to use it in the format I want.

I couldn’t stay in small basic because I don’t know how to embed that into a HTML webpage.

I do appreciate that you’ve stayed with me on this project it’s been an interesting journey and again I thank you for all your efforts