Create an ASP model that produces all possible passwords given the following password constraints. How many password exist?
Please do not comment the answer but simply tell me where my clingo solution is mistaken in the procedure.
NV = 1.. N. %numerical values
sc = #;*;$;!; %special characters
c = 1..c. %characters
pcn = 1..cn. %password character numbers
2.) Passwords must have a minimum of 4 characters and a maximum of 6 characters with a mix of numeric and special characters.
:-Pass(P #count (cn : in(p,cn)) < 4.
:-Pass(P #count (cn : in(p,cn)) > 6.
3.) Passwords must have at least one numeric character.
1{in(p,sc) : sc(sc))1 :- Pass(p).
4.) Passwords must have at least one special character.
1{in(p,NV) : NV(N))1 :- Pass(p).
5.) Passwords cannot have consecutive repeating characters [invalid password example: 9988*] [valid password example: 9897#]
:-in(a,b,p1), in(c,d,P2), consecutive(a,b,c,d), pass(p1), pass(p2), pass(p3), pass(p4), pass(p5), pass(p6), G1==G2,, G3==G4, G5==G6.
#show/6.
edit add on I also thought another way of looking at the problem could be
char= 1..13.
consecutive(1,1,2,2).consecutive(3,3,4,4).consecutive(5,5,6,6).consecutive(7,7,8,8).consecutive(9,9,10,10).consecutive(11,11,12,12).
:-Pass(P #count (cn : in(p,cn)) < 4.
:-Pass(P #count (cn : in(p,cn)) > 6.
%3.) Passwords must have at least one numeric character under and over 9, over 9 being a special character.
1{in(p,char) : Char(c))1 > 9 :- Pass(p).
1{in(p,char) : Char(c))1 < 9 :- Pass(p).
5.) Passwords cannot have consecutive repeating characters [invalid password example: 9988*] [valid password example: 9897#]
:-in(X,p1), in(Y,P2), consecutive(X1,X2,Y1,Y2), pass(p1), pass(p2), pass(p3), pass(p4), pass(p5), pass(p6), P1==P2,, P3==P4, P5==P6.