File size: 1,052 Bytes
557a17a |
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 |
%% combophil.pl
%% Finds combinations of lines of philosophy
%% *** Deprecated by Repository Lucian-Academy/combophil_alg_log.pl
:-include('../listprologinterpreter/la_strings').
string(String) --> list(String).
list([]) --> [].
list([L|Ls]) --> [L], list(Ls).
%% e.g. combophil(2). to write on a combination of philosophies
combophil(NumberOfPhils) :-
phrase_from_file_s(string(Phil1), "../Text-to-Breasonings/file.txt"),
SepandPad="\n\r",
split_string(Phil1,SepandPad,SepandPad,Phil2),
delete(Phil2,"",Phil3),
sort(Phil3,Phil4),
length(Phil4,LengthPhil4),write("Number of philosophies in file.txt: "),
writeln(LengthPhil4),
length(PhilsLengthList,NumberOfPhils),
repeat,
findall(Phils1,(member(_,PhilsLengthList),random_member(Phils1,Phil4)),Phils2),
reverse(Phils2,Phils3),Phils3=[Phil6|Phils4],reverse(Phils4,Phils5),
findall(_,(member(Phil5,Phils5),writeln1(Phil5),nl,writeln1("because"),nl),_),
writeln1(Phil6),nl,
write("1-Continue or 2-End: "),
read_string(user_input, "\n", "\r", _End, Input),
(Input="2"->abort;fail).
|