Skip to content

Commit 787e7fb

Browse files
author
emiruz
committed
Day 04 (removed yall, massively slow)
1 parent 90ac7fd commit 787e7fb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

04.prolog

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
:- use_module(library(yall)).
1+
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).
23

34
o2c(Xs, N, A-B, Os0, Cs) :-
4-
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).
5+
include(f1(N,A,B), Os0, Os), maplist(f2(Xs,N,A,B), Os, Cs).
66

77
xmas(Cs, N, X) :-
88
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

Comments
 (0)