/** * suggestion item * @param string $size * @param string $matrix * @param string $matrix_origin */ public static function hwdoku_suggest_item($size, $matrix, $matrix_origin) { #$size = self::getSize(); //get sudoku size $i = $_GET['i']; $j = $_GET['j']; $matrix_origin = unserialize($matrix_origin); $matrix = unserialize($matrix); //compare with matrix original to get item $game1 = new HQ_Sudoku($size); $game1->grid = $matrix_origin; #var_dump($matrix_origin); $item_value = $game1->get_item($i, $j); echo $i . '-' . $j . '=>' . $item_value; $game1->grid = $matrix; $game1->set_item($i, $j, $item_value); $done = $game1->is_full_matrix() ? '*[DONE]' : ''; echo '<textarea>' . $item_value . '*' . $game1->matrix_string() . $done . '</textarea>'; }
<script> <?php if (isset($game)) { ?> var hw_game = new HW_Sudoku({ 'enabled_valid' : <?php echo (int) $auto_check; ?> , 'win_msg' : '<?php _e('Congratulation, You are win ! ^_^', 'hwdoku'); ?> ', 'fail_msg' : '<?php _e('Fail Game.', 'hwdoku'); ?> ', 'matrix_data' : "<?php echo $game->matrix_string(); ?> ", 'size' : <?php echo $size; ?> }); <?php } ?> </script>