Hi, I want to randomly spawn mines for a minesweeper game I am making. I think I have to use a 'For' loop, an 'Array', and a 'For Each', but I am not sure. I think I have to pick a random X and Y coordinate, make sure it doesn't already contain a mine, if not put a mine in it; would a 'For Each' be good for this?
I know that an array originally contains a 0 in each cell, and if I change the value to 1 for example, then I can consider that 1 means there is a mine.
In order to check if the cell at the coordinates I picked is equal to 0 or 1, should I use a 'For Each' and how do I implement it within the 'For' loop so that if it is 0, I can modify to 1 and go to the next "For" loop iteration. Otherwise, I will want to pick new random coordinates and do that check again right?
P.S. I am using a TileMap