3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SudokuGenerator extends SudokuSolver { public $EleArray = NULL; const METRIC_EASY = 27; const METRIC_MEDIUM = 22; const METRIC_HARD = 17; public function __construct() { $this->EleArray(); parent::__construct(); } /* Creates an array of possible (row, col) combinations. So that uniquely a random elemnt can be selected */ public function EleArray() { $EleArray = array(); foreach(range(0, 8) as $i ) foreach(range(0, 8) as $j ) $EleArray[] = array($i, $j); $this->EleArray = $EleArray; } public function FillRandomValue() { if( $this->EleArray === NULL ) throw new Exception('$this->EleArray() must be called before FillRandomValue', 1); $ele = array_rand( $this->EleArray ); $randCol = $this->EleArray[$ele][0]; $randRow = $this->EleArray[$ele][1]; unset($this->EleArray[$ele]); for ( $i = 1; $i <= 9; $i++ ) { if( $this->checkValid($randRow, $randCol, $i) ) { $this->_oSudoku[$randRow][$randCol] = $i; break; } } } public function GenerateSudoku( $difficulty ) { $this->EleArray(); for( $i = 0; $i < $difficulty; $i++ ) $this->FillRandomValue(); do { $this->FillRandomValue(); $this->Solve(); } while( $this->HasUnique() === self::NOT_UNIQUE ); } } class SudokuSolver { protected $_iSudoku = array(); protected $_oSudoku = array(); protected $_stack; protected $_blocks; protected $_oSudoku90; protected $_compare; const NOT_SOLVABLE = 10; const NOT_UNIQUE = 11; public function __construct( $sudoku = NULL, $stack = NULL, $seedVal = 0 ) { $this->seedVal = $seedVal; if ( $stack === NULL ) $this->_stack = new Stack(); else $this->_stack = $stack; if ( $sudoku === NULL ) $sudoku = str_repeat( "0", 81 ); /** Creates an sudoku array from the supplied string or empty string */ if ( is_string( $sudoku ) ): $sudoku = str_split( $sudoku, 9 ); array_walk( $sudoku, function( &$arg ) { $arg = str_split( $arg ); } ); endif; $this->_iSudoku = $this->_oSudoku = $sudoku; $this->_compare = range(1, 9); $this->_constuctBlock(); } // Constructs block of 3 x 3 array, and row wise block that can later be used for direct // finding of possibles instead of looping protected function _constuctBlock() { for ( $x = 0; $x < 9; $x++ ) { $this->_oSudoku90[$x] = array(); for ( $y = 0; $y < 9; $y++ ) { $this->_oSudoku90[$x][$y] = &$this->_oSudoku[$y][$x]; } } // create '_blocks' for ( $blockX = 0; $blockX < 3; $blockX++ ) { $this->_blocks[$blockX] = array(); for ( $blockY = 0; $blockY < 3; $blockY++ ) { $this->_blocks[$blockX][$blockY] = array(); $gridX = $blockX * 3; for ( $cellX = 0; $cellX < 3; $cellX++ ) { $gridY = $blockY * 3; for ( $cellY = 0; $cellY <3; $cellY++ ) { $this->_blocks[$blockX][$blockY][] = &$this->_oSudoku[$gridX][$gridY++]; } $gridX++; } } } } /** The following functions find the possibles for column, row and 3 x 3 block */ public function missingColumn($m) { return array_diff($this->_compare, $this->_oSudoku[$m]); } public function missingRow($n) { return array_diff($this->_compare, $this->_oSudoku90[$n]); } public function missingBlock($m,$n) { return array_diff($this->_compare, $this->_blocks[$m][$n]); } /* An intersect of all the possibles finds the possibles obeying rules of sudoku */ public function possibles( $m, $n ) { return array_intersect( $this->missingBlock((int)$m / 3, (int)$n / 3), $this->missingColumn($m), $this->missingRow($n) ); } public function checkValid( $m, $n, $val ) { return in_array( $val, array_intersect( $this->missingBlock((int)$m / 3, (int)$n / 3), $this->missingColumn($m), $this->missingRow($n) )); } /** * Function checks if the sudoku has a unique solution */ public function HasUnique() { while ( !$this->_stack->isEmpty() ) { $stack = new Stack(); $oldSudoku = &$this->_oSudoku; list( $m, $n ) = $this->_stack->pop(); $val = $oldSudoku[$m][$n]; $oldSudoku[$m][$n] = 0; $sudoku = new SudokuSolver( $oldSudoku, $stack, $val ); if ( $sudoku->Solve() !== self::NOT_SOLVABLE ) return self::NOT_UNIQUE; } return TRUE; } public function Solve() { $m = $n = 0; fx: while ( $m !== 9 ): //Loop till 9 x 9 sudoku processed if ( ( (int)( $cell = &$this->_oSudoku[$m][$n] ) === 0 ) ) { foreach ( $this->possibles($m, $n) as $val) { $this->seedVal = 0; //If cell's value was less than value of $val means insertion //must be done otherwise it means it has returned from backtracking if( $cell < $val ) $cell = $val; else continue; $this->_stack->push( $m, $n ); //Record the insertion if ( $n === 8 ): $m += 1; $n = 0; else: $n += 1; endif; goto fx; ///if insertion was valid continue while } $this->_oSudoku[$m][$n] = 0; if ( $this->_stack->isEmpty() ) //If backtracked till begining return NOT SOLVABLE return self::NOT_SOLVABLE; else list( $m, $n ) = $this->_stack->pop(); //backtrack } else { if ( $n === 8 ): $m += 1; $n = 0; else: $n += 1; endif; } endwhile; } public function OutputArray() { return $this->_oSudoku; } public function OutputString() { array_walk( $this->_oSudoku, function( &$ele ) { $ele = implode( "", $ele ); } ); return implode( "", $this->_oSudoku ); } public function __toString() { return print_r( $this->_oSudoku, true ); } } class Stack { private $stk = array(); public function push($m, $n) { array_push( $this->stk, array($m, $n) ); } public function pop() { return array_pop($this->stk); } public function isEmpty() { return count($this->stk) === 0; } public function stackHeight() { return count( $this->stk ); } public function emptyStack() { while( !$this->isEmpty() ) $this->pop(); } } $sudoku = new SudokuGenerator(); $sudoku->GenerateSudoku( SudokuGenerator::METRIC_EASY ); $sudoku2 = new SudokuSolver($sudoku->OutputString()); $sudoku2->Solve(); print $sudoku2->OutputString();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SGBhH
function name:  (null)
number of ops:  21
compiled vars:  !0 = $sudoku, !1 = $sudoku2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'sudokugenerator', 'sudokusolver'
   55     1        DECLARE_CLASS                                            'sudokusolver'
  225     2        NEW                                              $2      'SudokuGenerator'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
  226     5        INIT_METHOD_CALL                                         !0, 'GenerateSudoku'
          6        FETCH_CLASS_CONSTANT                             ~5      'SudokuGenerator', 'METRIC_EASY'
          7        SEND_VAL_EX                                              ~5
          8        DO_FCALL                                      0          
  228     9        NEW                                              $7      'SudokuSolver'
         10        INIT_METHOD_CALL                                         !0, 'OutputString'
         11        DO_FCALL                                      0  $8      
         12        SEND_VAR_NO_REF_EX                                       $8
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !1, $7
  229    15        INIT_METHOD_CALL                                         !1, 'Solve'
         16        DO_FCALL                                      0          
  231    17        INIT_METHOD_CALL                                         !1, 'OutputString'
         18        DO_FCALL                                      0  $12     
         19        ECHO                                                     $12
         20      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FSGBhH%3A76%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SGBhH
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $arg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   76     0  E >   RECV                                             !0      
   77     1        INIT_FCALL                                               'str_split'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4        ASSIGN                                                   !0, $1
   78     5      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FSGBhH%3A76%241

Function %00%7Bclosure%7D%2Fin%2FSGBhH%3A194%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SGBhH
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $ele
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  194     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'implode'
          2        SEND_VAL                                                 ''
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5        ASSIGN                                                   !0, $1
          6      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FSGBhH%3A194%242

Class SudokuGenerator:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SGBhH
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_METHOD_CALL                                         'EleArray'
          1        DO_FCALL                                      0          
   12     2        INIT_STATIC_METHOD_CALL                                  
          3        DO_FCALL                                      0          
   13     4      > RETURN                                                   null

End of function __construct

Function elearray:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 20
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 20
Branch analysis from position: 7
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 18
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 18
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 18
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/SGBhH
function name:  EleArray
number of ops:  24
compiled vars:  !0 = $EleArray, !1 = $i, !2 = $j
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   ASSIGN                                                   !0, <array>
   20     1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 0
          3        SEND_VAL                                                 8
          4        DO_ICALL                                         $4      
          5      > FE_RESET_R                                       $5      $4, ->20
          6    > > FE_FETCH_R                                               $5, !1, ->20
   21     7    >   INIT_FCALL                                               'range'
          8        SEND_VAL                                                 0
          9        SEND_VAL                                                 8
         10        DO_ICALL                                         $6      
         11      > FE_RESET_R                                       $7      $6, ->18
         12    > > FE_FETCH_R                                               $7, !2, ->18
   22    13    >   INIT_ARRAY                                       ~9      !1
         14        ADD_ARRAY_ELEMENT                                ~9      !2
         15        ASSIGN_DIM                                               !0
         16        OP_DATA                                                  ~9
   21    17      > JMP                                                      ->12
         18    >   FE_FREE                                                  $7
   20    19      > JMP                                                      ->6
         20    >   FE_FREE                                                  $5
   23    21        ASSIGN_OBJ                                               'EleArray'
         22        OP_DATA                                                  !0
   24    23      > RETURN                                                   null

End of function elearray

Function fillrandomvalue:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 25
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 36
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 25
Branch analysis from position: 39
Branch analysis from position: 25
filename:       /in/SGBhH
function name:  FillRandomValue
number of ops:  40
compiled vars:  !0 = $ele, !1 = $randCol, !2 = $randRow, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   FETCH_OBJ_R                                      ~4      'EleArray'
          1        TYPE_CHECK                                    2          ~4
          2      > JMPZ                                                     ~5, ->8
   28     3    >   NEW                                              $6      'Exception'
          4        SEND_VAL_EX                                              '%24this-%3EEleArray%28%29+must+be+called+before+FillRandomValue'
          5        SEND_VAL_EX                                              1
          6        DO_FCALL                                      0          
          7      > THROW                                         0          $6
   30     8    >   INIT_FCALL                                               'array_rand'
          9        FETCH_OBJ_R                                      ~8      'EleArray'
         10        SEND_VAL                                                 ~8
         11        DO_ICALL                                         $9      
         12        ASSIGN                                                   !0, $9
   31    13        FETCH_OBJ_R                                      ~11     'EleArray'
         14        FETCH_DIM_R                                      ~12     ~11, !0
         15        FETCH_DIM_R                                      ~13     ~12, 0
         16        ASSIGN                                                   !1, ~13
   32    17        FETCH_OBJ_R                                      ~15     'EleArray'
         18        FETCH_DIM_R                                      ~16     ~15, !0
         19        FETCH_DIM_R                                      ~17     ~16, 1
         20        ASSIGN                                                   !2, ~17
   33    21        FETCH_OBJ_UNSET                                  $19     'EleArray'
         22        UNSET_DIM                                                $19, !0
   34    23        ASSIGN                                                   !3, 1
         24      > JMP                                                      ->37
   36    25    >   INIT_METHOD_CALL                                         'checkValid'
         26        SEND_VAR_EX                                              !2
         27        SEND_VAR_EX                                              !1
         28        SEND_VAR_EX                                              !3
         29        DO_FCALL                                      0  $21     
         30      > JMPZ                                                     $21, ->36
   38    31    >   FETCH_OBJ_W                                      $22     '_oSudoku'
         32        FETCH_DIM_W                                      $23     $22, !2
         33        ASSIGN_DIM                                               $23, !1
         34        OP_DATA                                                  !3
   39    35      > JMP                                                      ->39
   34    36    >   PRE_INC                                                  !3
         37    >   IS_SMALLER_OR_EQUAL                                      !3, 9
         38      > JMPNZ                                                    ~26, ->25
   42    39    > > RETURN                                                   null

End of function fillrandomvalue

Function generatesudoku:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 5
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 10
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 5
Branch analysis from position: 10
Branch analysis from position: 5
filename:       /in/SGBhH
function name:  GenerateSudoku
number of ops:  20
compiled vars:  !0 = $difficulty, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   43     0  E >   RECV                                             !0      
   45     1        INIT_METHOD_CALL                                         'EleArray'
          2        DO_FCALL                                      0          
   46     3        ASSIGN                                                   !1, 0
          4      > JMP                                                      ->8
   47     5    >   INIT_METHOD_CALL                                         'FillRandomValue'
          6        DO_FCALL                                      0          
   46     7        PRE_INC                                                  !1
          8    >   IS_SMALLER                                               !1, !0
          9      > JMPNZ                                                    ~6, ->5
   49    10    >   INIT_METHOD_CALL                                         'FillRandomValue'
         11        DO_FCALL                                      0          
   50    12        INIT_METHOD_CALL                                         'Solve'
         13        DO_FCALL                                      0          
   51    14        INIT_METHOD_CALL                                         'HasUnique'
         15        DO_FCALL                                      0  $9      
         16        FETCH_CLASS_CONSTANT                             ~10     'NOT_UNIQUE'
         17        IS_IDENTICAL                                             $9, ~10
         18      > JMPNZ                                                    ~11, ->10
   52    19    > > RETURN                                                   null

End of function generatesudoku

End of class SudokuGenerator.

Class SudokuSolver:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 21
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 33
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
Branch analysis from position: 21
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 21
Branch analysis from position: 16
Branch analysis from position: 21
filename:       /in/SGBhH
function name:  __construct
number of ops:  46
compiled vars:  !0 = $sudoku, !1 = $stack, !2 = $seedVal
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   64     0  E >   RECV_INIT                                        !0      null
          1        RECV_INIT                                        !1      null
          2        RECV_INIT                                        !2      0
   65     3        ASSIGN_OBJ                                               'seedVal'
          4        OP_DATA                                                  !2
   66     5        TYPE_CHECK                                    2          !1
          6      > JMPZ                                                     ~4, ->12
   67     7    >   NEW                                              $6      'Stack'
          8        DO_FCALL                                      0          
          9        ASSIGN_OBJ                                               '_stack'
         10        OP_DATA                                                  $6
         11      > JMP                                                      ->14
   69    12    >   ASSIGN_OBJ                                               '_stack'
         13        OP_DATA                                                  !1
   70    14    >   TYPE_CHECK                                    2          !0
         15      > JMPZ                                                     ~9, ->21
   71    16    >   INIT_FCALL                                               'str_repeat'
         17        SEND_VAL                                                 '0'
         18        SEND_VAL                                                 81
         19        DO_ICALL                                         $10     
         20        ASSIGN                                                   !0, $10
   74    21    >   TYPE_CHECK                                   64          !0
         22      > JMPZ                                                     ~12, ->33
   75    23    >   INIT_FCALL                                               'str_split'
         24        SEND_VAR                                                 !0
         25        SEND_VAL                                                 9
         26        DO_ICALL                                         $13     
         27        ASSIGN                                                   !0, $13
   76    28        INIT_FCALL                                               'array_walk'
         29        SEND_REF                                                 !0
         30        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FSGBhH%3A76%241'
   78    31        SEND_VAL                                                 ~15
         32        DO_ICALL                                                 
   80    33    >   ASSIGN_OBJ                                       ~18     '_oSudoku'
         34        OP_DATA                                                  !0
         35        ASSIGN_OBJ                                               '_iSudoku'
         36        OP_DATA                                                  ~18
   81    37        INIT_FCALL                                               'range'
         38        SEND_VAL                                                 1
         39        SEND_VAL                                                 9
         40        DO_ICALL                                         $20     
         41        ASSIGN_OBJ                                               '_compare'
         42        OP_DATA                                                  $20
   82    43        INIT_METHOD_CALL                                         '_constuctBlock'
         44        DO_FCALL                                      0          
   83    45      > RETURN                                                   null

End of function __construct

Function _constuctblock:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 2
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 61
Branch analysis from position: 61
2 jumps found. (Code = 44) Position 1 = 63, Position 2 = 23
Branch analysis from position: 63
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 28
Branch analysis from position: 60
2 jumps found. (Code = 44) Position 1 = 63, Position 2 = 23
Branch analysis from position: 63
Branch analysis from position: 23
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 55
Branch analysis from position: 55
2 jumps found. (Code = 44) Position 1 = 57, Position 2 = 36
Branch analysis from position: 57
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 28
Branch analysis from position: 60
Branch analysis from position: 28
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 40
Branch analysis from position: 53
2 jumps found. (Code = 44) Position 1 = 57, Position 2 = 36
Branch analysis from position: 57
Branch analysis from position: 36
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 40
Branch analysis from position: 53
Branch analysis from position: 40
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 7
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 2
Branch analysis from position: 21
Branch analysis from position: 2
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 7
Branch analysis from position: 18
Branch analysis from position: 7
filename:       /in/SGBhH
function name:  _constuctBlock
number of ops:  64
compiled vars:  !0 = $x, !1 = $y, !2 = $blockX, !3 = $blockY, !4 = $gridX, !5 = $cellX, !6 = $gridY, !7 = $cellY
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   87     0  E >   ASSIGN                                                   !0, 0
          1      > JMP                                                      ->19
   88     2    >   FETCH_OBJ_W                                      $9      '_oSudoku90'
          3        ASSIGN_DIM                                               $9, !0
          4        OP_DATA                                                  <array>
   89     5        ASSIGN                                                   !1, 0
          6      > JMP                                                      ->16
   90     7    >   FETCH_OBJ_W                                      $15     '_oSudoku'
          8        FETCH_DIM_W                                      $16     $15, !1
          9        FETCH_DIM_W                                      $17     $16, !0
         10        MAKE_REF                                         $18     $17
         11        FETCH_OBJ_W                                      $12     '_oSudoku90'
         12        FETCH_DIM_W                                      $13     $12, !0
         13        FETCH_DIM_W                                      $14     $13, !1
         14        ASSIGN_REF                                               $14, $18
   89    15        PRE_INC                                                  !1
         16    >   IS_SMALLER                                               !1, 9
         17      > JMPNZ                                                    ~21, ->7
   87    18    >   PRE_INC                                                  !0
         19    >   IS_SMALLER                                               !0, 9
         20      > JMPNZ                                                    ~23, ->2
   94    21    >   ASSIGN                                                   !2, 0
         22      > JMP                                                      ->61
   95    23    >   FETCH_OBJ_W                                      $25     '_blocks'
         24        ASSIGN_DIM                                               $25, !2
         25        OP_DATA                                                  <array>
   96    26        ASSIGN                                                   !3, 0
         27      > JMP                                                      ->58
   97    28    >   FETCH_OBJ_W                                      $28     '_blocks'
         29        FETCH_DIM_W                                      $29     $28, !2
         30        ASSIGN_DIM                                               $29, !3
         31        OP_DATA                                                  <array>
   98    32        MUL                                              ~31     !2, 3
         33        ASSIGN                                                   !4, ~31
   99    34        ASSIGN                                                   !5, 0
         35      > JMP                                                      ->55
  100    36    >   MUL                                              ~34     !3, 3
         37        ASSIGN                                                   !6, ~34
  101    38        ASSIGN                                                   !7, 0
         39      > JMP                                                      ->51
  102    40    >   POST_INC                                         ~43     !6
         41        FETCH_OBJ_W                                      $41     '_oSudoku'
         42        FETCH_DIM_W                                      $42     $41, !4
         43        FETCH_DIM_W                                      $44     $42, ~43
         44        MAKE_REF                                         $45     $44
         45        FETCH_OBJ_W                                      $37     '_blocks'
         46        FETCH_DIM_W                                      $38     $37, !2
         47        FETCH_DIM_W                                      $39     $38, !3
         48        FETCH_DIM_W                                      $40     $39
         49        ASSIGN_REF                                               $40, $45
  101    50        PRE_INC                                                  !7
         51    >   IS_SMALLER                                               !7, 3
         52      > JMPNZ                                                    ~48, ->40
  104    53    >   PRE_INC                                                  !4
   99    54        PRE_INC                                                  !5
         55    >   IS_SMALLER                                               !5, 3
         56      > JMPNZ                                                    ~51, ->36
   96    57    >   PRE_INC                                                  !3
         58    >   IS_SMALLER                                               !3, 3
         59      > JMPNZ                                                    ~53, ->28
   94    60    >   PRE_INC                                                  !2
         61    >   IS_SMALLER                                               !2, 3
         62      > JMPNZ                                                    ~55, ->23
  108    63    > > RETURN                                                   null

End of function _constuctblock

Function missingcolumn:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SGBhH
function name:  missingColumn
number of ops:  10
compiled vars:  !0 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  110     0  E >   RECV                                             !0      
  111     1        INIT_FCALL                                               'array_diff'
          2        FETCH_OBJ_R                                      ~1      '_compare'
          3        SEND_VAL                                                 ~1
          4        FETCH_OBJ_R                                      ~2      '_oSudoku'
          5        FETCH_DIM_R                                      ~3      ~2, !0
          6        SEND_VAL                                                 ~3
          7        DO_ICALL                                         $4      
          8      > RETURN                                                   $4
  112     9*     > RETURN                                                   null

End of function missingcolumn

Function missingrow:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SGBhH
function name:  missingRow
number of ops:  10
compiled vars:  !0 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  114     0  E >   RECV                                             !0      
  115     1        INIT_FCALL                                               'array_diff'
          2        FETCH_OBJ_R                                      ~1      '_compare'
          3        SEND_VAL                                                 ~1
          4        FETCH_OBJ_R                                      ~2      '_oSudoku90'
          5        FETCH_DIM_R                                      ~3      ~2, !0
          6        SEND_VAL                                                 ~3
          7        DO_ICALL                                         $4      
          8      > RETURN                                                   $4
  116     9*     > RETURN                                                   null

End of function missingrow

Function missingblock:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SGBhH
function name:  missingBlock
number of ops:  12
compiled vars:  !0 = $m, !1 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  118     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  119     2        INIT_FCALL                                               'array_diff'
          3        FETCH_OBJ_R                                      ~2      '_compare'
          4        SEND_VAL                                                 ~2
          5        FETCH_OBJ_R                                      ~3      '_blocks'
          6        FETCH_DIM_R                                      ~4      ~3, !0
          7        FETCH_DIM_R                                      ~5      ~4, !1
          8        SEND_VAL                                                 ~5
          9        DO_ICALL                                         $6      
         10      > RETURN                                                   $6
  120    11*     > RETURN                                                   null

End of function missingblock

Function possibles:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SGBhH
function name:  possibles
number of ops:  23
compiled vars:  !0 = $m, !1 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  123     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  124     2        INIT_FCALL                                               'array_intersect'
  125     3        INIT_METHOD_CALL                                         'missingBlock'
          4        CAST                                          4  ~2      !0
          5        DIV                                              ~3      ~2, 3
          6        SEND_VAL_EX                                              ~3
          7        CAST                                          4  ~4      !1
          8        DIV                         

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.19 ms | 1428 KiB | 29 Q