Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 6.6.6) Copyright (c) 1990-2013 University of Amsterdam, VU Amsterdam SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. Please visit http://www.swi-prolog.org for details. For help, use ?- help(Topic). or ?- apropos(Word). true. true. Echo turned on; prompt turned off Command: pipes x, length: 1000, diameter: 10 Command: cut(x,10,p1) 10 cut from x to form p1 Command: cut(x,20,p2) 20 cut from x to form p2 Command: cut(x,30,a3) 30 cut from x to form a3 Command: cut(x,40,p4) 40 cut from x to form p4 Command: cut(x,50,p5) 50 cut from x to form p5 Command: cut(x,60,a6) 60 cut from x to form a6 Command: cut(x,70,p7) 70 cut from x to form p7 Command: cut(x,80,p8) 80 cut from x to form p8 Command: cut(x,90,a9) 90 cut from x to form a9 Command: pipes a3, length: 30, diameter: 10 a6, length: 60, diameter: 10 a9, length: 90, diameter: 10 p1, length: 10, diameter: 10 p2, length: 20, diameter: 10 p4, length: 40, diameter: 10 p5, length: 50, diameter: 10 p7, length: 70, diameter: 10 p8, length: 80, diameter: 10 x, length: 550, diameter: 10 Command: trim(p1,1) 1 trimmed from p1 Command: trim(p2,1) 1 trimmed from p2 Command: trim(p4,1) 1 trimmed from p4 Command: trim(p5,1) 1 trimmed from p5 Command: trim(p7,1) 1 trimmed from p7 Command: pipes a3, length: 30, diameter: 10 a6, length: 60, diameter: 10 a9, length: 90, diameter: 10 p1, length: 9, diameter: 10 p2, length: 19, diameter: 10 p4, length: 39, diameter: 10 p5, length: 49, diameter: 10 p7, length: 69, diameter: 10 p8, length: 80, diameter: 10 x, length: 550, diameter: 10 Command: cut(x,500,new) 500 cut from x to form new Command: weld(new,a9) a9 welded onto new Command: weld(new,p8) p8 welded onto new Command: weld(new,p7) p7 welded onto new Command: pipes a3, length: 30, diameter: 10 a6, length: 60, diameter: 10 new, length: 739, diameter: 10 p1, length: 9, diameter: 10 p2, length: 19, diameter: 10 p4, length: 39, diameter: 10 p5, length: 49, diameter: 10 x, length: 50, diameter: 10 Command: weld(new,a6) a6 welded onto new Command: weld(new,p5) p5 welded onto new Command: cut(x,1,new1) 1 cut from x to form new1 Command: weld(new1,p4) p4 welded onto new1 Command: weld(new1,a3) a3 welded onto new1 Command: weld(new1,p2) p2 welded onto new1 Command: pipes new, length: 848, diameter: 10 new1, length: 89, diameter: 10 p1, length: 9, diameter: 10 x, length: 49, diameter: 10 Command: weld(x,new) new welded onto x Command: weld(x,new1) new1 welded onto x Command: weld(p1,x) x welded onto p1 Command: pipes p1, length: 995, diameter: 10 Command: q true. % halt