+ //Lace and sylvan blork
+ lace_init(0, 1000000);
+ lace_startup(0, NULL, NULL);
+ LACE_ME;
+ sylvan_init_package(1LL<<21, 1LL<<27, 1LL<<20, 1LL<<26);
+ sylvan_init_bdd(6);
+
+ //Encode screen
+ time_start_scr = clock();
+ state *init = encode_screen(screen);
+ time_end_scr = clock();
+
+ //Encode goal
+ time_start_goal = clock();
+ state *goal = encode_goal(screen);
+ time_end_goal = clock();
+
+ //Encode transitions
+ time_start_rel = clock();
+ rels *rls = encode_rel(screen);
+ time_end_rel = clock();
+
+ //Actually solve
+ time_start_solve = clock();
+ BDD old = sylvan_false;
+ BDD new = init->bdd;
+ //Do lurd
+ while(*lurd != '\0'){
+ switch(*lurd){
+ case 'l':
+ new = subsolve(rls->rell, new);
+ break;
+ case 'u':
+ new = subsolve(rls->relu, new);
+ break;
+ case 'r':
+ new = subsolve(rls->relr, new);
+ break;
+ case 'd':
+ new = subsolve(rls->reld, new);
+ break;
+ default:
+ printf("Unknown character in lurd: '%c'\n", *lurd);
+ exit(2);
+ }
+ lurd++;
+ }
+ int iteration = 0;
+
+ bool found = false;
+
+ while(new != old){
+ DPRINT("Iteration %d\n", iteration++);
+ old = new;
+ if(sylvan_satcount(sylvan_and(goal->bdd, new), init->vars.varset) > 0){
+ found = true;
+ break;
+ }
+
+ //Left, Up, Right, Down moves
+ new = subsolve(rls->rell, new);
+ new = subsolve(rls->relu, new);
+ new = subsolve(rls->relr, new);
+ new = subsolve(rls->reld, new);
+ }
+
+ time_end_solve = clock();
+
+ //Free and print stats
+ sokoban_free(screen);
+ REPORT("Reading: %fs\n", time_end_read, time_start_read);
+ REPORT("Screen encoding: %fs\n", time_end_scr, time_start_scr);
+ REPORT("Goal encoding: %fs\n", time_end_goal, time_start_goal);
+ REPORT("Relation encoding: %fs\n", time_end_rel, time_start_rel);
+ REPORT("Solving encoding: %fs\n", time_end_solve, time_start_solve);
+
+
+ if(!found){
+ printf("no solution\n");
+ return 1;