Browse Source

Fix:Coding style

MOODLE_20_STABLE
Vasilis Daloukas 9 years ago
parent
commit
ecf33ae476
  1. 31
      sudoku/class.Sudoku.php
  2. 6
      sudoku/play.php

31
sudoku/class.Sudoku.php

@ -150,9 +150,9 @@ class cell extends objects {
* implementing Super-doku. * implementing Super-doku.
*/ */
public function cell($r, $c, $nstates = 9) { public function init($inpr, $inpc, $nstates = 9) {
$this->r = $r; $this->r = $inpr;
$this->c = $c; $this->c = $inpc;
for ($i = 1; $i <= $nstates; $i++) { for ($i = 1; $i <= $nstates; $i++) {
$this->state[$i] = $i; $this->state[$i] = $i;
@ -355,7 +355,7 @@ class rcs extends ObjectS{
* limts things to 9x9 Sudoku currently. * limts things to 9x9 Sudoku currently.
*/ */
public function rcs($thetag, $theindex, &$a1, &$a2, &$a3, &$a4, &$a5, &$a6, &$a7, &$a8, &$a9) { public function init($thetag, $theindex, &$a1, &$a2, &$a3, &$a4, &$a5, &$a6, &$a7, &$a8, &$a9) {
$this->thetag = $thetag; $this->thetag = $thetag;
$this->theindex = $theindex; $this->theindex = $theindex;
$this->therow[1] = &$a1; $this->therow[1] = &$a1;
@ -766,10 +766,6 @@ class r extends rcs {
* limts things to 9x9 Sudoku currently. * limts things to 9x9 Sudoku currently.
*/ */
public function r($thetag, $theindex, &$a1, &$a2, &$a3, &$a4, &$a5, &$a6, &$a7, &$a8, &$a9) {
$this->rcs($thetag, $theindex, $a1, $a2, $a3, $a4, $a5, $a6, $a7, $a8, $a9);
}
/** /**
* @see RCS::coupling * @see RCS::coupling
*/ */
@ -824,10 +820,6 @@ class c extends r {
* limts things to 9x9 Sudoku currently. * limts things to 9x9 Sudoku currently.
*/ */
public function c($thetag, $theindex, &$a1, &$a2, &$a3, &$a4, &$a5, &$a6, &$a7, &$a8, &$a9) {
$this->r($thetag, $theindex, $a1, $a2, $a3, $a4, $a5, $a6, $a7, $a8, $a9);
}
/** /**
* @see R::coupling * @see R::coupling
*/ */
@ -870,13 +862,9 @@ class s extends rcs {
* @param integer $theIndex 1..9, where is this on the board. Square are numbered top * @param integer $theIndex 1..9, where is this on the board. Square are numbered top
* left, ending bottom right * left, ending bottom right
* @param ObjectS $a1..9 of class Cell. The cells comprising this entity. This interface is what * @param ObjectS $a1..9 of class Cell. The cells comprising this entity. This interface is what
* limts things to 9x9 Sudoku currently. * limits things to 9x9 Sudoku currently.
*/ */
public function s($thetag, $theindex, &$a1, &$a2, &$a3, &$a4, &$a5, &$a6, &$a7, &$a8, &$a9) {
$this->rcs($thetag, $theindex, $a1, $a2, $a3, $a4, $a5, $a6, $a7, $a8, $a9);
}
/** /**
* @see RCS::coupling * @see RCS::coupling
*/ */
@ -1026,12 +1014,13 @@ class sudoku extends ObjectS {
protected $thegenerationiterations = 0; protected $thegenerationiterations = 0;
public function sudoku($thedebug = false) { public function init($thedebug = false) {
$this->thedebug = $thedebug; $this->thedebug = $thedebug;
for ($i = 1; $i <= 9; $i++) { for ($i = 1; $i <= 9; $i++) {
for ($j = 1; $j <= 9; $j++) { for ($j = 1; $j <= 9; $j++) {
$this->theboard[$i][$j] = new cell($i, $j); $this->theboard[$i][$j] = new cell;
$this->theboard[$i][$j].init( $i, $j);
} }
} }
@ -1911,10 +1900,6 @@ class sudoku extends ObjectS {
class SudokuTemplates extends Sudoku class SudokuTemplates extends Sudoku
{ {
public function sudokutemplates($thedebug = false) {
$this->sudoku($thedebug);
}
public function generatepuzzlefromfile($thehandle = STDIN, $thedifficultylevel = 10) { public function generatepuzzlefromfile($thehandle = STDIN, $thedifficultylevel = 10) {
$yyy = array(); $yyy = array();

6
sudoku/play.php

@ -506,7 +506,7 @@ function game_sudoku_checkanswers() {
} }
function game_sudoku_check_questions( $id, $game, $attempt, $sudoku, $finishattempt, $course) { function game_sudoku_check_questions( $id, $game, $attempt, $sudoku, $finishattempt, $course) {
global $QTYPES, $DB; global $DB;
$responses = data_submitted(); $responses = data_submitted();
@ -528,7 +528,7 @@ function game_sudoku_check_questions( $id, $game, $attempt, $sudoku, $finishatte
} }
$grade = game_grade_responses( $question, $responses, 100, $answertext, $answered); $grade = game_grade_responses( $question, $responses, 100, $answertext, $answered);
if( $answered == false) { if ($answered == false) {
continue; continue;
} }
if ($grade < 99) { if ($grade < 99) {
@ -545,7 +545,7 @@ function game_sudoku_check_questions( $id, $game, $attempt, $sudoku, $finishatte
} }
function game_sudoku_check_glossaryentries( $id, $game, $attempt, $sudoku, $finishattempt, $course) { function game_sudoku_check_glossaryentries( $id, $game, $attempt, $sudoku, $finishattempt, $course) {
global $QTYPES, $DB; global $DB;
$responses = data_submitted(); $responses = data_submitted();

Loading…
Cancel
Save