Download the PHP package abcaeffchen/sudoku-php without Composer
On this page you can find all versions of the php package abcaeffchen/sudoku-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download abcaeffchen/sudoku-php
More information about abcaeffchen/sudoku-php
Files in abcaeffchen/sudoku-php
Package sudoku-php
Short Description Generate random Sudokus of different size and difficulty and check the solution.
License LGPL-3.0-only
Informations about the package sudoku-php
sudoku-php
Genral
Generate random Sudokus of different size and difficulty and check the solution. Features:
- Choose from the following sizes: 4, 9, 16, 25, 36.
- Choose from fife degrees of difficulty.
- Sudokus are reproducible via a integer seed.
- Check if a input is a solution of any Sudoku or a solution to a specific task.
- Solve Sudokus.
- works with PHP 7.4 up to 8.2 (maybe also work with PHP < 7.4, but these versions are not supported anymore)
- backend only, so you can build your own frontend however you like it.
Installation
You can install this via composer using
or just download the Sudoku.php
file and include it to your project.
Make sure to use the namespace AbcAeffchen\sudoku
.
How to use
Generate a task
Generates a standard 9x9 Sudoku with normal difficulty. You can use the difficulties
VERY_EASY
, EASY
, NORMAL
, MEDIUM
, HARD
.
$task
contains a two dimensional array of integers, where the gaps are set to null
.
You can use
to generate a task and a possible solution. Maybe to give hints?
You can reproduce the Sudoku by providing a seed.
This way cou could store a seed seed and reproduce the task at any time.
The seed can be any positive integer.
Check a solution
You can check a solution by using
If you also want to also check if the solution relates to the task, you can just also provide the task like this:
Solve Sudokus
This function is used to generate the Sudokus, but you can also use it to solve some you generated by hand (or get it from somewhere else).
You only have to make sure, that $task
is a two dimensional int array containing only numbers
from 1 to the size and all gaps contain null
.
License
Licensed under the LGPL v3.0 License.