From: David B. <dav...@gm...> - 2010-12-13 22:19:37
|
Hi Aviral, I worked on factoroids a bit to try to prevent rocks with invalid numbers. I wrote a validate_numbers() function which basically factors out all the valid primes, leaving 1 if the number is valid for that wave, or a larger prime (say, 83) if the number is invalid. It turns out that generate_numbers() *always* creates valid results (or at it least did in a test run of 10,000,000 iterations). So I feel confident that your function is fine. Somehow, these invalid asteroids are getting created when the larger numbers get broken down during gameplay, probably due to some sort of float-integer conversion issue. I'm not quite sure of the exact issue, but now FF_add_asteroid() just returns and prints an error message if it is passed an invalid number, so they don't show up in the game. Anyway, the "new" factoroids is shaping up to be a really cool educational game, thanks to great work from you and the rest of the Google Code-In contributors. Best, David Bruce |