Pick an initial point at random
This commit is contained in:
parent
c8c382d9cc
commit
9508362149
13
main.c
13
main.c
@ -11,7 +11,7 @@
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
enum { UNKNOWN = 0xfe };
|
||||
enum { UNKNOWN = 0xfe, KILLER = 0xfd };
|
||||
|
||||
int main(void)
|
||||
{
|
||||
@ -28,6 +28,14 @@ int main(void)
|
||||
puzz_t field;
|
||||
memset(field, UNKNOWN, sizeof(field));
|
||||
|
||||
const int x = rand() % WIDTH;
|
||||
const int y = rand() % HEIGHT;
|
||||
if (probe(x, y, field) == DEAD) {
|
||||
field[x][y] = KILLER;
|
||||
fprintf(stderr, "Dead\n");
|
||||
}
|
||||
|
||||
putchar('\n');
|
||||
for (int y = 0; y < HEIGHT; ++y) {
|
||||
for (int x = 0; x < WIDTH; ++x) {
|
||||
char c;
|
||||
@ -35,6 +43,9 @@ int main(void)
|
||||
case UNKNOWN:
|
||||
c = '?';
|
||||
break;
|
||||
case KILLER:
|
||||
c = '!';
|
||||
break;
|
||||
case MINE:
|
||||
c = 'x';
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user