From e06527fb29c6cac6ec068f09036ce984b85bb4ef Mon Sep 17 00:00:00 2001 From: Michael Leuschel <leuschel@uni-duesseldorf.de> Date: Thu, 1 Jul 2021 12:25:22 +0200 Subject: [PATCH] add help event to go to position with forced value --- Sudoku/SudokuEvent.mch | 5 +++++ Sudoku/SudokuFeld.svg | 8 ++++---- Sudoku/visb_sudoku.json | 11 +++++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Sudoku/SudokuEvent.mch b/Sudoku/SudokuEvent.mch index 87514f5..000d53d 100644 --- a/Sudoku/SudokuEvent.mch +++ b/Sudoku/SudokuEvent.mch @@ -100,6 +100,11 @@ OPERATIONS SetCurPos(x,y) = PRE x:DOM & y:DOM THEN curx, cury := x,y // change current position END; + SetCurPosToDetPosition(dx,dy) = PRE dx:DOM & dy:DOM & + not(dy:dom(Board(dx))) & + card(PossibleVals(dx,dy))=1 /*@desc "exactly one value possible" */ THEN + curx, cury := dx,dy // change current position + END; SetBoard(val) = PRE val:RAN & cury /: dom(PuzzleBoard(curx)) THEN Board(curx)(cury) := val // Set the Value at the current position END; diff --git a/Sudoku/SudokuFeld.svg b/Sudoku/SudokuFeld.svg index 3098cc9..fe6cbe9 100644 --- a/Sudoku/SudokuFeld.svg +++ b/Sudoku/SudokuFeld.svg @@ -1073,10 +1073,10 @@ <text transform="matrix(1 0 0 1 0 0)" class="normalActionbuttons" font-style="normal" font-weight="normal" xml:space="preserve" text-anchor="start" font-family="sans-serif" font-size="10" id="TippText" y="10.96203" x="4.71516" stroke-width="0" stroke="null" fill="black">?</text> </g> -<g id="Add" transform="translate(125,22.5)"> - <title>(not available)</title> - <ellipse ry="7" rx="7" id="AddCircle" cy="7.5" cx="7.5" class="normalKeyboard"/> - <text style="cursor: move;" font-style="normal" class="disabledActionbuttons" font-weight="normal" xml:space="preserve" text-anchor="start" font-family="sans-serif" font-size="10" id="AddText" y="10.96203" x="4.71516" stroke-width="0" stroke="null">+</text> +<g id="Help" transform="translate(125,22.5)"> + <title>Show a position with forced value</title> + <ellipse ry="7" rx="7" id="HelpCircle" cy="7.5" cx="7.5" class="normalKeyboard"/> + <text style="cursor: move;" font-style="normal" class="normalActionbuttons" font-weight="normal" xml:space="preserve" text-anchor="start" font-family="sans-serif" font-size="10" id="HelpText" y="10.96203" x="4.71516" stroke-width="0" stroke="null">+</text> </g> <g id="Remove" transform="translate(140,22.5)"> diff --git a/Sudoku/visb_sudoku.json b/Sudoku/visb_sudoku.json index 1a4ff80..7c46f80 100644 --- a/Sudoku/visb_sudoku.json +++ b/Sudoku/visb_sudoku.json @@ -45,6 +45,11 @@ "id": "SolveText", "attr": "class", "value" : "IF ENABLED(\"Solve\")=TRUE THEN \"normalActionbuttons\" ELSE \"disabledActionbuttons\" END" + }, + { + "id": "HelpText", + "attr": "class", + "value" : "IF ENABLED(\"SetCurPosToDetPosition\")=TRUE THEN \"normalActionbuttons\" ELSE \"disabledActionbuttons\" END" } ], "events": [ @@ -83,6 +88,12 @@ { "id":"TipFrame", "attr":"visibility", "enter":"visible", "leave":"hidden"} ] }, + { + "id": "HelpCircle", + "event": "SetCurPosToDetPosition", + "hovers": [{ "attr":"class", "enter":"hoverKeypad", "leave":"normalKeypad"} + ] + }, { "id": "newGameRect", "event": "SetPuzzle", -- GitLab