From 9fbc6297f917272a38b673fea4a732d73ff54bf9 Mon Sep 17 00:00:00 2001 From: wi11-holdsworth <83637728+wi11-holdsworth@users.noreply.github.com> Date: Tue, 26 Aug 2025 21:33:16 +1000 Subject: [PATCH] fix bug with unify_diagonal --- main.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.pl b/main.pl index 9d908fd..dd6a468 100644 --- a/main.pl +++ b/main.pl @@ -9,7 +9,7 @@ % puzzle_solution(Puzzle) :- Puzzle = [_|Rows], - % unify_diagonal(Puzzle), + unify_diagonal(Puzzle), maplist(valid_row, Rows), transpose(Puzzle, TransposedPuzzle), TransposedPuzzle = [_|Columns], @@ -60,7 +60,8 @@ main_diagonal([M|Ms], I, [D|Ds]) :- all_same([Head|Tail]) :- all_same(Head, Tail). +all_same(X, [X]). all_same(Head, [X|Xs]) :- - Head = X, + Head #= X, all_same(Head, Xs).