This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
sc330_f2016:sudoku [2016/10/26 16:39] wingated |
sc330_f2016:sudoku [2021/06/30 23:42] (current) |
||
|---|---|---|---|
| Line 8: | Line 8: | ||
| % If we reach the end of the board with this scheme, it means that | % If we reach the end of the board with this scheme, it means that | ||
| % the whole thing is solved. | % the whole thing is solved. | ||
| + | |||
| + | % YOU SHOULD FILL IN THE SOLVE PROCEDURE, DOWN BELOW. | ||
| digit(1). | digit(1). | ||
| Line 53: | Line 55: | ||
| % for `getCube`. | % for `getCube`. | ||
| % drop: (InputList, NumToDrop, ResultList) | % drop: (InputList, NumToDrop, ResultList) | ||
| - | drop([], _, []). | + | drop([], _, []):-!. |
| - | drop(List, 0, List). | + | drop(List, 0, List):-!. |
| drop([_|Tail], Num, Rest) :- | drop([_|Tail], Num, Rest) :- | ||
| Num > 0, | Num > 0, | ||
| Line 63: | Line 65: | ||
| % for `getCube`. | % for `getCube`. | ||
| % take: (InputList, NumToTake, ResultList) | % take: (InputList, NumToTake, ResultList) | ||
| - | take([], _, []). | + | take([], _, []):-!. |
| - | take(_, 0, []). | + | take(_, 0, []):-!. |
| take([Head|Tail], Num, [Head|Rest]) :- | take([Head|Tail], Num, [Head|Rest]) :- | ||
| Num > 0, | Num > 0, | ||
| Line 86: | Line 88: | ||
| % 6 7 8 | % 6 7 8 | ||
| % | % | ||
| - | % getCube: (Board, ColumnIndex, ContentsOfCube) | + | % getCube: (Board, CubeNumber, ContentsOfCube) |
| getCube(Board, Number, AsList) :- | getCube(Board, Number, AsList) :- | ||
| cubeBounds(RowLow, RowHigh, ColLow, ColHigh, Number), | cubeBounds(RowLow, RowHigh, ColLow, ColHigh, Number), | ||