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