|
|
@ -29,12 +29,12 @@ require_once( "../../lib/questionlib.php"); |
|
|
|
/** |
|
|
|
* Plays the game Sudoku |
|
|
|
* |
|
|
|
* @param $id |
|
|
|
* @param $game |
|
|
|
* @param $attempt |
|
|
|
* @param $sudoku |
|
|
|
* @param $endofgame |
|
|
|
* @param $context |
|
|
|
* @param int $id |
|
|
|
* @param stdClass $game |
|
|
|
* @param stdClass $attempt |
|
|
|
* @param stdClass $sudoku |
|
|
|
* @param boolean $endofgame |
|
|
|
* @param stdClass $context |
|
|
|
*/ |
|
|
|
function game_sudoku_continue( $id, $game, $attempt, $sudoku, $endofgame, $context) { |
|
|
|
global $CFG, $DB, $USER; |
|
|
@ -129,13 +129,13 @@ function game_sudoku_continue( $id, $game, $attempt, $sudoku, $endofgame, $conte |
|
|
|
/** |
|
|
|
* Plays the game Sudoku |
|
|
|
* |
|
|
|
* @param $id |
|
|
|
* @param $game |
|
|
|
* @param $attempt |
|
|
|
* @param $sudoku |
|
|
|
* @param $onlyshow |
|
|
|
* @param $showsolution |
|
|
|
* @param $context |
|
|
|
* @param int $id |
|
|
|
* @param stdClass $game |
|
|
|
* @param stdClass $attempt |
|
|
|
* @param stdClass $sudoku |
|
|
|
* @param boolean $onlyshow |
|
|
|
* @param boolean $showsolution |
|
|
|
* @param stdClass $context |
|
|
|
*/ |
|
|
|
function game_sudoku_play( $id, $game, $attempt, $sudoku, $onlyshow, $showsolution, $context) { |
|
|
|
$offsetquestions = game_sudoku_compute_offsetquestions( $game->sourcemodule, $attempt, $numbers, $correctquestions); |
|
|
@ -166,10 +166,10 @@ function game_sudoku_play( $id, $game, $attempt, $sudoku, $onlyshow, $showsoluti |
|
|
|
/** |
|
|
|
* Returns a map with an offset and id of each question. |
|
|
|
* |
|
|
|
* @param $sourcemodule |
|
|
|
* @param $attemp |
|
|
|
* @param $numbers |
|
|
|
* @param $correctquestions |
|
|
|
* @param string $sourcemodule |
|
|
|
* @param stdClass $attempt |
|
|
|
* @param int $numbers |
|
|
|
* @param int $correctquestions |
|
|
|
*/ |
|
|
|
function game_sudoku_compute_offsetquestions( $sourcemodule, $attempt, &$numbers, &$correctquestions) { |
|
|
|
global $CFG, $DB; |
|
|
@ -237,7 +237,7 @@ function getrandomsudoku() { |
|
|
|
/** |
|
|
|
* Get closed |
|
|
|
* |
|
|
|
* @param $data |
|
|
|
* @param string $data |
|
|
|
*/ |
|
|
|
function game_sudoku_getclosed( $data) { |
|
|
|
$a = array(); |
|
|
@ -256,11 +256,15 @@ function game_sudoku_getclosed( $data) { |
|
|
|
/** |
|
|
|
* Shows the sudoku |
|
|
|
* |
|
|
|
* @param $data |
|
|
|
* @param $guess |
|
|
|
* @param string $data |
|
|
|
* @param string $guess |
|
|
|
* @param boolean $bshowlegend |
|
|
|
* @param boolean $bshowsolution |
|
|
|
* @param $offsetquestions |
|
|
|
* @param int $offsetquestions |
|
|
|
* @param int $correctquestions |
|
|
|
* @param int $id |
|
|
|
* @param stdClass $attempt |
|
|
|
* @param stdClass $game |
|
|
|
*/ |
|
|
|
function game_sudoku_showsudoku( $data, $guess, $bshowlegend, $bshowsolution, $offsetquestions, |
|
|
|
$correctquestions, $id, $attempt, $game) { |
|
|
@ -367,7 +371,7 @@ function game_sudoku_showsudoku( $data, $guess, $bshowlegend, $bshowsolution, $o |
|
|
|
/** |
|
|
|
* Get question list |
|
|
|
* |
|
|
|
* @param $offsetquestions |
|
|
|
* @param int $offsetquestions |
|
|
|
*/ |
|
|
|
function game_sudoku_getquestionlist( $offsetquestions) { |
|
|
|
$questionlist = ''; |
|
|
@ -388,10 +392,10 @@ function game_sudoku_getquestionlist( $offsetquestions) { |
|
|
|
/** |
|
|
|
* Get glossary entries |
|
|
|
* |
|
|
|
* @param $game |
|
|
|
* @param $offsetentries |
|
|
|
* @param $entrylist |
|
|
|
* @param $numbers |
|
|
|
* @param stdClass $game |
|
|
|
* @param int $offsetentries |
|
|
|
* @param string $entrylist |
|
|
|
* @param int $numbers |
|
|
|
*/ |
|
|
|
function game_sudoku_getglossaryentries( $game, $offsetentries, &$entrylist, $numbers) { |
|
|
|
global $DB; |
|
|
@ -413,12 +417,12 @@ function game_sudoku_getglossaryentries( $game, $offsetentries, &$entrylist, $nu |
|
|
|
/** |
|
|
|
* Plays the game hangman |
|
|
|
* |
|
|
|
* @param $id |
|
|
|
* @param $game |
|
|
|
* @param $attempt |
|
|
|
* @param $sudoku |
|
|
|
* @param $offsetquestions |
|
|
|
* @param $numbers |
|
|
|
* @param int $id |
|
|
|
* @param stdClass $game |
|
|
|
* @param stdClass $attempt |
|
|
|
* @param stdClass $sudoku |
|
|
|
* @param int $offsetquestions |
|
|
|
* @param string $numbers |
|
|
|
*/ |
|
|
|
function game_sudoku_showquestions_quiz( $id, $game, $attempt, $sudoku, $offsetquestions, $numbers, |
|
|
|
$correctquestions, $onlyshow, $showsolution, $context) { |
|
|
@ -492,12 +496,12 @@ function game_sudoku_showquestions_quiz( $id, $game, $attempt, $sudoku, $offsetq |
|
|
|
/** |
|
|
|
* Show the sudoku and glossaryentries. |
|
|
|
* |
|
|
|
* @param $id |
|
|
|
* @param $game |
|
|
|
* @param $attempt |
|
|
|
* @param $sudoku |
|
|
|
* @param $offsetentries |
|
|
|
* @param $numbers |
|
|
|
* @param int $id |
|
|
|
* @param string $game |
|
|
|
* @param stdClass $attempt |
|
|
|
* @param stdClass $sudoku |
|
|
|
* @param int $offsetentries |
|
|
|
* @param int $numbers |
|
|
|
*/ |
|
|
|
function game_sudoku_showquestions_glossary( $id, $game, $attempt, $sudoku, $offsetentries, $numbers, |
|
|
|
$correctentries, $onlyshow, $showsolution) { |
|
|
@ -576,10 +580,10 @@ function game_sudoku_showquestions_glossary( $id, $game, $attempt, $sudoku, $off |
|
|
|
/** |
|
|
|
* Show question onfinish |
|
|
|
* |
|
|
|
* @param $id |
|
|
|
* @param $game |
|
|
|
* @param $attempt |
|
|
|
* @param $sudoku |
|
|
|
* @param int $id |
|
|
|
* @param stdClass $game |
|
|
|
* @param stdClass $attempt |
|
|
|
* @param stdClass $sudoku |
|
|
|
*/ |
|
|
|
function game_sudoku_showquestion_onfinish( $id, $game, $attempt, $sudoku) { |
|
|
|
if (!set_field( 'game_attempts', 'finish', 1, 'id', $attempt->id)) { |
|
|
@ -605,12 +609,12 @@ function game_sudoku_checkanswers() { |
|
|
|
/** |
|
|
|
* Checks questions |
|
|
|
* |
|
|
|
* @param $id |
|
|
|
* @param $game |
|
|
|
* @param $attempt |
|
|
|
* @param $sudoku |
|
|
|
* @param $finishattempt |
|
|
|
* @param $course |
|
|
|
* @param int $id |
|
|
|
* @param stdClass $game |
|
|
|
* @param stdClass $attempt |
|
|
|
* @param stdClass $sudoku |
|
|
|
* @param boolean $finishattempt |
|
|
|
* @param stdClass $course |
|
|
|
*/ |
|
|
|
function game_sudoku_check_questions( $id, $game, $attempt, $sudoku, $finishattempt, $course) { |
|
|
|
global $DB; |
|
|
@ -654,12 +658,12 @@ function game_sudoku_check_questions( $id, $game, $attempt, $sudoku, $finishatte |
|
|
|
/** |
|
|
|
* Check glossary entries |
|
|
|
* |
|
|
|
* @param $id |
|
|
|
* @param $game |
|
|
|
* @param $attempt |
|
|
|
* @param $sudoku |
|
|
|
* @param $finishattempt |
|
|
|
* @param $course |
|
|
|
* @param int $id |
|
|
|
* @param stdClass $game |
|
|
|
* @param stdClass $attempt |
|
|
|
* @param stdClass $sudoku |
|
|
|
* @param boolean $finishattempt |
|
|
|
* @param string $course |
|
|
|
*/ |
|
|
|
function game_sudoku_check_glossaryentries( $id, $game, $attempt, $sudoku, $finishattempt, $course) { |
|
|
|
global $DB; |
|
|
@ -734,12 +738,12 @@ function game_sudoku_check_last( $id, $game, $attempt, $sudoku, $finishattempt, |
|
|
|
/** |
|
|
|
* Check number |
|
|
|
* |
|
|
|
* @param $id |
|
|
|
* @param $game |
|
|
|
* @param $attempt |
|
|
|
* @param $sudoku |
|
|
|
* @param $pos |
|
|
|
* @param $num |
|
|
|
* @param int $id |
|
|
|
* @param stdClass $game |
|
|
|
* @param stdClass $attempt |
|
|
|
* @param stdClass $sudoku |
|
|
|
* @param int $pos |
|
|
|
* @param int $num |
|
|
|
* @param stdClass $context |
|
|
|
*/ |
|
|
|
function game_sudoku_check_number( $id, $game, $attempt, $sudoku, $pos, $num, $context) { |
|
|
|