Medicine.pl

medicine.pl
%% Medicine.pl
%% Helps prevent people's and animals' headaches, muscle aches and pains and body problems (and aims at medicine and anti-headache apps)
/** Run by entering:
[medicine].medicine.
**/
:- include('qb2.pl').
medicine :- File="I love you, I love you, I love you.  Love.", currentDate(Today), Today=date(Year,Month,Day), doctors(Doctors), protect(File,Year,Month,Day,Doctors,[],Old), writeln([olddoctors,Old]).protect(_File,_Year,_Month,_Day,[],Old1,Old1) :- !.protect(File,Year1,_Month1,_Day1,[Doctor|Doctors],Old1,Old2) :- Doctor=[_FirstName,_LastName,_DayDOB,_MonthDOB,_YearDOB,_DayLearned,_MonthLearned,YearLearned], Year2 is YearLearned+101, (Year2=Year1->append(Old1,[Doctor],Old3);Old3=Old1), texttobr2(File),texttobr(File), %% Student doctor texttobr2(File),texttobr(File), %% Lecturer protect(File,Year1,_Month,_Day,Doctors,Old3,Old2).currentDate(Today) :-  get_time(Stamp),  stamp_date_time(Stamp,DateTime,local),  date_time_value(date,DateTime,Today).doctors([%%[firstname1,lastname1,birthday1,birthmonth1,birthyear1,taughtday1,taughthmonth1,taughtyear1],%% Enter a comma after each entry except the last one.[firstname2,lastname2,1,1,2000,1,1,2018],[firstname2,lastname2,1,1,2000,1,1,2018]]).
qb2.pl
%% Quantum Box - Automates the Patient's Daily Self Treatment
%% The non-computational app version is at:%% http://lucianspedagogy.blogspot.com/p/lucian-academy-apps.html
%% WARNING: May cause health problems if not practised properly.  Read this comment before using.
%% Important: See instructions for using texttobr.pl at https://lucianpedia.wikia.com/wiki/Instructions_for_Using_texttobr(2).pl .
%% texttobr2 - converts file stream to dimensions of objects represented by the words%% replace ⁃,–,— in file.txt with - or crashes%% replace “,” in file.txt with " or crashes%% replace ‘,’ in file.txt with ' or crashes%% replace MS Word return in file.txt with return or crashes%% replace nonbreaking space " " in file.txt with normal space " " or crashes%% Copy and paste text into VI, not TextEdit, etc to avoid inserting incorrect return characters%% has object name as separate field for new users of texttobr to verify breasonings by hand%% brdict1.txt word and object name, brdict2.txt object name and x, y and z
texttobr2qb :- file2qb(File), texttobr2(File),!.texttobr2qbpl :- file2qbpl(File), texttobr2(File),!.texttobr2(File) :- SepandPad="&#@~%`$?-+*^,()|.:;=_/[]<>{}\n\s\t\\\"!'0123456789", BrDict01=[[i,person],[love,heart],[you,person]],%%writeln([brDict01,BrDict01]), char_code(Escape,27), delete(BrDict01,[Escape,_,_,_,_],BrDict021),%%writeln([brDict021,BrDict021]), char_code(Apostrophe,8217), delete(BrDict021,[Apostrophe,_,_,_,_],BrDict02),%%writeln([brDict02,BrDict02]), sort(BrDict02,BrDict03),%%writeln([brDict03,BrDict03]), %%   /**phrase_from_file(string(BrDict0t), 'brdict2.txt'),  %%Chars="’", %%split_string(BrDict0,SepandPad,SepandPad,BrDict01),%%writeln([brDict0,BrDict0]), splitfurthert(BrDict0t,BrDict01t),**/ BrDict01t=[[person,50,30,180],[heart,1,1,0]],%%writeln([brDict01,BrDict01]), delete(BrDict01t,[Escape,_,_,_,_],BrDict021t),%%writeln([brDict021,BrDict021]), delete(BrDict021t,[Apostrophe,_,_,_,_],BrDict02t),%%writeln([brDict02,BrDict02]), sort(BrDict02t,BrDict03t),%%writeln([brDict03,BrDict03]),  %%phrase_from_file(string(String), 'file2qb.txt'), String=File,%%atom_codes(Atom999,String),writeln([atom999,Atom999]), split_string(String,SepandPad,SepandPad,List),%%writeln([list,List]), delete(List,Escape,List11),%%writeln([list11,List11]), delete(List11,Apostrophe,List1),
 br(List1,BrDict03,_BrDict2,BrDict03t,_BrDict03t2).
