From bf16b19b1f6deffd1983efca059db576f3b60ee5 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Mon, 13 Dec 2021 10:40:39 +0300 Subject: 2019, tracking --- 2019/day4/password.lp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 2019/day4/password.lp (limited to '2019/day4/password.lp') diff --git a/2019/day4/password.lp b/2019/day4/password.lp new file mode 100644 index 0000000..b9a1f1a --- /dev/null +++ b/2019/day4/password.lp @@ -0,0 +1,17 @@ +%353096-843212 +digit(X) :- X = 0..9. +place(N) :- N = 1..6. + +1 {pass(Q,X) : digit(X)} 1 :- place(Q). +value(N) :- N = A + B * 10 + C * 100 + D * 1000 + E * 10000 + F * 100000, pass(6,A), pass(5,B), pass(4,C), pass(3,D), pass(2,E), pass(1,F). + +:- value(N), N < 353096. +:- value(N), N > 843212. + +:- pass(Q,X), pass(Q', Y), Q' = Q + 1, X > Y. +%:- pass(Q,X), pass(Q', Y), pass(QQ, Z), Q' = Q + 1, QQ = Q' + 1, X = Y, Y = Z. % I couldn't figure out this so I did 581 - 2 + +%1 {target(X,Y,XX,YY) : dir(DX,DY), XX-X = DX*S, YY-Y = DY*S, size(S), area(XX,YY,_)} 1 :- number(X,Y,_). + +#show pass/2. +#show value/1. -- cgit v1.2.3-70-g09d2