QB64 Phoenix Edition
My kid found a probem with a program in a couple minutes. - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: Chatting and Socializing (https://qb64phoenix.com/forum/forumdisplay.php?fid=11)
+--- Forum: General Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=2)
+--- Thread: My kid found a probem with a program in a couple minutes. (/showthread.php?tid=2229)



My kid found a probem with a program in a couple minutes. - James D Jarvis - 12-06-2023

Handed my kid a simple dice roller program to see how worked on his computer.  It worked fine... until he decided to enter the maximum integer value for the # of dice rolls. The program accepted it but... then NOTHING. It didn't crash the system but it was going to take a LONG time to get an answer as it looped through all those dice rolls.

It was an easy fix to throttle the maximum valid input values but it was a good reminder to me to have someone else check a program before sending it on to other people.


RE: My kid found a probem with a program in a couple minutes. - TerryRitchie - 12-06-2023

(12-06-2023, 06:53 PM)James D Jarvis Wrote: Handed my kid a simple dice roller program to see how worked on his computer.  It worked fine... until he decided to enter the maximum integer value for the # of dice rolls. The program accepted it but... then NOTHING. It didn't crash the system but it was going to take a LONG time to get an answer as it looped through all those dice rolls.

It was an easy fix to throttle the maximum valid input values but it was a good reminder to me to have someone else check a program before sending it on to other people.
Yep, type value ranges will get you every time. I once wrote a game many years ago and could not figure out for the life of me why when the score got around 32000 it would reset to 0. It finally dawned on me after a few hours (and unnecessarily playing around with the code) that I was hitting the upper INTEGER limit. Changed Score% to Score& and all was good.