Skip to content

Commit 01f3ed0

Browse files
committed
bug fix to Prolog solution for Part 2
1 parent 4227c63 commit 01f3ed0

File tree

1 file changed

+3
-3
lines changed
  • challenge-088/adam-russell/prolog

1 file changed

+3
-3
lines changed

challenge-088/adam-russell/prolog/ch-2.p

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@ write_remove_bottom(Matrix, UpdatedMatrix):-
4444

4545
spiral(Matrix):-
4646
spiral(Matrix, _).
47-
spiral([], _).
4847
spiral(Matrix, UpdatedMatrix):-
4948
write_remove_top(Matrix, UpdatedMatrix),
5049
write(","),
5150
write_remove_right(UpdatedMatrix, RightRemainder),
5251
reverse(RightRemainder, RemainderRight),
5352
write_remove_bottom(RemainderRight, BottomRemainder),
5453
write(","),
55-
write_remove_left(BottomRemainder, LeftRemainder),
56-
spiral(LeftRemainder, []).
54+
reverse(BottomRemainder, RemainderBottom),
55+
write_remove_left(RemainderBottom, LeftRemainder),
56+
spiral(LeftRemainder, _).
5757
spiral(_, []):-
5858
write("\b").
5959

0 commit comments

Comments
 (0)