#include // bool #include // atoi() #include // EXIT_{FAILURE,SUCCESS} #include #include "../core/sok.h" #include "../text/util.h" #include "../text/levels.h" static void solve_on_error( const char * const err ) { die("Error solving level: %s", err); } int main(int argc, char *argv[]) { // init context sok_ctx_t ctx; sok_ctx_init(&ctx, NULL); // walk levels for (int i = 1; i < argc; i++) { const size_t level_num = atoi(argv[i]); // get level const level_t *level = levels_get_level(level_num); // load level if (!sok_ctx_set_level(&ctx, level->data)) { die("Couldn't load level %d", (int) level_num); } // solve level if (!sok_solve(&ctx, solve_on_error)) { die("Couldn't solve level"); } } // return success return EXIT_SUCCESS; }