So, my minesweeper Java game is presented as int [] [], where -1 is a mine. When I initialize my game, I need to randomly place x number of mines.
What is an elegant way to do this? I was thinking of using an ArrayList with the coordinates of each cell, randomly selecting it, changing the state of int [] [], and then deleting this Point. This ensures that no points are selected twice.
Is there a more elegant way to do this?
source
share