Directory macros/context/contrib/context-sudoku
sudoku
This is a ConTeXt port of a famous sudoku solver by Peter Norvig. It provides five commands, as well as a command handler:
\sudoku
typesets a sudoku if valid.\sudokufile
typesets a sudoku from a file if valid.\solvesudoku
solves a sudoku if valid.\solvesudokufile
solves a sudoku from a file if valid.\randomsudoku
creates a random, unsolved sudoku.\sudokubuffer
typesets a sudoku from a buffer.\solvesudokubuffer
solves a sudoku from a buffer if valid.\setupsudoku
is the command handler for commands above.
\setupsudoku
understands the following parameters:
\setupsudoku [size=2em, align={middle,lohi}, evenbackground=color, oddbackground=color, evenbackgroundcolor=darkred, oddbackgroundcolor=darkblue, n=17] % for random sudokus
As you might notice, sudokus are just TABLE
's in disguise, but only certain parameters are passed in order to enforce constraints and keep a sudoku in square shape.
If an invalid sudoku or sudoku file is provided, a placeholder with an error message is printed instead. To change message errors, set something like this:
\setupsudoku [placeholdercommand=\inframed, placeholderlabela=First error, placeholderlabelb=Second error, placeholderlabelc=Third error, placeholderlabeld=Number too low]
For actual examples, check t-sudoku.mkvi
.
Download the contents of this package in one zip archive (11.8k).
context-sudoku – Sudokus for ConTeXt
A port of Peter Norvig's sudoku solver to Lua/ConTeXt. It provides four basic commands for typesettings sudokus, as well as a command handler.
Package | context-sudoku |
Repository | https://github.com/JairoAdelRio6/context-sudoku |
Version | 2023-06-03 |
Licenses | MIT License |
Maintainer | Jairo A. del Rio |
Contained in | TeX Live as context-sudoku |
Topics | ConTeXt Games |