--- /dev/null
+/*
+ * Helper to test game_overlay_goal function.
+ * 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>
+#include <string.h>
+#include <errno.h>
+#include "game.h"
+
+#define X3(x) x x x
+
+static const char *progname = "overlaygoal";
+
+int main(int argc, char **argv)
+{
+ struct board board;
+ int rc;
+
+ if (argc > 0)
+ progname = argv[0];
+
+ while ((rc = scanf(X3("%" SCNxLEAST32) X3("%" SCNxLEAST16),
+ &board.game[0], &board.game[1],
+ &board.game[2], &board.goal[0],
+ &board.goal[1], &board.goal[2])) == 6)
+ {
+ uint_least32_t buf[3];
+
+ game_overlay_goal(&board, buf);
+ printf(X3(" %.7" PRIxLEAST32)"\n"+1, buf[0], buf[1], buf[2]);
+ }
+
+ if (rc == EOF) {
+ if (ferror(stdin)) {
+ fprintf(stderr, "%s: read error: %s\n", progname,
+ strerror(errno));
+ return EXIT_FAILURE;
+ }
+
+ return EXIT_SUCCESS;
+ }
+
+ fprintf(stderr, "%s: invalid input sequence\n", progname);
+ return EXIT_FAILURE;
+}