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