Skip to content
Snippets Groups Projects
Commit 0f732d5e authored by Michael Leuschel's avatar Michael Leuschel
Browse files

compute possible values

parent 42fdaf59
No related branches found
No related tags found
No related merge requests found
......@@ -42,7 +42,7 @@ PUZZLE == (
);
UnassignedPosition(x,y) == x:DOM & y:DOM & not(y:dom(Board(x)));
PossibleVals(cx,cy) == DOM \ ran({x,y,r| x|->y : conflict_pos(cx,cy) & y:dom(Board(x)) & r=Board(x)(y)})
CONSTANTS
get_square /*@desc "Subsquare (1,2,3) for a coordinate 1..9" */,
conflict_pos /*@desc "set of positions that are in conflict with a given position" */,
......@@ -85,6 +85,9 @@ OPERATIONS
ClearCurPos = BEGIN
Board(curx) := {cury} <<| Board(curx) // clear the value at the current position
END;
res <-- GetPossibleVals = BEGIN
res := PossibleVals(curx,cury)
END;
Solve(SBoard) = PRE
SBoard : DOM --> (DOM --> RAN) /*@desc "The solution must be complete" */ &
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment