diff --git a/Sudoku/SudokuEvent.mch b/Sudoku/SudokuEvent.mch index 1ee706d19de1e571f0fa6a703e0f004d87b32b25..b8aa63b1a12bedc5b1908ab8f56d75982ac77b91 100644 --- a/Sudoku/SudokuEvent.mch +++ b/Sudoku/SudokuEvent.mch @@ -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" */ &