Noqx
Noqx is an extended logic puzzle solver of Noq.
- Try it through this portal for 180+ puzzle types and enhanced efficiency.
How to Use
Select a puzzle type
-
You can fuzzy search the puzzle type in the first dropdown box.
-
If you import the puzzle via a
puzz.linkURL, the puzzle type is automatically set. -
If you want to see the examples, you can select them from the second dropdown box.
-
You can view the rules of a puzzle externally if it is indexed in
puzz.link. -
You can change the parameters of a puzzle if the
Show Parametersbutton is available. -
If you change the puzzle type, the whole board will be cleared. Please take care.
Draw the board
-
The operations are identical to the original
Penpa+version. -
If you draw something on the board, the puzzle type and examples cannot be changed. Reset the board if you want to change them.
Solve the puzzle
-
Click on the
Solvebutton to solve the puzzle. -
If the puzzle is being solved, the puzzle type and examples cannot be changed. If you use the
backendversion, please wait until the solver times out. If you use thestaticversion, you can reset the puzzle directly. -
If the puzzle is solved, you can click on the original
Solvebutton to switch between solutions if the puzzle have multiple solutions. Meanwhile, the puzzle type and examples cannot be changed. Reset the board if you want to change them.
Reset the board
-
If you feel sure that the puzzle can be discarded, you can click the
Resetbutton to clear the board. -
Although the puzzle is reset, the style and size is cached for convenience.
How to contribute
-
Make sure the Microsoft Visual C++ Redistributable (v14, 2015-2022) is installed on Windows.
-
The
requirements.txtfile is for dependency checking only, and it is very discouraged to usePIPin this project.
Preparations
-
Install uv first.
-
Clone this project and switch to
devbranch.
- Install all dependencies with
uv:
- Install pre-commit and add commit hooks:
Program parameters
usage: uv run main.py [-h] [-H HOST] [-p PORT] [-d] [-tl TIME_LIMIT] [-pt PARALLEL_THREADS] [-B] [-D]
options:
-h, --help show this help message and exit
-H HOST, --host HOST the host to run the server on.
-p PORT, --port PORT the port to run the server on.
-d, --debug whether to enable debug mode with auto-reloading.
-tl TIME_LIMIT, --time-limit TIME_LIMIT
time limit in seconds.
-pt PARALLEL_THREADS, --parallel-threads PARALLEL_THREADS
parallel threads.
-B, --build-document build the documentation site.
-D, --enable-deployment
enable deployment for client-side purposes.
Write a new solver
-
Create a python file in the
solverfolder and write solver codes in that file. The functions in thenoqxpackage are free to use. -
Create a class inheriting the base class
noqx.manager.Solver. It is recommended to read the Solver Manager section for further reference. -
(Optional) Set the metadata of the solver. It is recommended to read the Solver Manager section for further reference.
-
Implement a
solvefunction and write the ASP program needed. The data structures are detailed in thePuzzle Encodingssection, especially in thenoqx.puzzle.Puzzleclass. The useful rules are detailed in theUseful Rulessection. -
(Optional) Implement a
refinefunction if extra refinement is needed after program solving. It is recommended to read the document of thenoqx.manager.store_solutionAPI for further reference. -
Test the solver manually by running
main.pywith the specified solver and puzzle.
Test solvers
- Run the tests (with default
unittestfeatures) withuv:
- Check the HTML version of coverage report with
uv:
Build a static site
- Generate required solver files with documents:
- Minify the solver files and remove all type hints:
uv run pyminify ./dist/page --in-place --remove-class-attribute-annotations --remove-literal-statements
- Remove all unused imports after minifying:
- Test the static site with the built-in server in Python: