PHP code example of chipulaja / algo-backtrack-sudoku

1. Go to this page and download the library: Download chipulaja/algo-backtrack-sudoku library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

chipulaja / algo-backtrack-sudoku example snippets


use Chipulaja\Algo\Backtrack\Sudoku\SudokuSolverCara1;

$data = [
    [0,2,0,  0,1,3,  0,6,0],
    [0,0,5,  6,0,0,  3,4,0],
    [0,0,0,  0,0,0,  0,0,0],

    [1,0,2,  0,7,0,  0,8,5],
    [0,9,0,  0,0,2,  0,0,0],
    [7,0,0,  0,3,0,  0,0,0],

    [0,0,0,  3,0,5,  9,0,0],
    [0,0,0,  0,2,0,  0,5,1],
    [0,0,0,  8,0,0,  0,7,0]
];

$solver = new SudokuSolverCara1();
$solver->tryToSolve($data);
$answerBoard = $solver->getAnswerBoard();