:- use_module(contestlib, [writeN/2, write_int/2]). cross(N) :- FirstIndent = 5, MiddleIndent is 2*N - (N mod 2) - 3, UpperLeft = 1, cross(N,FirstIndent,UpperLeft,MiddleIndent). cross(0,_,_,_) :- !. cross(1,FirstIndent,UpperLeft,_) :- !, writeN(FirstIndent,' '), write_int(UpperLeft,2), nl. cross(N,FirstIndent,UpperLeft,MiddleIndent) :- UpperRight is UpperLeft + 1, write1line(FirstIndent,UpperLeft,MiddleIndent,UpperRight), N1 is N - 2, FirstIndent1 is FirstIndent + 2, UpperLeft1 is UpperLeft + 4, MiddleIndent1 is MiddleIndent - 4, cross(N1,FirstIndent1,UpperLeft1,MiddleIndent1), DownLeft is UpperLeft + 3, DownRight is UpperLeft + 2, write1line(FirstIndent,DownLeft,MiddleIndent,DownRight). write1line(Spaces1,I1,Spaces2,I2) :- writeN(Spaces1,' '), write_int(I1,2), writeN(Spaces2,' '), write_int(I2,2), nl.