demos/hangman/protected/controllers/GameController.php
public function actionGuess()
	{
		// check to see if the letter is guessed correctly
		if(isset($_GET['g'][0]) && ($result=$this->guess($_GET['g'][0]))!==null)
			$this->render($result ? 'win' : 'lose');
		else // the letter is guessed correctly, but not win yet
		{
			$guessed=$this->getPageState('guessed',array());
			$guessed[$_GET['g'][0]]=true;
			$this->setPageState('guessed',$guessed,array());
			$this->render('guess');
		}
	}
public function actionGuess()
	{
		// check to see if the letter is guessed correctly
		if(isset($_GET['g'][0]) && ($result=$this->guess($_GET['g'][0]))!==null)
			$this->render($result ? 'win' : 'lose');
		else // the letter is guessed correctly, but not win yet
		{
			$guessed=$this->getPageState('guessed',array());
			$guessed[$_GET['g'][0]]=true;
			$this->setPageState('guessed',$guessed,array());
			$this->render('guess');
		}
	}
public function actionGuess ( ) { // check to see if the letter is guessed correctly if ( isset ( $ _GET [ 'g' ] [ 0 ] ) && ( $ result = $ this -> guess ( $ _GET [ 'g' ] [ 0 ] ) ) !== null ) $ this -> render ( $ result ? 'win' : 'lose' ) ; else // the letter is guessed correctly, but not win yet { $ guessed = $ this -> getPageState ( 'guessed' , array ( ) ) ; $ guessed [ $ _GET [ 'g' ] [ 0 ] ] = true ; $ this -> setPageState ( 'guessed' , $ guessed , array ( ) ) ; $ this -> render ( 'guess' ) ; } }
The 'guess' action.
This action is invoked each time when the user makes a guess.
The guess action . This action is invoked each time when the user makes a guess .