#include #include #include "puzzle_io.h" void puzzle_init_string(puzzle_t* puzzle, const char* text) { if (strlen(text) != N_CELLS) { crash("puzzles should be N_CELLS characters long"); } tile_t tiles[N_CELLS]; for (uint8_t cell = 0; cell < N_CELLS; cell++) { tiles[cell] = tile_new(text[cell]); } puzzle_init(puzzle, tiles); } void puzzle_display(puzzle_t* puzzle) { for (uint8_t y = 0; y < SZ; y++) { for (uint8_t x = 0; x < SZ; x++) { putchar(puzzle->solved_board[y * SZ + x].value); } putchar('\n'); } }