Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

pl:prolog:pllib:interface_2 [2019/06/27 15:50] (aktualna)
Linia 1: Linia 1:
 +====== Interface 2 ======
 +{{tag>​interactive}}
 +===== Description =====
 +Program ask user and show possible answer
 +
 +**Source**: ​ Building Expert Systems in PROLOG Publisher
 +===== Download =====
 +Program source code: {{interface_2.pl}}
 +===== Listing =====
 +<code prolog>
 +size(X):- menuask(size,​ X, [large, plump, medium, small]).
 +flight(X):- menuask(flight,​ X, [ponderous, agile, flap_glide]).
 +
 +menuask(A, V, MenuList) :-
 +write('​What is the value for'), write(A), write('?'​),​ nl,
 +write(MenuList),​ nl,
 +read(X),
 +check_val(X,​ A, V, MenuList),
 +asserta( known(yes, A, X) ),
 +X == V.
 +
 +check_val(X,​ A, V, MenuList) :-
 +member(X, MenuList), !.
 +
 +check_val(X,​ A, V, MenuList) :-
 +write(X), write('​ is not a legal value, try again.'​),​ nl,
 +menuask(A, V, MenuList).
 +</​code>​
 +===== Comments =====
  
pl/prolog/pllib/interface_2.txt · ostatnio zmienione: 2019/06/27 15:50 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0