/** Chat Bot Seen-as Version It is written initially for algorithms to assess the chat bot's student, to ensure their rigorousness. These algorithms convert algorithms into algorithms, which are the B, seen-as version and medicine version of the original algorithm. - Seen-as version - Food names replace data - helps verify the algorithm. - B - (Can randomly) uncorrect algorithm, ready for correction. The B will help check whether the user has optimised the line. - Medicine - converts list processing into mathematics, testing the psychology of the algorithm. %%writeln([eg6]), (( interpret(Debug,[count,[0,n]], [ [count,[1,2]], [count,[n,p],(:-), [ [m,is,n+1], [count,[m,p]] ] ] ] ,[[n, 2]]),S29 is S28 +1)->true;S29 is S28), N29 is N28+1, %%writeln([eg7]), (( interpret(Debug,[reverse,[[1,2,3],[],l]], [ [reverse,[[],l,l]], [reverse,[l,m,n],(:-), [ [head,l,h], [tail,l,t], [append,h,m,o], [reverse,[t,o,n]] ] ] ],[[l, [3, 2, 1]]]),S30 is S29 +1)->true;S30 is S29). B change one variable name to a mistake and work out what the line's outputs are Seen as Version zucchini, eggplant, potato, tofu 1->1 head tail eat it 1->2 2->1 + append put together do non body, call lines later lp2csav1([[m,is,carrot+1],[head,zucchini,h],[tail,potato,t],[append,eggplant,tofu,o]],[],Lines),writeln(Lines). [[puttogether,carrot,and,roux,giving,[carrot,and,roux]],[cook,zucchini,giving,[cooked,zucchini]],[cook,potato,giving,[cooked,potato]],[puttogether,eggplant,and,tofu,giving,[eggplant,and,tofu]]] should write an interpreter 0 cooking until end (make cooking cut) **/ lp2csav1([],Lines,Lines) :- !. lp2csav1(Lines1,Lines2,Lines3) :- Lines1=[Line1|Lines4], lp2csav2(Line1,Line2), append(Lines2,[Line2],Lines5), lp2csav1(Lines4,Lines5,Lines3). lp2csav2([_A,is,[[B,and,roux]+1]],[puttogether,B,and,roux,giving,[B,and,roux]]). lp2csav2([_A,is,B+1],[puttogether,B,and,roux,giving,[B,and,roux]]). lp2csav2([append,A,B,_C],[puttogether,A,and,B,giving,[A,and,B]]). lp2csav2([head,B,_C],[cook,B,giving,[cooked,B]]). lp2csav2([tail,B,_C],[cook,B,giving,[cooked,B]]). %% lp2cb1([[m,is,n+1],[head,l,h],[tail,l,t],[append,a,b,o]],[],Lines),writeln(Lines). %% [[m,is,n-1],[tail,l,h],[head,l,t],[append,b,a,o]] lp2cb1([],Lines,Lines) :- !. lp2cb1(Lines1,Lines2,Lines3) :- Lines1=[Line1|Lines4], lp2cb2(Line1,Line2), append(Lines2,[Line2],Lines5), lp2cb1(Lines4,Lines5,Lines3). lp2cb2([A,is,B+1],[A,is,B-1]). lp2cb2([append,A,B,C],[append,B,A,C]). lp2cb2([head,B,C],[tail,B,C]). lp2cb2([tail,B,C],[head,B,C]). /** lp2cmedsav1([[m,is,1+1],[head,1,h],[tail,1,t],[append,1,1,o]],[],Lines),writeln(Lines). [[m,is,1+1],[h,is,1+1],[t,is,1+2],[o,is,1+1]] **/ lp2cmedsav1([],Lines,Lines) :- !. lp2cmedsav1(Lines1,Lines2,Lines3) :- Lines1=[Line1|Lines4], lp2cmedsav2(Line1,Line2), append(Lines2,[Line2],Lines5), lp2cmedsav1(Lines4,Lines5,Lines3). lp2cmedsav2([A,is,B+1],[A,is,B+1]). lp2cmedsav2([append,A,B,C],[C,is,A+B]). lp2cmedsav2([head,B,C],[C,is,B+1]). lp2cmedsav2([tail,B,C],[C,is,B+2]).