Home > Archive > Prolog > March 2004 > newby question - once more solitaire - infinite loop?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
newby question - once more solitaire - infinite loop?
|
|
| Matthias Hahn 2004-03-27, 12:10 am |
| Hi,
I know, there are solutions for the solitaire game in prolog.
But I'd like to know what I did wrong in following code. In
the marked position I get an infinite loop though I thought this
should not happen because of backtracking. But there are always
chosen the same Tokens. The starting point is: ?- res.
In the list 'Tokens' the actual Tokens on the field are stored.
Perhaps somebody can give me a hint.
Thanks in advance,
Matthias Hahn
% solitaire.pl
%definition of the neighboures
south(a2,b2).
south(a3,b3).
south(a4,b4).
south(b2,c2).
south(b3,c3).
south(b4,c4).
south(c2,d2).
south(c3,d3).
south(c4,d4).
south(d2,e2).
south(d3,e3).
south(d4,e4).
south(e2,f2).
south(e3,f3).
south(e4,f4).
south(f2,g2).
south(f3,g3).
south(f4,g4).
south(c0,d0).
south(c1,d1).
south(c5,d5).
south(c6,d6).
south(d0,e0).
south(d1,e1).
south(d5,e5).
south(d6,e6).
north(b2,a2).
north(b3,a3).
north(b4,a4).
north(c2,b2).
north(c3,b3).
north(c4,b4).
north(d2,c2).
north(d3,c3).
north(d4,c4).
north(e2,d2).
north(e3,d3).
north(e4,d4).
north(f2,e2).
north(f3,e3).
north(f4,e4).
north(g2,f2).
north(g3,f3).
north(g4,f4).
north(d0,c0).
north(d1,c1).
north(d5,c5).
north(d6,c6).
north(e0,d0).
north(e1,d1).
north(e5,d5).
north(e6,d6).
west(c1,c0).
west(d1,d0).
west(e1,e0).
west(c2,c1).
west(d2,d1).
west(e2,e1).
west(c3,c2).
west(d3,d2).
west(e3,e2).
west(c4,c3).
west(d4,d3).
west(e4,e3).
west(c5,c4).
west(d5,d4).
west(e5,e4).
west(c6,c5).
west(d6,d5).
west(e6,e5).
west(a3,a2).
west(b3,b2).
west(f3,f2).
west(g3,g2).
west(a4,a3).
west(b4,b3).
west(f4,f3).
west(g4,g3).
east(c0,c1).
east(d0,d1).
east(e0,e1).
east(c1,c2).
east(d1,d2).
east(e1,e2).
east(c2,c3).
east(d2,d3).
east(e2,e3).
east(c3,c4).
east(d3,d4).
east(e3,e4).
east(c4,c5).
east(d4,d5).
east(e4,e5).
east(c5,c6).
east(d5,d6).
east(e5,e6).
east(a2,a3).
east(b2,b3).
east(f2,f3).
east(g2,g3).
east(a3,a4).
east(b3,b4).
east(f3,f4).
east(g3,g4).
delete(_,[],[]).
delete(X, [X|Z], Z).
delete(X, [H|Z], [H|T]) :- !, delete(X, Z, T).
printout([A|[]]) :-
write(A), nl.
printout([A | List]) :-
write(A), write(', '), printout(List).
% Jump from A to B via X only possible if no Token on B but
% Tokens on A and X
jump(A, X, B, Tokens) :-
(north(A, X), north(X, B), member(A, Tokens),
member(X, Tokens), not member(B, Tokens));
(south(A, X), south(X, B), member(A, Tokens),
member(X, Tokens), not member(B, Tokens));
(west(A, X), west(X, B), member(A, Tokens),
member(X, Tokens), not member(B, Tokens));
(east(A, X), east(X, B), member(A, Tokens),
member(X, Tokens), not member(B, Tokens)).
% Here the program should end with one correct solution
move([A, X], Result) :-
jump(A, X, d3),
write('Solution: '), printout(.([A,d3], Result)), nl.
move(Tokens, []) :-
% write('tokens: '), printout(Tokens),
jump(A, X, B, Tokens),
% jump(A, X, B, Tokens).
% write(A), write(' '), write(X), write(' '), write(B), nl,
delete(A, Tokens, Tmp1),
delete(X, Tmp1, Tmp2),
move(.(B, Tmp2), [[A, B]]).
move(Tokens, Jumps) :-
% write('jump: '), printout(Jumps),
% write('tokens: '), printout(Tokens),
jump(A, X, B, Tokens),
%write(A), write(' '), write(X), write(' '), write(B), nl,
%read(Z),
delete(A, Tokens, Tmp1),
delete(X, Tmp1, Tmp2),
printout(Tmp2),
% ==================== infinite loop =========================
% read(Z),
move(.(B, Tmp2), .([A,B], Jumps)).
% starting point
res :- %tell('moves.txt'),
move([ a2, a3, a4,
b2, b3, b4,
c0, c1, c2, c3, c4, c5, c6,
d0, d1, d2, d4, d5, d6,
e0, e1, e2, e3, e4, e5, e6,
f2, f3, f4,
g2, g3, g4],
[]).%,
%told('moves.txt').
| |
| Martin Sondergaard 2004-03-27, 12:10 am |
|
"Matthias Hahn" <hahn@ira.uka.de> wrote in message
news:66ea123b.0403150018.63f71a5f@posting.google.com...
> Hi,
>
> I know, there are solutions for the solitaire game in prolog.
> But I'd like to know what I did wrong in following code. In
> the marked position I get an infinite loop though I thought this
> should not happen because of backtracking. But there are always
> chosen the same Tokens. The starting point is: ?- res.
> In the list 'Tokens' the actual Tokens on the field are stored.
>
> Perhaps somebody can give me a hint.
>
> Thanks in advance,
>
> Matthias Hahn
>
>
> % solitaire.pl
>
> %definition of the neighboures
> south(a2,b2).
> south(a3,b3).
> south(a4,b4).
> south(b2,c2).
> south(b3,c3).
> south(b4,c4).
> south(c2,d2).
> south(c3,d3).
> south(c4,d4).
> south(d2,e2).
> south(d3,e3).
> south(d4,e4).
> south(e2,f2).
> south(e3,f3).
> south(e4,f4).
> south(f2,g2).
> south(f3,g3).
> south(f4,g4).
>
> south(c0,d0).
> south(c1,d1).
> south(c5,d5).
> south(c6,d6).
> south(d0,e0).
> south(d1,e1).
> south(d5,e5).
> south(d6,e6).
>
> north(b2,a2).
> north(b3,a3).
> north(b4,a4).
> north(c2,b2).
> north(c3,b3).
> north(c4,b4).
> north(d2,c2).
> north(d3,c3).
> north(d4,c4).
> north(e2,d2).
> north(e3,d3).
> north(e4,d4).
> north(f2,e2).
> north(f3,e3).
> north(f4,e4).
> north(g2,f2).
> north(g3,f3).
> north(g4,f4).
>
> north(d0,c0).
> north(d1,c1).
> north(d5,c5).
> north(d6,c6).
> north(e0,d0).
> north(e1,d1).
> north(e5,d5).
> north(e6,d6).
>
> west(c1,c0).
> west(d1,d0).
> west(e1,e0).
> west(c2,c1).
> west(d2,d1).
> west(e2,e1).
> west(c3,c2).
> west(d3,d2).
> west(e3,e2).
> west(c4,c3).
> west(d4,d3).
> west(e4,e3).
> west(c5,c4).
> west(d5,d4).
> west(e5,e4).
> west(c6,c5).
> west(d6,d5).
> west(e6,e5).
>
> west(a3,a2).
> west(b3,b2).
> west(f3,f2).
> west(g3,g2).
> west(a4,a3).
> west(b4,b3).
> west(f4,f3).
> west(g4,g3).
>
> east(c0,c1).
> east(d0,d1).
> east(e0,e1).
> east(c1,c2).
> east(d1,d2).
> east(e1,e2).
> east(c2,c3).
> east(d2,d3).
> east(e2,e3).
> east(c3,c4).
> east(d3,d4).
> east(e3,e4).
> east(c4,c5).
> east(d4,d5).
> east(e4,e5).
> east(c5,c6).
> east(d5,d6).
> east(e5,e6).
>
> east(a2,a3).
> east(b2,b3).
> east(f2,f3).
> east(g2,g3).
> east(a3,a4).
> east(b3,b4).
> east(f3,f4).
> east(g3,g4).
>
> delete(_,[],[]).
> delete(X, [X|Z], Z).
> delete(X, [H|Z], [H|T]) :- !, delete(X, Z, T).
>
> printout([A|[]]) :-
> write(A), nl.
>
> printout([A | List]) :-
> write(A), write(', '), printout(List).
>
> % Jump from A to B via X only possible if no Token on B but
> % Tokens on A and X
> jump(A, X, B, Tokens) :-
> (north(A, X), north(X, B), member(A, Tokens),
> member(X, Tokens), not member(B, Tokens));
> (south(A, X), south(X, B), member(A, Tokens),
> member(X, Tokens), not member(B, Tokens));
> (west(A, X), west(X, B), member(A, Tokens),
> member(X, Tokens), not member(B, Tokens));
> (east(A, X), east(X, B), member(A, Tokens),
> member(X, Tokens), not member(B, Tokens)).
>
>
> % Here the program should end with one correct solution
> move([A, X], Result) :-
> jump(A, X, d3),
> write('Solution: '), printout(.([A,d3], Result)), nl.
>
In the clause above, you are trying to call "jump/3",
but you have only defined "jump/4".
(Unless you have defined it somewhere but not shown it in your email.)
By "jump/3" I mean "jump" with 3 arguments,
and by "jump/4" I mean "jump" with 4 arguments.
>
> move(Tokens, []) :-
> % write('tokens: '), printout(Tokens),
> jump(A, X, B, Tokens),
> % jump(A, X, B, Tokens).
> % write(A), write(' '), write(X), write(' '), write(B), nl,
> delete(A, Tokens, Tmp1),
> delete(X, Tmp1, Tmp2),
> move(.(B, Tmp2), [[A, B]]).
>
>
> move(Tokens, Jumps) :-
> % write('jump: '), printout(Jumps),
> % write('tokens: '), printout(Tokens),
> jump(A, X, B, Tokens),
When you call "jump/4", all of the arguments, A, X, B, and Tokens, have no
value.
They are uninstantiated.
This is a mistake.
The way "jump/4" is defined, it is supposed to be called with values in A,
B, and X.
E.g.
% Jump from a1 to c2 via b5.
?- jump( a1, b5, c2, Tokens ).
Tokens = ...
Yes
?-
Here is another error :
> %write(A), write(' '), write(X), write(' '), write(B), nl,
> %read(Z),
> delete(A, Tokens, Tmp1),
When you call "delete/3", the variable A is uninstantiated.
This is a mistake.
> delete(X, Tmp1, Tmp2),
> printout(Tmp2),
> % ==================== infinite loop =========================
> % read(Z),
> move(.(B, Tmp2), .([A,B], Jumps)).
>
>
> % starting point
> res :- %tell('moves.txt'),
> move([ a2, a3, a4,
> b2, b3, b4,
> c0, c1, c2, c3, c4, c5, c6,
> d0, d1, d2, d4, d5, d6,
> e0, e1, e2, e3, e4, e5, e6,
> f2, f3, f4,
> g2, g3, g4],
> []).%,
> %told('moves.txt').
--
Martin Sondergaard.
The website you s
cannot be located
but endless others exist.
-- A poem by Anon.
| |
| Matthias Hahn 2004-03-27, 12:10 am |
| Many thanks for your fast response. Perhaps you or s'body else
can help me furtheron as your hints not completly yield to a
correct solution of the solitaire game:
* There is an inifinite loop (see below)
* the lists on the stack seem to be corrupted
* the program never ends
I hope, the attached code is no problem to
anyone. Perhaps my code is very stupid - I'm a Prolog newby.
But I'd like to understand why the code doesn't work
This is my solitaire field:
a2, a3, a4,
b2, b3, b4,
c0, c1, c2, c3, c4, c5, c6,
d0, d1, d2, d3, d4, d5, d6,
e0, e1, e2, e3, e4, e5, e6,
f2, f3, f4,
g2, g3, g4
This is the initial field:
a2, a3, a4,
b2, b3, b4,
c0, c1, c2, c3, c4, c5, c6,
d0, d1, d2, d4, d5, d6,
e0, e1, e2, e3, e4, e5, e6,
f2, f3, f4,
g2, g3, g4
The program is started by 'res.' and should give a list of
correct jumps leading to an field with the only target 'd3'.
Thank you in advance,
Matthias Hahn
%%
% Your reply
%%
"Martin Sondergaard" <nobody@nowhere.com> wrote in message news:<1079349510.27184.0@damia.uk.clara.net>...
>
> In the clause above, you are trying to call "jump/3",
> but you have only defined "jump/4".
> (Unless you have defined it somewhere but not shown it in your email.)
> By "jump/3" I mean "jump" with 3 arguments,
> and by "jump/4" I mean "jump" with 4 arguments.
>
I fixed that bug - but this was no problem so far, as this
code was not yet reached.
>
> When you call "jump/4", all of the arguments, A, X, B, and Tokens, have no
> value.
> They are uninstantiated.
> This is a mistake.
I thougt, Prolog would set uninstantiated variables to a value?
BTW, A, X and B was correctly set by Prolog. But in the attached code
I have a slightly different version of the program which should
have instatiated variables - however, I get the same infinite loop!
> The way "jump/4" is defined, it is supposed to be called with values in A,
> B, and X.
> E.g.
>
> % Jump from a1 to c2 via b5.
> ?- jump( a1, b5, c2, Tokens ).
>
> Tokens = ...
> Yes
>
> ?-
>
>
> Here is another error :
>
>
I don't understand why this should be an error?
I've also attached a part of 'moves.txt' where you can
see that the deletion works.
>
> When you call "delete/3", the variable A is uninstantiated.
> This is a mistake.
>
>
%%
% My new code
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% solitaire.pl
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% definition of the fields
% (see res/0 for initial values)
field(a2).
field(a3).
field(a4).
field(b2).
field(b3).
field(b4).
field(c0).
field(c1).
field(c2).
field(c3).
field(c4).
field(c5).
field(c6).
field(d0).
field(d1).
field(d2).
field(d3).
field(d4).
field(d5).
field(d6).
field(e0).
field(e1).
field(e2).
field(e3).
field(e4).
field(e5).
field(e6).
field(f2).
field(f3).
field(f4).
field(g2).
field(g3).
field(g4).
%definition of the neighbours
south(a2,b2).
south(a3,b3).
south(a4,b4).
south(b2,c2).
south(b3,c3).
south(b4,c4).
south(c2,d2).
south(c3,d3).
south(c4,d4).
south(d2,e2).
south(d3,e3).
south(d4,e4).
south(e2,f2).
south(e3,f3).
south(e4,f4).
south(f2,g2).
south(f3,g3).
south(f4,g4).
south(c0,d0).
south(c1,d1).
south(c5,d5).
south(c6,d6).
south(d0,e0).
south(d1,e1).
south(d5,e5).
south(d6,e6).
north(b2,a2).
north(b3,a3).
north(b4,a4).
north(c2,b2).
north(c3,b3).
north(c4,b4).
north(d2,c2).
north(d3,c3).
north(d4,c4).
north(e2,d2).
north(e3,d3).
north(e4,d4).
north(f2,e2).
north(f3,e3).
north(f4,e4).
north(g2,f2).
north(g3,f3).
north(g4,f4).
north(d0,c0).
north(d1,c1).
north(d5,c5).
north(d6,c6).
north(e0,d0).
north(e1,d1).
north(e5,d5).
north(e6,d6).
west(c1,c0).
west(d1,d0).
west(e1,e0).
west(c2,c1).
west(d2,d1).
west(e2,e1).
west(c3,c2).
west(d3,d2).
west(e3,e2).
west(c4,c3).
west(d4,d3).
west(e4,e3).
west(c5,c4).
west(d5,d4).
west(e5,e4).
west(c6,c5).
west(d6,d5).
west(e6,e5).
west(a3,a2).
west(b3,b2).
west(f3,f2).
west(g3,g2).
west(a4,a3).
west(b4,b3).
west(f4,f3).
west(g4,g3).
east(c0,c1).
east(d0,d1).
east(e0,e1).
east(c1,c2).
east(d1,d2).
east(e1,e2).
east(c2,c3).
east(d2,d3).
east(e2,e3).
east(c3,c4).
east(d3,d4).
east(e3,e4).
east(c4,c5).
east(d4,d5).
east(e4,e5).
east(c5,c6).
east(d5,d6).
east(e5,e6).
east(a2,a3).
east(b2,b3).
east(f2,f3).
east(g2,g3).
east(a3,a4).
east(b3,b4).
east(f3,f4).
east(g3,g4).
delete(_,[],[]).
delete(X, [X|Z], Z).
delete(X, [H|Z], [H|T]) :- !, delete(X, Z, T).
printout([A|[]]) :-
write(A), nl.
printout([A | List]) :-
write(A), write(', '), printout(List).
% Jump from A to B via X
jump(A, X, B) :-
((north(A, X), north(X, B));
(south(A, X), south(X, B));
(west(A, X), west(X, B));
(east(A, X), east(X, B))).
% Here the program should end with one correct solution
move([A, X], Result) :-
jump(A, X, d3),
write('Solution: '), printout(.([A,d3], Result)), nl.
move(Tokens, []) :-
write('tokens: '), printout(Tokens),
field(A), field(X), field(B),
member(A, Tokens), member(X, Tokens),
not(member(B, Tokens)),
jump(A, X, B),
% write(A), write(' '), write(X), write(' '), write(B), nl,
delete(A, Tokens, Tmp1),
delete(X, Tmp1, Tmp2),
move(.(B, Tmp2), [[A, B]]).
move(Tokens, Jumps) :-
write('jumps: '), printout(Jumps),
write('tokens: '), printout(Tokens),
field(A), field(X), field(B),
member(A, Tokens), member(X, Tokens),
not(member(B, Tokens)),
jump(A, X, B),
write('jump: '),write(A), write(' '), write(X), write(' '), write(B), nl,
%read(Z),
delete(A, Tokens, Tmp1),
delete(X, Tmp1, Tmp2),
% printout(Tmp2),
% ==================== infinite loop =========================
% read(Z),
move(.(B, Tmp2), .([A,B], Jumps)).
% starting point
res :- tell('moves.txt'),
move([ a2, a3, a4,
b2, b3, b4,
c0, c1, c2, c3, c4, c5, c6,
d0, d1, d2, d4, d5, d6,
e0, e1, e2, e3, e4, e5, e6,
f2, f3, f4,
g2, g3, g4],
[]).%,
told('moves.txt').
%%
% part of the outputs of the program above
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% part of 'moves.txt'
%
% * the 'jumps'-list is getting longer and longer
% * sometimes there are suspicious outputsc (see below)
% * there is an infinite loop of
% tokens: g4, e2, e5, c6, b2, e0, g3
% tokens: g2, e2, e5, c6, b2, e0
% tokens: g2, e2, e5, c6, b2, e0, g3
% tokens: g4, e2, e5, c6, b2, e0
% tokens: g4, e2, e5, c6, b2, e0, g3
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
..
..
..
tokens: g2, f2, e5, c6, b2, e0, g3, g4
jump: g2 f2 e2
jumps: [g2, e2], [e2, g2], [f4, f2], [g2, e2], [e3, e5], [e6, e4],
[e1, e3], [e3, e5], [c4, c6], [e5, c5], [d3, d5], [d6, d4], [a4, c4],
[d4, b4], [d2, b2], [d0, d2], [a2, c2], [d2, b2], [c6, c4], [c4, a4],
[c0, c2], [c3, c1], [a4, a2], [a2, c2], [c1, c3], [b3, d3]
tokens: e2, e5, c6, b2, e0, g3, g4
jump: g4 g3 g2
jumps: [g4, g2], [g2, e2], [e2, g2], [f4, f2], [g2, e2], [e3, e5],
[e6, e4], [e1, e3], [e3, e5], [c4, c6], [e5, c5], [d3, d5], [d6, d4],
[a4, c4], [d4, b4], [d2, b2], [d0, d2], [a2, c2], [d2, b2], [c6, c4],
[c4, a4], [c0, c2], [c3, c1], [a4, a2], [a2, c2], [c1, c3], [b3, d3]
tokens: g2, e2, e5, c6, b2, e0
%% I don't understand the output of "e0, [b3, d3], "
e0, [b3, d3], jumps: [g4, g2], [g2, e2], [e2, g2], [f4, f2],
[g2, e2], [e3, e5], [e6, e4], [e1, e3], [e3, e5], [c4, c6], [e5, c5],
[d3, d5], [d6, d4], [a4, c4], [d4, b4], [d2, b2], [d0, d2], [a2, c2],
[d2, b2], [c6, c4], [c4, a4], [c0, c2], [c3, c1], [a4, a2], [a2, c2],
[c1, c3], [b3, d3]
tokens: g2, e2, e5, c6, b2, e0, g3
jump: g2 g3 g4
jumps: [g2, g4], [g4, g2], [g2, e2], [e2, g2], [f4, f2],
[g2, e2], [e3, e5], [e6, e4], [e1, e3], [e3, e5], [c4, c6], [e5, c5],
[d3, d5], [d6, d4], [a4, c4], [d4, b4], [d2, b2], [d0, d2], [a2, c2],
[d2, b2], [c6, c4], [c4, a4], [c0, c2], [c3, c1], [a4, a2], [a2, c2],
[c1, c3], [b3, d3]
tokens: g4, e2, e5, c6, b2, e0
%% I don't understand the output of "e0, [b3, d3], "
e0, [b3, d3], jumps: [g2, g4], [g4, g2], [g2, e2], [e2, g2], [f4, f2],
[g2, e2], [e3, e5], [e6, e4], [e1, e3], [e3, e5], [c4, c6], [e5, c5],
[d3, d5], [d6, d4], [a4, c4], [d4, b4], [d2, b2], [d0, d2], [a2, c2],
[d2, b2], [c6, c4], [c4, a4], [c0, c2], [c3, c1], [a4, a2], [a2, c2],
[c1, c3], [b3, d3]
tokens: g4, e2, e5, c6, b2, e0, g3
jump: g4 g3 g2
jumps: [g4, g2], [g2, g4], [g4, g2], [g2, e2], [e2, g2], [f4, f2],
[g2, e2], [e3, e5], [e6, e4], [e1, e3], [e3, e5], [c4, c6], [e5, c5],
[d3, d5], [d6, d4], [a4, c4], [d4, b4], [d2, b2], [d0, d2], [a2, c2],
[d2, b2], [c6, c4], [c4, a4], [c0, c2], [c3, c1], [a4, a2], [a2, c2],
[c1, c3], [b3, d3]
tokens: g2, e2, e5, c6, b2, e0
e0, [b3, d3], jumps: [g4, g2], [g2, g4], [g4, g2], [g2, e2], [e2, g2],
[f4, f2], [g2, e2], [e3, e5], [e6, e4], [e1, e3], [e3, e5], [c4, c6],
[e5, c5], [d3, d5], [d6, d4], [a4, c4], [d4, b4], [d2, b2], [d0, d2],
[a2, c2], [d2, b2], [c6, c4], [c4, a4], [c0, c2], [c3, c1], [a4, a2],
[a2, c2], [c1, c3], [b3, d3]
tokens: g2, e2, e5, c6, b2, e0, g3
jump: g2 g3 g4
jumps: [g2, g4], [g4, g2], [g2, g4], [g4, g2], [g2, e2], [e2, g2],
[f4, f2], [g2, e2], [e3, e5], [e6, e4], [e1, e3], [e3, e5], [c4, c6],
[e5, c5], [d3, d5], [d6, d4], [a4, c4], [d4, b4], [d2, b2], [d0, d2],
[a2, c2], [d2, b2], [c6, c4], [c4, a4], [c0, c2], [c3, c1], [a4, a2],
[a2, c2], [c1, c3], [b3, d3]
tokens: g4, e2, e5, c6, b2, e0
e0, [b3, d3], jumps: [g2, g4], [g4, g2], [g2, g4], [g4, g2], [g2, e2],
[e2, g2], [f4, f2], [g2, e2], [e3, e5], [e6, e4], [e1, e3], [e3, e5],
[c4, c6], [e5, c5], [d3, d5], [d6, d4], [a4, c4], [d4, b4], [d2, b2],
[d0, d2], [a2, c2], [d2, b2], [c6, c4], [c4, a4], [c0, c2], [c3, c1],
[a4, a2], [a2, c2], [c1, c3], [b3, d3]
tokens: g4, e2, e5, c6, b2, e0, g3
jump: g4 g3 g2
..
..
..
|
|
|
|
|