• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Random with memory

F

FloresSottile

Guest
I'm working on a game that helps kids develop math quickness in times table exercises and I'm trying to figure out what's the best approach to put on screen exercises randomly but with memory, so that every round a new exercise appears, but its multiples are different than the ones in the previous rounds, until all numbers have appeared as a multiple (2, 3, 4, 5, 6, 7, 8 and 9). The idea is to make rounds not repetitive and to let the kid be able to work with all tables from 2 to 9 in a short amount of rounds.

I tried with arrays but it wasnt efficient enough and it took too many lines.

Any ideas?
 
H

Homunculus

Guest
You could precompute in advance the order of the multiples instead of keeping track of randomized values.

In short, add all numbers to a ds_list, shuffle the list, and either remove one number at a time until empty or move through the list
 
Last edited by a moderator:
F

FloresSottile

Guest
You could precompute in advance the order of the multiples instead of keeping track of randomized values.

In short, add all numbers to a ds_list, shuffle the list, and either remove one number at a time until empty or move through the list
You're totally right and that did work. Thanks !
 
Top