Browse Source

Fix:Coding style

MOODLE_20_STABLE
Vasilis Daloukas 9 years ago
parent
commit
593362a22e
  1. 8
      cross/cross_class.php
  2. 4
      cross/crossdb_class.php
  3. 4
      cross/play.php
  4. 2
      cryptex/play.php
  5. 15
      db/importsudoku.php
  6. 2
      hiddenpicture/picture.php
  7. 1
      hiddenpicture/play.php
  8. 8
      locallib.php
  9. 2
      millionaire/play.php
  10. 2
      snakes/play.php
  11. 30
      sudoku/class.Sudoku.php
  12. 7
      sudoku/play.php

8
cross/cross_class.php

@ -96,8 +96,8 @@ class Cross
$this->mn20min = $this->mn20max; $this->mn20min = $this->mn20max;
} }
$this->m_words = array(); $this->mwords = array();
foreach ($this->m_input_answers as $word => $answer) { foreach ($this->minputanswers as $word => $answer) {
$len = game_strlen( $word); $len = game_strlen( $word);
if ($len <= $this->mn20max) { if ($len <= $this->mn20max) {
@ -218,7 +218,7 @@ class Cross
if ($score > $this->mbestscore) { if ($score > $this->mbestscore) {
$this->mbestcrosspos = $crosspos; $this->mbestcrosspos = $crosspos;
$this->m_best_cross_dir = $crossdir; $this->mbestcrossdir = $crossdir;
$this->mbestcrossword = $crossword; $this->mbestcrossword = $crossword;
$this->mbestpuzzle = $puzzle; $this->mbestpuzzle = $puzzle;
@ -622,7 +622,7 @@ class Cross
$ssolutions = ''; $ssolutions = '';
$shtmlsolutions = ''; $shtmlsolutions = '';
$swordx = ""; $swordx = "";
$ssordy = ""; $swordy = "";
$sclue = ""; $sclue = "";
$lasthorizontalword = -1; $lasthorizontalword = -1;
$i = -1; $i = -1;

4
cross/crossdb_class.php

@ -85,12 +85,12 @@ class CrossDB extends Cross {
$this->mmaxrow = $crossrec->rows; $this->mmaxrow = $crossrec->rows;
if ($g == "") { if ($g == "") {
$g = str_repeat( ' ', $this->m_maxcol * $this->m_maxrow); $g = str_repeat( ' ', $this->mmaxcol * $this->mmaxrow);
} }
$load = false; $load = false;
$puzzle = str_repeat('.', $this->m_maxrow * $this->m_maxcol); $puzzle = str_repeat('.', $this->mmaxrow * $this->mmaxcol);
if ($recs = $DB->get_records( 'game_queries', array( 'attemptid' => $crossrec->id))) { if ($recs = $DB->get_records( 'game_queries', array( 'attemptid' => $crossrec->id))) {
$a = array(); $a = array();
foreach ($recs as $rec) { foreach ($recs as $rec) {

4
cross/play.php

@ -1146,7 +1146,7 @@ function game_cross_show_welcome1() {
function game_cross_show_legends( $cross) { function game_cross_show_legends( $cross) {
echo '<td>'; echo '<td>';
ShowLegend( $cross->m_LegendH, get_string( 'cross_across', 'game')); ShowLegend( $cross->mlegendh, get_string( 'cross_across', 'game'));
ShowLegend( $cross->m_LegendV, get_string( 'cross_down', 'game')); ShowLegend( $cross->mlegendv, get_string( 'cross_down', 'game'));
echo '</td>'; echo '</td>';
} }

2
cryptex/play.php

@ -32,7 +32,7 @@ function game_cryptex_continue( $id, $game, $attempt, $cryptexrec, $endofgame, $
$endofgame = false; $endofgame = false;
} }
if $attempt != false and $cryptexrec != false) { if( $attempt != false and $cryptexrec != false) {
$crossm = $DB->get_record( 'game_cross', array( 'id' => $attempt->id)); $crossm = $DB->get_record( 'game_cross', array( 'id' => $attempt->id));
return game_cryptex_play( $id, $game, $attempt, $cryptexrec, $crossm, false, false, false, $context); return game_cryptex_play( $id, $game, $attempt, $cryptexrec, $crossm, false, false, false, $context);
} }

15
db/importsudoku.php

@ -213,7 +213,7 @@ $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (
"'IEB14368GG34H56A298F17IB354375819DB69FB47E38114HF2C9752317FH59D5IG2D361H486E19BCG')"); "'IEB14368GG34H56A298F17IB354375819DB69FB47E38114HF2C9752317FH59D5IG2D361H486E19BCG')");
$DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 24,". $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 24,".
"'938FBG541AD6895732257143HI6472385A6IFHC971524519FBD378BE37I681D469218C5G7HA43E962')"); "'938FBG541AD6895732257143HI6472385A6IFHC971524519FBD378BE37I681D469218C5G7HA43E962')");
$DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 26," $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 26,".
"'36I8EA27D451B7CI8FHB79461537B81954C6534F2G1986IA43827E982F13E473A57DB8F9G6D5H9312')"); "'36I8EA27D451B7CI8FHB79461537B81954C6534F2G1986IA43827E982F13E473A57DB8F9G6D5H9312')");
$DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 28,". $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 28,".
"'DAB73865978645I12C395A26G84IB4E67C8AE37H12I6461H4CI57BB4E89C17F3916G52D88F72D19E3')"); "'DAB73865978645I12C395A26G84IB4E67C8AE37H12I6461H4CI57BB4E89C17F3916G52D88F72D19E3')");
@ -289,7 +289,7 @@ $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (
$DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 25,". $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 25,".
"'12E784I3FD89C62G51F3G951B84B6GD9351851482F97C8I31G54F23D2HE96716I51D7B3871H32654I')"); "'12E784I3FD89C62G51F3G951B84B6GD9351851482F97C8I31G54F23D2HE96716I51D7B3871H32654I')");
$DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 27," $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 27,".
"'163I48EG29ED2671H3278CEA4I6HE46C921773A528DIFIF27A483532A496785H75312FDI649E8G123')"); "'163I48EG29ED2671H3278CEA4I6HE46C921773A528DIFIF27A483532A496785H75312FDI649E8G123')");
$DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 31,". $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 31,".
"'67C1B5IDH248GF93A5IEA3DH276DIB816E376715BC894583794FA2BFA78I354D57A32I8F83946E12G')"); "'67C1B5IDH248GF93A5IEA3DH276DIB816E376715BC894583794FA2BFA78I354D57A32I8F83946E12G')");
@ -303,7 +303,7 @@ $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (
"'I17528D634C8IGF21E5624A37H92E13968G4347H5A692F98274C5114B73E68I5F9AHDG2383G92F14E')"); "'I17528D634C8IGF21E5624A37H92E13968G4347H5A692F98274C5114B73E68I5F9AHDG2383G92F14E')");
$DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 25,". $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 25,".
"'463I81B5G97H42E61CE21G3F894726HCD519389561G42DA59723F86751D839BAI42C78E62HC65I147')"); "'463I81B5G97H42E61CE21G3F894726HCD519389561G42DA59723F86751D839BAI42C78E62HC65I147')");
$DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 27," $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 27,".
"'2A47E638939F148B5G57823I16D46589C12G723FA5D8IHI1G42653F72I41E388CD5F29G19153H7DBF')"); "'2A47E638939F148B5G57823I16D46589C12G723FA5D8IHI1G42653F72I41E388CD5F29G19153H7DBF')");
$DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 28,". $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 28,".
"'DHA625937756349A8B92CG1HD65A537DBH96IGD86C21528F591C4G274CF9518631528DIGHEI174632')"); "'DHA625937756349A8B92CG1HD65A537DBH96IGD86C21528F591C4G274CF9518631528DIGHEI174632')");
@ -417,7 +417,7 @@ $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (
"'53H27A49FG6B49381E419F58B3GFBE9871D3378F4A5299D15237H6864G59C1223G1H4IE6A9E36B874')"); "'53H27A49FG6B49381E419F58B3GFBE9871D3378F4A5299D15237H6864G59C1223G1H4IE6A9E36B874')");
$DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 24,". $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 24,".
"'FA4E93B783576H2ID1B98D17F3592E36G48113F8245GI7H41593F2756AC2H49D1879526392C84F57A')"); "'FA4E93B783576H2ID1B98D17F3592E36G48113F8245GI7H41593F2756AC2H49D1879526392C84F57A')");
$DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 27," $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 27,".
"'965HA34BG72364I58AH1DE27639GEBA94638418CF59729F3782DEAB8F54I3711972C6HE43451G82I6')"); "'965HA34BG72364I58AH1DE27639GEBA94638418CF59729F3782DEAB8F54I3711972C6HE43451G82I6')");
$DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 27,". $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 27,".
"'6I7841CB5DHEC9271623AE7FH49962GA45H38745639BAC1E92846747915HB3FFC82D71591526I37HD')"); "'6I7841CB5DHEC9271623AE7FH49962GA45H38745639BAC1E92846747915HB3FFC82D71591526I37HD')");
@ -444,7 +444,7 @@ $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (
"'BE63A47H9I48FBG35A73A5982DFADE972863876513BI4329HF415743HEIG621AFE482739I72613DH5')"); "'BE63A47H9I48FBG35A73A5982DFADE972863876513BI4329HF415743HEIG621AFE482739I72613DH5')");
$DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 30,". $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 30,".
"'HGD19C52F3E9HB67D1F217548CIIEH362417614975BHC372DA8596281FCE749D3G198562I652D7AHC')"); "'HGD19C52F3E9HB67D1F217548CIIEH362417614975BHC372DA8596281FCE749D3G198562I652D7AHC')");
$DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 25,".. $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 25,".
"'B8E1639749362GD851147589FBC752HC64I1AI8547F2343F91BH7E649E1GC2H7AB389465358264GI1')"); "'B8E1639749362GD851147589FBC752HC64I1AI8547F2343F91BH7E649E1GC2H7AB389465358264GI1')");
$DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 25,". $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 25,".
"'6C72598A452H431GI69D1HFG3524HB37A59695G862ADC613D9E728I28163G45675BHD3191C457928F')"); "'6C72598A452H431GI69D1HFG3524HB37A59695G862ADC613D9E728I28163G45675BHD3191C457928F')");
@ -705,7 +705,7 @@ $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (
"'783I62DE1DA23857I6F59AG4C28519FCG2486GH12D95C2439857AF1BF89537D5492CG861837461EIB')"); "'783I62DE1DA23857I6F59AG4C28519FCG2486GH12D95C2439857AF1BF89537D5492CG861837461EIB')");
$DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 25,". $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 25,".
"'39158F27D6H72D91CEB4E3G1869A69742H5357C8619BD482IEC6179B86C54AGG564A239813479H52F')"); "'39158F27D6H72D91CEB4E3G1869A69742H5357C8619BD482IEC6179B86C54AGG564A239813479H52F')");
$DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 25," $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 25,".
"'8G1C4B569C59716DH2B6D9857ACD56I8C2178GA624593392571HDF6947BH135238165IDGAE7439628')"); "'8G1C4B569C59716DH2B6D9857ACD56I8C2178GA624593392571HDF6947BH135238165IDGAE7439628')");
$DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 27,". $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 27,".
@ -2387,8 +2387,7 @@ $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (
" 'IB5C47F184H72A6953C1695H7BD5837IB46AG69148E3B2415FC8798E91C62G4F7D82E39AA32D9GF85')"); " 'IB5C47F184H72A6953C1695H7BD5837IB46AG69148E3B2415FC8798E91C62G4F7D82E39AA32D9GF85')");
$DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 26,". $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 26,".
" '16H92C75DB59D76A83743H1E62I3I58476AB6D2591GCH178CF2954536D81BG99273FE814DHA297536')"); " '16H92C75DB59D76A83743H1E62I3I58476AB6D2591GCH178CF2954536D81BG99273FE814DHA297536')");
".
"
$DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 25,". $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 25,".
" 'BGD568391569A4C872381927FDE452713I8F398FEDB17GA6892534F49HC71B5731425I8FB5H16I473')"); " 'BGD568391569A4C872381927FDE452713I8F398FEDB17GA6892534F49HC71B5731425I8FB5H16I473')");
$DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 26,". $DB->execute( "INSERT INTO {game_sudoku_database}( level, opened, data) VALUES (1, 26,".

2
hiddenpicture/picture.php

@ -109,7 +109,7 @@ function shownumber( $imghandle, $imgnumbers, $number, $x1 , $y1, $width, $heigh
$srch = $sizenumbers[ 1]; $srch = $sizenumbers[ 1];
$dstw = $width / 10; $dstw = $width / 10;
$dsth = $dstw * $srch / $srcw; $dsth = $dstw * $srch / $srcw;
imagecopyresized( $imghandle, $imgnumbers, $dstx, $dsty, $srcx, 0, $dstw, $dsth, $srcw, $srchh); imagecopyresized( $imghandle, $imgnumbers, $dstx, $dsty, $srcx, 0, $dstw, $dsth, $srcw, $srch);
} else { } else {
$number1 = floor( $number / 10); $number1 = floor( $number / 10);
$number2 = $number % 10; $number2 = $number % 10;

1
hiddenpicture/play.php

@ -140,6 +140,7 @@ function game_hiddenpicture_selectglossaryentry( $game, $attempt) {
} }
} }
if (count( $ids) == 0) { if (count( $ids) == 0) {
$a = new stdClass();
$a->name = "'".$DB->get_field( 'glossary', 'name', array( 'id' => $game->glossaryid2))."'"; $a->name = "'".$DB->get_field( 'glossary', 'name', array( 'id' => $game->glossaryid2))."'";
print_error( get_string( 'hiddenpicture_nomainquestion', 'game', $a)); print_error( get_string( 'hiddenpicture_nomainquestion', 'game', $a));
return false; return false;

8
locallib.php

@ -1517,12 +1517,18 @@ function game_select_from_repetitions( $game, $recs, $need) {
return $ret; return $ret;
} }
function game_grade_responses( $question, $responses, $maxgrade, &$answertext) { function game_grade_responses( $question, $responses, $maxgrade, &$answertext, &$answered) {
$answered = true;
if ($question->qtype == 'multichoice') { if ($question->qtype == 'multichoice') {
if ($question->options->single == 0) { if ($question->options->single == 0) {
return game_grade_responses_multianswer( $question, $responses, $maxgrade, $answertext); return game_grade_responses_multianswer( $question, $responses, $maxgrade, $answertext);
} }
$name = "resp{$question->id}_"; $name = "resp{$question->id}_";
if( !isset( $responses->$name)) {
$answered = false;
return 0;
}
$value = $responses->$name; $value = $responses->$name;
$answer = $question->options->answers[ $value]; $answer = $question->options->answers[ $value];
$answertext = $answer->answer; $answertext = $answer->answer;

2
millionaire/play.php

@ -179,7 +179,7 @@ function game_millionaire_showgrid( $game, $millionaire, $id, $query, $aanswer,
switch ($i) { switch ($i) {
case 15: case 15:
echo "<td rowspan=".(16 + count( $aanswer)). echo "<td rowspan=".(16 + count( $aanswer)).
"$background>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\r\n"; " $background>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\r\n";
$btr = true; $btr = true;
break; break;
case 14: case 14:

2
snakes/play.php

@ -312,7 +312,7 @@ function game_snakes_check_questions( $id, $game, $attempt, $snakes, $context) {
$query = new stdClass(); $query = new stdClass();
$query->id = $snakes->queryid; $query->id = $snakes->queryid;
$grade = game_grade_responses( $question, $responses, 100, $answertext); $grade = game_grade_responses( $question, $responses, 100, $answertext, $answered);
if ($grade < 99) { if ($grade < 99) {
// Wrong answer. // Wrong answer.
game_update_queries( $game, $attempt, $query, 0, $answertext); game_update_queries( $game, $attempt, $query, 0, $answertext);

30
sudoku/class.Sudoku.php

@ -56,7 +56,7 @@
@require_once("SDD/class.SDD.php"); @require_once("SDD/class.SDD.php");
/** /*
* @author Dick Munroe <munroe@csworks.com> * @author Dick Munroe <munroe@csworks.com>
* @copyright copyright @ 2005 by Dick Munroe, Cottage Software Works, Inc. * @copyright copyright @ 2005 by Dick Munroe, Cottage Software Works, Inc.
* @license http://www.csworks.com/publications/ModifiedNetBSD.html * @license http://www.csworks.com/publications/ModifiedNetBSD.html
@ -64,7 +64,7 @@
* @package Sudoku * @package Sudoku
*/ */
/** /*
* Basic functionality needed for ObjectSs in the Sudoku solver. * Basic functionality needed for ObjectSs in the Sudoku solver.
* *
* Technically speaking these aren't restricted to the Sudoku classes * Technically speaking these aren't restricted to the Sudoku classes
@ -73,7 +73,7 @@
* @package Sudoku * @package Sudoku
*/ */
class ObjectS { class objects {
/** /**
* @desc Are two array's equal (have the same contents). * @desc Are two array's equal (have the same contents).
* @param array * @param array
@ -95,11 +95,11 @@ class ObjectS {
return (count($xxx) == 0); return (count($xxx) == 0);
} }
/** /*
* Deep copy anything. * Deep copy anything.
* *
* @access public * @access public
* @param array $theArray [optional] Something to be deep copied. [Default is the current * @param array $theArray [optional] Something to be deep copied. Default is the current
* ObjectS. * ObjectS.
* @return mixed The deep copy of the input. All references embedded within * @return mixed The deep copy of the input. All references embedded within
* the array have been resolved into copies allowing things like the * the array have been resolved into copies allowing things like the
@ -126,7 +126,7 @@ class ObjectS {
} }
} }
/** /*
* The individual cell on the Sudoku board. * The individual cell on the Sudoku board.
* *
* These cells aren't restricted to 9x9 Sudoku (although pretty much everything else * These cells aren't restricted to 9x9 Sudoku (although pretty much everything else
@ -135,7 +135,7 @@ class ObjectS {
* *
* @package Sudoku * @package Sudoku
*/ */
class Cell extends ObjectS { class cell extends objects {
protected $r; protected $r;
protected $c; protected $c;
@ -226,7 +226,7 @@ class Cell extends ObjectS {
} }
} }
/** /*
* Used to make sure that solved positions show up at print time. * Used to make sure that solved positions show up at print time.
* The value is used as a candidate for "slicing and dicing" by elimination in * The value is used as a candidate for "slicing and dicing" by elimination in
* Sudoku::_newSolvedPosition. * Sudoku::_newSolvedPosition.
@ -240,7 +240,7 @@ class Cell extends ObjectS {
$this->state = array($value => $value); $this->state = array($value => $value);
} }
/** /*
* @desc return the state of a cell. * @desc return the state of a cell.
* @access protected * @access protected
* @return mixed Either solved state or array of state pending solution. * @return mixed Either solved state or array of state pending solution.
@ -250,7 +250,7 @@ class Cell extends ObjectS {
return $this->state; return $this->state;
} }
/** /*
* @desc Has the state of this cell been applied to the board. * @desc Has the state of this cell been applied to the board.
* @access public * @access public
* @return boolean True if it has, false otherwise. Implies that IsSolved is true as well. * @return boolean True if it has, false otherwise. Implies that IsSolved is true as well.
@ -260,7 +260,7 @@ class Cell extends ObjectS {
return $this->applied; return $this->applied;
} }
/** /*
* @desc Has this cell been solved? * @desc Has this cell been solved?
* @access public * @access public
* @return boolean True if this cell has hit a single state. * @return boolean True if this cell has hit a single state.
@ -270,7 +270,7 @@ class Cell extends ObjectS {
return !is_array($this->state); return !is_array($this->state);
} }
/** /*
* This is used primarily by the pretty printer, but has other applications * This is used primarily by the pretty printer, but has other applications
* in the code. * in the code.
* *
@ -293,7 +293,7 @@ class Cell extends ObjectS {
} }
} }
/** /*
* This is the negative inference of Sudoku. By eliminating values the * This is the negative inference of Sudoku. By eliminating values the
* cells approach solutions. Once a cell has been completely eliminated, * cells approach solutions. Once a cell has been completely eliminated,
* the value causing the complete elimination must be the solution and the * the value causing the complete elimination must be the solution and the
@ -1360,7 +1360,7 @@ class sudoku extends ObjectS {
* Pick a spot on the board and get the clues set up. * Pick a spot on the board and get the clues set up.
*/ */
$thechoice = mt_rand(0, count($thecouplings[$themaximumcoupling]) - 1; $thechoice = mt_rand(0, count($thecouplings[$themaximumcoupling]) - 1);
$thecluespositions[] = $thecouplings[$themaximumcoupling][$thechoice]; $thecluespositions[] = $thecouplings[$themaximumcoupling][$thechoice];
$therow = $thecouplings[$themaximumcoupling][$thechoice][0]; $therow = $thecouplings[$themaximumcoupling][$thechoice][0];
$thecolumn = $thecouplings[$themaximumcoupling][$thechoice][1]; $thecolumn = $thecouplings[$themaximumcoupling][$thechoice][1];
@ -1911,7 +1911,7 @@ class sudoku extends ObjectS {
class SudokuTemplates extends Sudoku class SudokuTemplates extends Sudoku
{ {
public function sudokutemplates($theDebug = false) { public function sudokutemplates($thedebug = false) {
$this->sudoku($thedebug); $this->sudoku($thedebug);
} }

7
sudoku/play.php

@ -527,7 +527,10 @@ function game_sudoku_check_questions( $id, $game, $attempt, $sudoku, $finishatte
continue; continue;
} }
$grade = game_grade_responses( $question, $responses, 100, $answertext); $grade = game_grade_responses( $question, $responses, 100, $answertext, $answered);
if( $answered == false) {
continue;
}
if ($grade < 99) { if ($grade < 99) {
// Wrong answer. // Wrong answer.
game_update_queries( $game, $attempt, $query, $grade / 100, $answertext); game_update_queries( $game, $attempt, $query, $grade / 100, $answertext);
@ -555,7 +558,7 @@ function game_sudoku_check_glossaryentries( $id, $game, $attempt, $sudoku, $fini
if (!($entries = $DB->get_records_select( 'glossary_entries', "id IN ($entrieslist)"))) { if (!($entries = $DB->get_records_select( 'glossary_entries', "id IN ($entrieslist)"))) {
print_error( get_string('noglossaryentriesfound', 'game')); print_error( get_string('noglossaryentriesfound', 'game'));
} }
foreach (entries as $entry) { foreach ($entries as $entry) {
$answerundefined = optional_param('resp'.$entry->id, 'undefined', PARAM_TEXT); $answerundefined = optional_param('resp'.$entry->id, 'undefined', PARAM_TEXT);
if ($answerundefined == 'undefined') { if ($answerundefined == 'undefined') {
continue; continue;

Loading…
Cancel
Save