vendredi 19 octobre 2018

Making an array with sets of numbers

I am making a memory game. Currently I am stuck at the initialisation part of the board. I want to make an array filled with 36 numbers and it should have 18 sets of numbers (so 1 and 1, 2 and 2 etc.).

So if it loops

  • a random number should be generated
  • the random number should be checked if it is already twice in the array.
  • if it is in the array. A new number should be generated and checked again.
  • If it is not twice in the array it should be placed in the array and the loop should start again until we have 18 sets in the code

Any help would be greatly appreciated! Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire