fpuzzles integration - dclamage/SudokuSolver GitHub Wiki (2024)

Introduction

  • Sudoku Solver can integrate directly with the f-puzzles website, and provides several solving tools which are very helpful when setting puzzles.
  • For a demonstration of using the tooling to construct a classic Sudoku, watch this video.

Initial Setup

  • Follow the Installation Guide.

Install the user script

  • Download a user script extension for your web browser if you don't already have one:
    • Only tested using Tampermonkey which supports Chrome, Microsoft Edge, Safari, Opera Next, and Firefox.
    • For Firefox, Greasemonkey has been reported to work by some users, but it is not officially tested.
  • Open your browser and click the Tampermonkey icon in your plugins tray.
  • Choose the "Dashboard" option
  • Click the Utilities tab
  • Under "File" click the "Choose File" button under import
  • Browse to the folder where you extracted SudokuSolver and choose the Fpuzzles-SudokuSolver.user.js file.
  • Click the Install button.

Install the new constraints script [Version 0.4.0+]

  • Same as above, but choose the fpuzzles-newconstraints.js file.
  • Below you will find a list of additional user scripts, including an "additional constraints" script. Always use the script that comes with the solver, rather than the one listed below.

Start the SudokuSolver server:

  • Windows: Open the folder in File Explorer, and double-click the shortcut called "SudokuSolver Listen" with a globe icon.
  • Mac OSX: Open the folder and double-click on "listen"
  • Linux: Run the listen.sh shell script.
  • General command-line: The --listen command-line option starts the server.
  • However you start the server, you should see the following message:
Accepting connections from localhost:4545Press CTRL + Q to quit.

Open the f-puzzles site

  • Visit https://www.f-puzzles.com
  • If the userscript successfully installed, there should now be a "Connect" button on the top right. Click that button.
  • If the SudokuSolver server is succesfully running, then the button should change to say "Disconnect"
  • Open the solver panel (button to the right of the Solve button).
  • There should be a new checkbox there for "True Candid."

Solver Functionality

  • Solve: Finds and displays a random solution to the puzzle. Never respects centermarks.
  • Solution Path: Will attempt to solve the puzzle logically. The final result is displayed afterwards, and the solver console will contain all the logical steps taken. Always respects center marks. If you don't want center marks respected, then clear the puzzle first.
  • Step: Takes one logical step and shows the result, along with the step description in the solver console. Always respects center marks. If you don't want center marks respected, then clear the puzzle first.
  • Check: Determines if the puzzle has 0, 1, or 2+ solutions and displays the result in the console. Never respects centermarks.
  • Solution Count: Determines the exact number of solutions to the puzzle. Shows progress in the console as it finds solutions, and then the final result when completed. Never respects centermarks.
  • True Candid.: Stands for "True Candidates". Toggles the real-time display of true candidates while changing the puzzle. True candidates are candidates which actually can lead to a solution. Never respects centermarks.
  • Settings: There is a settings button (with a cog icon) next to the connect button, which opens a panel with the following options:
    • Logical Solve Settings: Allows disabling types of logic used by the logical solver. Uncheck the boxes to prevent the logical solver from using those techniques.
      • Tuples: This disables pairs, triples, etc.
      • Pointing: Disables pointing and box-line reduction.
      • Fishes: Disables x-wing, swordfish, jellyfish, etc.
      • Wings: Disables y-wing, xyz-wing, etc.
      • Contradictions: Disables generic contradiction steps, other than "trivial contradictions" which cannot be disabled.
    • True Candidates Settings:
      • Solution Count: When toggled on, this option makes the calculation take longer, but color-codes the candidates based on how many solutions would remain if that candidate were given. A green color means there is only one solution. Otherwise, the candidate has a shade of blue, with the blue shade getting darker as the number of solutions increases from 2 and 8. 8 and above is always the same dark blue color.
      • Include Logical Candidates: Includes any candidates that the logical solver ("Solution Path") would find. This respects the enabled/disabled logical techniques. Candidates which lead to 0 solutions are marked red. This is useful for preserving a desired technique in the puzzle while still knowing whether there is a solution.
    • Input Settings
      • Edit Given Pencilmarks: Allows for editing "Given Pencilmarks" which limit the options in a cell when considered by the logical and brute force solvers. They are rendered separately and cannot be overriden by normal center pencilmarks. Works especially well with the "True Candidates" feature.

Stability

