1

i'm new to prolog and I want to solve the puzzle Akkoy with restrictions. So far, i've been able to implement wich cells can be painted but i don't know how to force the white areas to have all the same area.

For now when solving the problem, prolog gives two answers, but I want only the first one.

Right Answer Wrong Answer

akkoy_solver(Rows, Cols) :-
    length(Rows, X),
    length(Cols, Y),
    make_grid(Grid, X, Y, Vars),
    reset_timer,
    solver(Rows, Cols, Grid),
    label(Vars),
    printAkkoy(Grid, Rows, Cols),
    print_time,
    statistics, nl.
  • maybe you can add a cut: `label(Vars), !,` – CapelliC Dec 13 '15 at 20:15
  • I don't see much difference in the right and wrong answer except for the execution time? If you want to know why 2 solutions are evaluating to true you should check where prolog continues after you've printed your solution. A quick fix indeed is to use a cut as @CapelliC mentions. I think we can't help you if you don't give us the rest of your code. – Sam Segers Dec 16 '15 at 20:33

0 Answers0