1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
| :- use_module(library('http/thread_httpd')).
:- use_module(library('http/html_write')).
:- use_module(library('http/http_session')).
:- use_module(library('http/http_error')).
:- session_predicate yes/1.
:- session_predicate no/1.
check(check_landing_gear_control, Rep) :-
check_landing_gear_control(Rep) ,!.
check(voltage_is_not_recorded2, Rep):-
voltage_is_not_recorded2(Rep) ,!.
check(voltage_is_not_recorded1, Rep):-
voltage_is_not_recorded1(Rep) ,!.
check(unknown, nil ).
check_landing_gear_control(Rep) :-
verifier(check_voltage_extend, R1),
(R1 = nil -> verifier(check_voltage_bypass, Rep) ; Rep = R1).
voltage_is_not_recorded2(Rep) :-
verifier(check_voltage_extend, R1),
(R1 = nil -> not(verifier(check_voltage_bypass, Rep)) ; Rep = R1).
voltage_is_not_recorded1(Rep) :-
not(verifier(check_voltage_extend,Rep)).
update(Get) :-
member(fact=Fact, Get),
member(answer=yes, Get),
assert(yes(Fact)).
update(Get) :-
member(fact=Fact, Get),
member(answer=no, Get),
assert(no(Fact)).
update(_).
remettre_a_zero :-
retractall(yes(_)),
retractall(no(_)).
verifier(S, R) :-
(yes(S) -> true, R = nil ;
(no(S) -> fail ;
R = S)).
% ask(S))).
modifie_text(Atom, Atom1) :-
atomic_list_concat(List, '_', Atom),
atomic_list_concat(List, ' ', Atom1).
/*<html>
<title>Sheldon_f sample</title>
<head></head>
<body>
<?,
update(Get),
?>
Faits vrais :
<ul>
<?,
forall(yes(Fact), (modifie_text(Fact, Fact1), ?> <li> <?= Fact1?> <?))
,?>
</ul>
Faits faux :
<ul>
<?,
forall(no(Fact), (modifie_text(Fact, Fact1),?> <li> <?= Fact?> <?))
,?>
</ul>
<?,check(Diag, Fact),
(Fact \= nil -> modifie_text(Fact, Fact1), ?>
<pre>
<form id="form1" name="form1" method="GET" action="sheldon_f.prolog">
<label>
<?=Fact1?>
</label>
<input type="hidden" name = fact value = <?=Fact?> />
<input type="submit" name = "answer" value="yes" />
<input type="submit" name = "answer" value="no" />
</form>
</pre>
<? ;
remettre_a_zero,
modifie_text(Diag, Diag1),
?>
<H2>Solution : <?= Diag1 ?> <br>
<form id="form2" name="form2" method="GET" action="sheldon_f.prolog">
<input type="submit" value="autre recherche">
</form>
<?), ?>
</body>
</html>*/ |
Partager