The userscript and solver is still in alpha, and as such may run into strange issues sometimes. If it does, try the following steps in order until the issue is fixed:

  1. Click the "Connect/Disconnect/Calculating..." button to disconnect, then connect again.
  2. Quit the solver and run it again, then reconnect.
  3. Quit the solver, use the "Open with Link" option in the f-puzzles Export menu to open a copy of the site in a new tab, and then close the old tab. Then, start the server again and connect from the new tab.

Additional Scripts

There are also additional user scripts for f-puzzles which you may find useful, but aren't related to the solver. To install them, use the "Install from URL" feature of the Tampermonkey Dashboard.

  1. Adds multicolor and blue cage selection modes:
    https://gist.github.com/dclamage/54934b266608f79f8e534736213975b2/raw/fpuzzles-multicolor.js

  2. Changes behavior of spacebar to rotate through modes (instead of pausing):
    https://gist.github.com/dclamage/4246112400e07c8aa22f1ff46c104cc8/raw/fpuzzles-spacebar.js

  3. Removes the confirmation dialog when closing the tab:
    https://gist.github.com/dclamage/ffc19b8c6b7046259404f4b8b76f5977/raw/fpuzzles-noconfirm.js

  4. Changes WASD and shift-WASD to do the same as arrow keys:
    https://gist.github.com/dclamage/bb16a3a5d4dd3c1ebbd5cbd1a7ea7cce/raw/fpuzzles-wasd.js

  5. Paste (ctrl+v) while typing cosmetic text. This allows pasting unicode characters:
    https://gist.githubusercontent.com/dclamage/f3c0cad6bb9977b2324a0b2364c5439f/raw/fpuzzles-paste.js

  6. Press ctrl+value with nothing selected to select all markings with that value:
    https://gist.githubusercontent.com/dclamage/ca9aab30f3f5ae6438a40259bf8a2d41/raw/fpuzzles-selectval.js

  7. Adds additional constraints to f-puzzles. Currently Renban and Whispers lines. [Do not use with version 0.4.0+, and instead use the one that comes with the zip file]https://gist.githubusercontent.com/dclamage/3d76a56c9153a8546888a31d65765cb7/raw/fpuzzles-newconstraints.js

  8. Lowers CPU usage by preventing re-draws while no inputs are occurring.https://gist.github.com/dclamage/bba785d617abb6b6a5a5543065ac880b/raw/fpuzzles-cpu.js

  9. Changes non-given values to a blue color so they're more distinguishable from givens, especially for those with poor vision.https://gist.github.com/dclamage/9a40dc9433d903feeee78a085377e81e/raw/fpuzzles-bluevalues.js

  10. Directly edit the json puzzle data straight in f-puzzles with undo/redo history. Use ctrl+j to open the editor, and then ctrl+s to save and close, or ctrl+x to close without saving.https://gist.github.com/dclamage/e2645050a1a1dec51399d8cc04867a6d/raw/fpuzzles-jsoneditor.user.js

  11. Allows setters to specify a solution to the puzzle, which is checked in solve mode when the final digit is entered.https://gist.github.com/dclamage/63cc6241752dbeb1214328f4ae655cf7/raw/fpuzzles-solution.user.js

  12. Modifies the "New Grid" popup to include an entry to paste a string of givens. (Created by RSP)https://gist.github.com/dclamage/bd07bc571fac98e58953b47db7ddb47a/raw/ImExGivens.user.js

  13. Place 1x1 "fog lights" to activate fog in SudokuPad and reveal one cell at a time. (Created by Sven)https://github.com/SudokuPad/fpuzzles-userscripts/raw/main/src/fpuzzles-foglight/Fpuzzles-FogLight.user.js

Feature Requests / Reporting Issues

  • I'd love to hear how you're using this feature! I have many improvements planned, but I'm happy to hear your suggestions so that I can prioritize ones that people want to use. So please let me know!
  • You can report a problem or request a feature by creating an issue, or by joining the Discord server.
  • Please look over the issues first to see if it already exists before creating a new one.
fpuzzles integration - dclamage/SudokuSolver GitHub Wiki (2024)
Top Articles
Latest Posts
Article information

Author: Delena Feil

Last Updated:

Views: 6024

Rating: 4.4 / 5 (45 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Delena Feil

Birthday: 1998-08-29

Address: 747 Lubowitz Run, Sidmouth, HI 90646-5543

Phone: +99513241752844

Job: Design Supervisor

Hobby: Digital arts, Lacemaking, Air sports, Running, Scouting, Shooting, Puzzles

Introduction: My name is Delena Feil, I am a clean, splendid, calm, fancy, jolly, bright, faithful person who loves writing and wants to share my knowledge and understanding with you.