int solve_rec(struct shape *board, const struct puzzle *p, int current_tile) { int x, y; const struct shape *current_shape; if (current_tile == p->no_tiles) { /* * Found solution */ printf("Solution:\n"); dump_board(board, 0); dump_board_svg(board); printf("\n"); return (0); } current_shape = &p->tiles[current_tile]; for (y = 0; y < board->height - current_shape->height + 1; y++) { for (x = 0; x < board->width - current_shape->width + 1; x++) { if (can_insert_tile(board, &p->tiles[current_tile], x, y)) { insert_tile(board, current_tile + 1, &p->tiles[current_tile], x, y); solve_rec(board, p, current_tile + 1); remove_tile(board, current_tile + 1); } } } return (0); }
void EditorScene::remove_last_tile(resources::TrackLayer* layer) { if (auto tiles = layer->tiles()) { if (!tiles->empty()) { remove_tile(layer, static_cast<std::uint32_t>(tiles->size()) - 1); } } }