895Chapter 46A Trivia Game$current_level = $this->_level; if ($current_level (Web server setup)
895Chapter 46A Trivia Game$current_level = $this->_level; if ($current_level > $params->getMaximumLevel()) { $this->_gameWon = TRUE; } else { // find out if questions remain to be // asked at this levelif (($this->_questionsAskedAtLevel >= $params->getQuestionsPerLevel($current_level)) || (count($this->_questionIdsAtLevel) == 0)) { // either we have asked the limit of // questions per level, OR we have simply run out$this->_level++; $this->_questionsAskedAtLevel = 0; $this->_setupQuestionIds(); // note recursive call — it s possible// that no questions were found, and we have// to keep going$this->_maybeChangeLevel(); } } } } function __sleep () { // make sure to serialize all fields except// the database connection (has to be recreated) // and the previous question (no point). return(array( gameParameters , currentQuestion , _credit , _level , _questionIdsAtLevel , _questionsAskedAtLevel , _correctAnswers , _totalQuestions , _gameLost , _gameWon )); } } ?> Handling an answerHere are the steps that a Gameobject goes through in dealing with a guess range submittedby a player (in the function updateWithAnswer): 1.Move the current question object to the previous question slot. 2.Update the (now previous) question with the upper and lower ranges of the guess(which are still in terms of step numbers from the form rather than actual values).
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.