You are on page 1of 2

perez@perez:~ > cd Escritorio

perez@perez:~/Escritorio > prolog


Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 7.2.3)
Copyright (c) 1990-2015 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).
?- consult("mcd.pl").
true.
?- mcd2(12,16).
1
2
4
false.
?- trace.
true.
[trace]
Call:
Call:
Call:
Exit:
Call:
Exit:
Call:
Exit:
Call:
Exit:
Call:
1
Exit:
Call:

?- mcd2(12,16).
(7) mcd2(12, 16) ? creep
(8) este1(12, 16, 0) ? creep
(9) 0<12 ? creep
(9) 0<12 ? creep
(9) _G1294 is 0+1 ? creep
(9) 1 is 0+1 ? creep
(9) 0 is 12 mod 1 ? creep
(9) 0 is 12 mod 1 ? creep
(9) 0 is 16 mod 1 ? creep
(9) 0 is 16 mod 1 ? creep
(9) write(1) ? creep

Exit:
Call:
Call:
Exit:
Call:
Exit:
Call:
Exit:
Call:
Exit:
Call:

(9) nl ? creep
(9) este1(12, 16, 1) ? creep
(10) 1<12 ? creep
(10) 1<12 ? creep
(10) _G1303 is 1+1 ? creep
(10) 2 is 1+1 ? creep
(10) 0 is 12 mod 2 ? creep
(10) 0 is 12 mod 2 ? creep
(10) 0 is 16 mod 2 ? creep
(10) 0 is 16 mod 2 ? creep
(10) write(2) ? creep

(9) write(1) ? creep


(9) nl ? creep

2
Exit: (10) write(2) ? creep
Call: (10) nl ? creep
Exit:
Call:
Call:
Exit:
Call:
Exit:
Call:

(10)
(10)
(11)
(11)
(11)
(11)
(11)

nl ? creep
este1(12, 16, 2) ? creep
2<12 ? creep
2<12 ? creep
_G1312 is 2+1 ? creep
3 is 2+1 ? creep
0 is 12 mod 3 ? creep

Exit:
Call:
Fail:
Redo:
Call:
Exit:
Call:
Exit:
Call:
Call:
Exit:
Call:
Exit:
Call:
Exit:
Call:
Exit:
Call:

(11)
(11)
(11)
(10)
(11)
(11)
(11)
(11)
(11)
(12)
(12)
(12)
(12)
(12)
(12)
(12)
(12)
(12)

0 is 12 mod 3 ? creep
0 is 16 mod 3 ? creep
0 is 16 mod 3 ? creep
este1(12, 16, 2) ? creep
2<12 ? creep
2<12 ? creep
_G1312 is 2+1 ? creep
3 is 2+1 ? creep
este1(12, 16, 3) ? creep
3<12 ? creep
3<12 ? creep
_G1315 is 3+1 ? creep
4 is 3+1 ? creep
0 is 12 mod 4 ? creep
0 is 12 mod 4 ? creep
0 is 16 mod 4 ? creep
0 is 16 mod 4 ? creep
write(4) ? creep

4
Exit: (12) write(4) ? creep
Call: (12) nl ? creep
Exit:
Call:
Call:
Exit:
Call:
Exit:
Call:
Fail:
Redo:
Call:
Exit:
Call:
Exit:
Call:
Call:
Exit:
Call:

(12)
(12)
(13)
(13)
(13)
(13)
(13)
(13)
(12)
(13)
(13)
(13)
(13)
(13)
(14)
(14)
(14)

nl ? creep
este1(12, 16, 4) ? creep
4<12 ? creep
4<12 ? creep
_G1324 is 4+1 ? creep
5 is 4+1 ? creep
0 is 12 mod 5 ? creep
0 is 12 mod 5 ? creep
este1(12, 16, 4) ? creep
4<12 ? creep
4<12 ? creep
_G1324 is 4+1 ? creep
5 is 4+1 ? creep
este1(12, 16, 5) ? creep
5<12 ? creep
5<12 ? creep
_G1327 is 5+1 ?

You might also like