-
Notifications
You must be signed in to change notification settings - Fork 0
/
21 10 23.pl
179 lines (158 loc) · 3.79 KB
/
21 10 23.pl
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
% 21 10 23
% 23-1=22
% ["Medicine","MEDICINE by Lucian Green Grains, Nuts, Fruits and Vegetables 4 of 4.txt",0,algorithms,"Grains, Nuts, Fruits and Vegetables 4 of 4"]
% vegetables - iodine
qa("Do you feel tired, unable to work?","Buy potatoes for iodine.").
qa("Can't you sleep?","Remember to take your tablet.").
qa("Feeling flimsy?","Do a workout.").
qa("Do you have a headache?","Don't go in the sun without a hat.").
qa("Is it the morning?","Remember to take your morning tablet.").
qa("Is it a few weeks since your doctor's appointment?","Remember to make another appointment.").
/*
?- qa1.
Do you feel tired, unable to work?
(y/n)?
|: n
Can't you sleep?
(y/n)?
|: y
Remember to take your tablet.
Feeling flimsy?
(y/n)?
|: n
Do you have a headache?
(y/n)?
|: y
Don't go in the sun without a hat.
Is it the morning?
(y/n)?
|: n
Is it a few weeks since your doctor's appointment?
(y/n)?
|: n
true.
?- qa1.
Do you feel tired, unable to work?
(y/n)?
|: n
Can't you sleep?
(y/n)?
|: n
Feeling flimsy?
(y/n)?
|: n
Do you have a headache?
(y/n)?
|: n
Is it the morning?
(y/n)?
|: n
Is it a few weeks since your doctor's appointment?
(y/n)?
|: n
true.
*/
qa1 :-
findall(_,(qa(Q,A),writeln(Q),writeln("(y/n)?"),read_string(user_input,"\n\r","\n\r",_,S),
(S="y"->writeln(A);true)),_),!.
% ["Medicine","MEDICINE by Lucian Green Protector from Headache in Meditation Currant Bun 4 of 4.txt",0,algorithms,"Protector from Headache in Meditation Currant Bun 4 of 4"]
/*
?- headache_prevention
| .
Do you get headaches? (y/n)?
|: y
Do you meditate? (y/n)?
|: n
I recommend meditation
Do you use anti-headache meditation? (y/n)?
|: n
I recommend Lucian Green's Headache Prevention App.
true.
?- headache_prevention.
Do you get headaches? (y/n)?
|: n
true.
*/
headache_prevention :-
writeln("Do you get headaches? (y/n)?"),
read_string(user_input,"\n\r","\n\r",_,S1),
(S1="y"->
(writeln("Do you meditate? (y/n)?"),
read_string(user_input,"\n\r","\n\r",_,S2),
(S2="n"->
writeln("I recommend meditation");true),
writeln("Do you use anti-headache meditation? (y/n)?"),
read_string(user_input,"\n\r","\n\r",_,S3),
(S3="n"->
writeln("I recommend Lucian Green's Headache Prevention App.");true)
);true),!.
% ["Short Arguments","No Radiation 4 of 25 (final).txt",0,algorithms,"3. I prepared to cover travelling in the time machine with meditation. I did this by stating that the body returns to normal after time travelling like a beating flagella with meditation. First, I meditated. Second, I time travelled. Third, I meditated again."]
qa_tt("Have you meditated before time travel?","You may now time travel.").
qa_tt("Have you time travelled?","You may now meditate.").
qa_tt("Have you meditated?","Good").
/*
?- qa_tt1.
Have you meditated before time travel?
(y/n)?
|: y
You may now time travel.
Have you time travelled?
(y/n)?
|: y
You may now meditate.
Have you meditated?
(y/n)?
|: y
Good
true.
?- qa_tt1.
Have you meditated before time travel?
(y/n)?
|: n
% Execution Aborted
*/
qa_tt1 :-
findall(_,(qa_tt(Q,A),writeln(Q),writeln("(y/n)?"),read_string(user_input,"\n\r","\n\r",_,S),
(S="y"->writeln(A);abort)),_),!.
:-include('../listprologinterpreter/listprolog.pl').
/*
?- qa_tt2(2).
*** Journey 1 ***
Have you meditated before time travel?
(y/n)?
|: y
You may now time travel.
Have you time travelled?
(y/n)?
|: y
You may now meditate.
Have you meditated?
(y/n)?
|: y
Good
*** Journey 2 ***
Have you meditated before time travel?
(y/n)?
|: y
You may now time travel.
Have you time travelled?
(y/n)?
|: y
You may now meditate.
Have you meditated?
(y/n)?
|: y
Good
true.
?- qa_tt2(2).
*** Journey 1 ***
Have you meditated before time travel?
(y/n)?
|: n
% Execution Aborted
*/
qa_tt2(Journeys) :-
numbers(Journeys,1,[],JN),
%length(JL,Journeys),
findall(_,(member(JN1,JN),write("*** Journey "),write(JN1),writeln(" ***"),qa_tt1),_),!.
% 22-22=0