We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 90ac7fd commit 787e7fbCopy full SHA for 787e7fb
04.prolog
@@ -1,8 +1,8 @@
1
-:- use_module(library(yall)).
+f1(N,A,B,X-Y) :- A+X>=0,A+X<N,Y+B>=0,Y+B<N.
2
+f2(Xs,N,A,B,X-Y,C) :- I is (A+X)+(Y+B)*N, nth0(I,Xs,C).
3
4
o2c(Xs, N, A-B, Os0, Cs) :-
- include({N,A,B}/[X-Y]>>(A+X>=0,A+X<N,Y+B>=0,Y+B<N), Os0, Os),
5
- maplist({Xs,N,A,B}/[X-Y,C]>>(I is (A+X)+(Y+B)*N, nth0(I,Xs,C)), Os, Cs).
+ include(f1(N,A,B), Os0, Os), maplist(f2(Xs,N,A,B), Os, Cs).
6
7
xmas(Cs, N, X) :-
8
member(Os, [[1-0,2-0,3-0], [-1-0,-2-0,-3-0], [1-(-1),2-(-2),3-(-3)], [0-(-1),0-(-2),0-(-3)],
0 commit comments