br([],B,B,C,C) :- !.br([Word|Words],BrDict,BrDict2,BrDict4,BrDict5) :- downcase_atom(Word, Word3), %%atom_string(Word2,Word3),          (member([Word3,String4],BrDict)->  (%%write([Word3,String4]),writeln(","), BrDict3=BrDict); ((repeat, write("Enter object name (without spaces), if different for "), writeln(Word3),read(String2),split_string(String2, "", " ", String3),String3=[String4]), append(BrDict,Word3,String4,BrDict3))), brth(Word3,_Brth1),
(String4=""->String5=Word3;String5=String4),
 downcase_atom(String5, String53), %%atom_string(String52,String53),
 (member([String53,_X2,_Y2,_Z2],BrDict4)-> (%%write([String53,X,Y,Z]),writeln(","), BrDict3t=BrDict4); ((repeat, write("Enter x, y and z in cm for "), writeln(String53),read(String),split_string(String, ",", " ", Values),Values=[X1,Y1,Z1],number_string(_X1,X1),number_string(_Y1,Y1),number_string(_Z1,Z1)), append(BrDict4,String53,_X,_Y,_Z,BrDict3t))), brth(String53,_Brth), %%write("br(\'"),write(Word3),writeln("\',)."),%%    writeln([Word3,X,Y,Z]), %%write(' '), br(Words,BrDict3,BrDict2,BrDict3t,BrDict5). %%).brth(_,sweet).
%% finds unknown words, asks for their br in form "n of m: word", verify, (can go back x) append and sort, save
%% texttobr - converts file stream to list of 3D dimensions of each character
texttobrqb :- file2qb(File), texttobr(File),!.texttobrqbpl :- file2qbpl(File), texttobr(File),!.
texttobr(File) :- %%phrase_from_file(string(String), File), string_codes(File,String), br(String),!.
br([]) :- !.br([Code|Codes]) :- char_code(Character,Code), br(Character,_X,_Y,_Z), brth(Character,_Brth), %%write([Character,X,Y,Z]), %%write(' '), br(Codes).br('A',1,1.5,0).br('B',1,1.5,0).br('C',1,1.5,0).br('D',1,1.5,0).br('E',1,1.5,0).br('F',1,1.5,0).br('G',1,1.5,0).br('H',1,1.5,0).br('I',1,1.5,0).br('J',1,1.5,0).br('K',1,1.5,0).br('L',1,1.5,0).br('M',1,1.5,0).br('N',1,1.5,0).br('O',1,1.5,0).br('P',1,1.5,0).br('Q',1,1.5,0).br('R',1,1.5,0).br('S',1,1.5,0).br('T',1,1.5,0).br('U',1,1.5,0).br('V',1,1.5,0).br('W',1,1.5,0).br('X',1,1.5,0).br('Y',1,1.5,0).br('Z',1,1.5,0).br('a',1,1,0).br('b',1,1.5,0).br('c',1,1,0).br('d',1,1.5,0).br('e',1,1,0).br('f',1,2.5,0).br('g',1,2,0).br('h',1,1.5,0).br('i',1,1.5,0).br('j',1,2.5,0).br('k',1,1.5,0).br('l',1,1.5,0).br('m',1,1,0).br('n',1,1,0).br('o',1,1,0).br('p',1,2,0).br('q',1,2,0).br('r',1,1,0).br('s',1,1,0).br('t',1,1.5,0).br('u',1,1,0).br('v',1,1,0).br('w',1,1,0).br('x',1,1,0).br('y',1,2,0).br('z',1,1,0).
br('?',1,1.5,0).br('-',1,1,0).br(' ',1,1,0).br(',',1,1,0).br('(',1,1.5,0).br(')',1,1.5,0).br('|',1,2.5,0).br('.',1,1,0).br(':',1,1,0).br('_',1,1,0).br('\,1,1.5,0).br('[',1,1.5,0).br(']',1,1.5,0).br('<',1,1,0).br('>',1,1,0).
br('0',1,1.5,0).br('1',1,1.5,0).br('2',1,1.5,0).br('3',1,1.5,0).br('4',1,1.5,0).br('5',1,1.5,0).br('6',1,1.5,0).br('7',1,1.5,0).br('8',1,1.5,0).br('9',1,1.5,0).
br('{',1,1.5,0).br('}',1,1.5,0).br('\n',1,1,0).br(_,1,1,0).