Browse Source

New: High score

MOODLE_20_STABLE
bdaloukas 7 years ago
parent
commit
07d60b818b
  1. 11
      hangman/play.php
  2. 4
      version.php

11
hangman/play.php

@ -300,7 +300,7 @@ function game_hangman_play( $id, $game, $attempt, $hangman, $onlyshow, $showsolu
}
if ($hangman->finishedword == false) {
echo "<br/><br/><BR/>".get_string( 'hangman_letters', 'game').$links."\r\n";
echo "<br/><br/><BR/>".get_string( 'hangman_letters', 'game').' '.$links."\r\n";
}
}
} else {
@ -310,8 +310,10 @@ function game_hangman_play( $id, $game, $attempt, $hangman, $onlyshow, $showsolu
echo "<br/><br/>".get_string( 'grade', 'game').' : '.round( $query->percent * 100).' %';
if ($hangman->maxtries > 1) {
$percent = ($correct - $wrong / $max) / game_strlen( $query->answertext);
$score = $hangman->corrects / $hangman->maxtries + $percent / 100;
echo '<br/><br/>'.get_string( 'hangman_gradeinstance', 'game').' : '.
round( $hangman->corrects / $hangman->maxtries * 100).' %';
round( $score * 100).' %';
}
if ($game->bottomtext != '') {
@ -478,7 +480,10 @@ function hangman_showpage(&$done, &$correct, &$wrong, $max, &$wordline, &$wordli
} else {
$score = -1;
}
if( $hangman->maxtries > 0) {
$percent = ($correct - $wrong / $max) / game_strlen( $word);
$score = $hangman->corrects / $hangman->maxtries + $percent / 100;
}
game_updateattempts( $game, $attempt, $score, $finished);
game_update_queries( $game, $attempt, $query, $score, $answer);
}

4
version.php

@ -35,10 +35,10 @@ if (!isset( $plugin)) {
}
$plugin->component = 'mod_game'; // Full name of the plugin (used for diagnostics).
$plugin->version = 2017081104; // The current module version (Date: YYYYMMDDXX).
$plugin->version = 2017081301; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2010112400; // Requires Moodle 2.0.
$plugin->cron = 0; // Period for cron to check this module (secs).
$plugin->release = '2017-08-11';
$plugin->release = '2017-08-13';
$plugin->maturity = MATURITY_STABLE;
if ($useplugin != 2) {

Loading…
Cancel
Save