Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- implement main
- open core, console
- class predicates
- number : (integer, integer, integer, integer).
- clauses
- number(A, B, C, D) :-
- if D = 4 and not(A = B) and not(A = C) and not(C = B) then
- write(A, B, C),
- nl
- end if,
- if D = 3 then
- number(1, B, C, 4),
- number(2, B, C, 4),
- number(3, B, C, 4),
- number(4, B, C, 4),
- number(5, B, C, 4),
- number(6, B, C, 4),
- number(7, B, C, 4),
- number(8, B, C, 4),
- number(9, B, C, 4)
- end if,
- if D = 2 then
- number(A, 0, C, 3),
- number(A, 1, C, 3),
- number(A, 2, C, 3),
- number(A, 3, C, 3),
- number(A, 4, C, 3),
- number(A, 5, C, 3),
- number(A, 6, C, 3),
- number(A, 7, C, 3),
- number(A, 8, C, 3),
- number(A, 9, C, 3)
- end if,
- if D = 1 then
- number(A, B, 0, 2),
- number(A, B, 1, 2),
- number(A, B, 2, 2),
- number(A, B, 3, 2),
- number(A, B, 4, 2),
- number(A, B, 5, 2),
- number(A, B, 6, 2),
- number(A, B, 7, 2),
- number(A, B, 8, 2),
- number(A, B, 9, 2)
- end if.
- run() :-
- number(1, 1, 1, 1).
- end implement main
- goal
- mainExe::run(main::run).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement