I've copied a tutorial for a minesweeper game and I really want to understand what is happening in it, I can't understand hardly any of it, like how the mines are placed and what certain functions are doing so I can learn more.
//Placing mines
void mines(int a[][8], int size) {
for (int i = 0; i<10; i++)
{
int row = rand() % size;
int col = rand() % size;
if (a[row][col] == 9)
{
i--;
}
a[row][col] = 9;
}
}
The grid appears to be a square of size size x size.
The function mines() places 10 mines at random positions. The positions are the row, col assignments. Placing mine means setting 9 in that position.