Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [kattio].
- main :-
- read_int(X),
- (myfunc(X, 0) -> write(sucess) ; write(impossible), halt(0)).
- myfunc(0, _) :- !.
- myfunc(Count, _):- Count < 0, !, fail.
- myfunc(_, N):- N > 2, !, fail.
- myfunc(Count, N):- between(1, 20, Dart),
- Nu is N + 1,
- NewCount is (Count - 3*Dart),
- myfunc( NewCount, Nu),
- write(triple ), write(Dart), nl.
- myfunc(Count, N) :- between(1, 20, Dart),
- NewCount is (Count - 2*Dart),
- Nu is N + 1,
- myfunc( NewCount, Nu),
- write(tripel ), write(Dart), nl.
- myfunc(Count, N) :- between(1, 20, Dart),
- Nu is N + 1,
- NewCount is (Count - Dart),
- myfunc( NewCount, Nu),
- write(single ), write(Dart), nl.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement