/* * Copyright (c) Camden Dixie O'Brien * SPDX-License-Identifier: AGPL-3.0-only */ #include "puzz.h" #include #include #include #include #include enum { UNKNOWN = 0xfe }; int main(void) { struct timeval tv; if (gettimeofday(&tv, NULL) != 0) { perror("Failed to get time"); exit(1); } srand(tv.tv_usec); gen(); print(); puzz_t field; memset(field, UNKNOWN, sizeof(field)); for (int y = 0; y < HEIGHT; ++y) { for (int x = 0; x < WIDTH; ++x) { char c; switch (field[x][y]) { case UNKNOWN: c = '?'; break; case MINE: c = 'x'; break; default: c = '0' + field[x][y]; break; } putchar(c); } putchar('\n'); } return 0; }