(0) Obligation:

Clauses:

test_snake(Pattern, C, R) :- ','(s2l(C, Cols), ','(s2l(R, Rows), snake(Pattern, Cols, Rows))).
s2l(0, nil).
s2l(s(X), cons(X1, Y)) :- s2l(X, Y).
snake(Pattern, Cols, Rows) :- ','(infinite_snake(Pattern, InfSnake, InfSnake), ','(produce_snake(Rows, Cols, InfSnake, Snake), coil_it(Snake, odd))).
infinite_snake(nil, S, S).
infinite_snake(cons(A, R), cons(A, T), S) :- infinite_snake(R, T, S).
produce_snake(nil, X2, X3, nil).
produce_snake(cons(X4, Rows), Cols, InfSnake, cons(Part, Tail)) :- ','(part_of_snake(Cols, InfSnake, NewInfSnake, Part), produce_snake(Rows, Cols, NewInfSnake, Tail)).
part_of_snake(nil, RestSnake, RestSnake, nil).
part_of_snake(cons(X5, R), cons(Ring, Rings), RestSnake, cons(Ring, RestRings)) :- part_of_snake(R, Rings, RestSnake, RestRings).
coil_it(nil, X6).
coil_it(cons(Line, Lines), odd) :- coil_it(Lines, even).
coil_it(cons(Line, Lines), even) :- ','(reverse2(Line, Line1), coil_it(Lines, odd)).
reverse2(List, Reversed) :- reverse(List, nil, Reversed).
reverse(nil, Reversed, Reversed).
reverse(cons(Head, Tail), SoFar, Reversed) :- reverse(Tail, cons(Head, SoFar), Reversed).

Queries:

test_snake(g,g,g).