GDPractice icon indicating copy to clipboard operation
GDPractice copied to clipboard

Add an API for testing random number generation, which reliable simulation first and heuristics as a fallback

Open NathanLovato opened this issue 1 year ago • 0 comments

Note: we only have a handful of practices that include random number generation so before implementing this, we really need to be sure that we will have many more practices like this.

In Learn 2D Gamedev, in M6.L6.P1, we use random number generation using the basic GDScript functions and depending on when people add new as children or which functions they use, it changes the random numbe generation so we cannot reliably test their code in every possible situation. Even using RandomNumberGenerator objects, the problem would likely remain even if it'd be narrowed.

GDScript does not have metaprogramming tools so we don't have a way to read the student code or generate all the possible code permutations, which would be needed to reliably test student practices.

This task is about creating an API to first try reliable testing, by trying to compare the student output with simulated permutations of the RNG code, and then to add a fallback mechanism that would try to produce lots of random numbers using the student code only and check if it's seemingly random. This would allow them to pass the practices involving random number generation more easily.

NathanLovato avatar Jan 23 '25 12:01 NathanLovato