GameController implements the {@link https://en.wikipedia.org/wiki/Hangman_(game) Hangman game}.
author | Qiang Xue qiang.xue@gmail.com |
---|---|
version | $Id: CController.php 131 2008-11-02 01:32:57Z qiang.xue $ |
package | demos.hangman |
since | 1.0 |
actionGiveup()
This action is invoked when the user gives up the game.
actionGuess()
This action is invoked each time when the user makes a guess.
actionPlay()
In this action, users are asked to choose a difficulty level of the game.
generateWord(): string
string
the word to be guessed
getGuessWord(): string
string
the word being guessed. This value is persistent during the whole game session.
getLevel(): integer
integer
the difficulty level. This value is persistent during the whole game session.
getMisses(): integer
integer
the number of misses. This value is persistent during the whole game session.
getWord(): string
string
the word to be guessed. This value is persistent during the whole game session.
guess( $letter): mixed
mixed
true if the word is guessed correctly, false if the user has used up all guesses and the word is guessed incorrectly, and null if the letter is guessed correctly but the whole word is guessed correctly yet.
isGuessed( $letter): boolean
boolean
whether the letter is already guessed.
setGuessWord( $value)
setLevel( $value)
setMisses( $value)
setWord( $value)
defaultAction :string
var | sets the default action to be 'play' |
---|
string