User Tools

Site Tools


sc330_f2016:sudoku

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
sc330_f2016:sudoku [2016/08/18 22:06]
dcostello created
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),
Line 99: Line 101:
 % After calling `solve` on a board, the board should be fully % After calling `solve` on a board, the board should be fully
 % instantiated with a satisfying Sudoku solution. % instantiated with a satisfying Sudoku solution.
-solve(Board) :- true. % ---PUT CODE HERE---+ 
 +% ---- PUT CODE HERE --- 
 +% ---- PUT CODE HERE --- 
 + 
 +solve(Board) :- true.  ---PUT CODE HERE--- 
 + 
 +% ---- PUT CODE HERE --- 
 +% ---- PUT CODE HERE ---
  
 % Prints out the given board. % Prints out the given board.
sc330_f2016/sudoku.1471557998.txt.gz · Last modified: 2021/06/30 23:40 (external edit)