vendredi 14 novembre 2014

minesweeper revealing cells in c


Vote count:

0




I am trying to write a minesweeper program in c

What I am trying to achieve here is when user step on one cell, the cells near without bombs and hint numbers will be revealed.

for example:(x is the cell stepped on,and *is the bomb(hidden when playing of course)

x o o o o o o o * o o o o o o


will result in

1 o o 1 * o 1 o o

here is part of the code:



while (1)
{
printf("Row? ");
scanf("%d", &row);
printf("column? ");
scanf("%d", &clos);
if (row < 9 && row >= 0 && clos < 8 && clos >= 0)
break;
printf("\nInvalid Location\n\n");
}
if (real_map[row][clos] =='*')
{
print_map_win(display_map,real_map);
printf("\n");
printf("Flags Left = %d\n\n\n", flag_left);
printf("Game Over\n");
exit(0);
}
else
{
if (real_map[row][clos] == ' ')
{
display_map[row][clos] = real_map[row][clos];
bonos_reveal(display_map, real_map, clos, row);
// [[[which is the function i am asking for]]]
printf("\n");
}
else
{
display_map[row][clos] = real_map[row][clos];
}
}


which real_map has the hint number and bombs in it, and display map is the current state of the map.



asked 57 secs ago







minesweeper revealing cells in c

Aucun commentaire:

Enregistrer un commentaire