2 * Call board_reset and print the resulting board.
3 * Copyright © 2023 Nick Bowler
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
24 * This will stub out the high precision timer, which means this will not
25 * contribute to the initial seed (good for the tests we want to do).
27 #include "game-notime.h"
29 static int output_tile(unsigned tile, unsigned (*counts)[TILE_MAX], int goal)
31 static const char chars[TILE_MAX] = ".ROYGBW";
32 unsigned wtf = tile ? 4 : !goal;
34 if (tile >= TILE_MAX) {
35 fprintf(stderr, "invalid tile value (%u)\n", tile);
39 if (++counts[!goal][tile] > (tile ? 4 : !goal)) {
40 printf("WTF %u\n", wtf);
41 fprintf(stderr, "%s has too many (%u) %c tiles\n",
42 goal ? "goal" : "game", counts[!goal][tile], chars[tile]);
52 unsigned counts[2][TILE_MAX] = {0};
58 for (i = 0; i < 25; i++) {
61 tile = board_tile(board.game, i);
62 if (output_tile(tile, counts, 0) < 0)
71 for (j = 0; j < 3; j++) {
72 tile = board_tile(board.goal, i-4 + j);
73 if (output_tile(tile, counts, 1) < 0)