I am trying to create a minesweeper game and for the randomisation part I am having some trouble.
For perhaps a 10 by 10 grid minesweeper, I hope to achieve 10 or a specific number of bombs/mines randomly but am unsure of how to do it.
I have a 2D mines array that stores TRUE if it contains a bomb.
I know in a 1D array I could have the total number of elements divided up into n equal parts and then have one TRUE boolean element per part.
Ah, but it doesn't have to be equally distributed. I am also not very sure about lists, would using a list be a good way to solve this?
Aucun commentaire:
Enregistrer un commentaire