本文整理匯總了PHP中State::isEndGame方法的典型用法代碼示例。如果您正苦於以下問題:PHP State::isEndGame方法的具體用法?PHP State::isEndGame怎麽用?PHP State::isEndGame使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類State
的用法示例。
在下文中一共展示了State::isEndGame方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: reconcile
public function reconcile($game)
{
$state = $game->getState();
debug("Wallet::reconcile state [{$state}] money [" . $this->money . "]");
$prize = 0;
$wager = $this->wager;
if ($state != State::RECONCILED && State::isEndGame($state)) {
// handle double down
if ($game->isDoubleDown()) {
$wager *= 2;
}
switch ($state) {
case State::USER_BLACKJACK:
$prize = $wager * 1.5;
break;
case State::DEALER_BUST:
case State::USER_WIN:
$prize = $wager;
break;
case State::DEALER_BLACKJACK:
case State::USER_BUST:
case State::DEALER_WIN:
$prize += -$wager;
break;
}
// handle insurance
if ($game->userInsured()) {
if ($state == State::DEALER_BLACKJACK) {
// user original wager insurance
$prize += $this->wager;
} else {
// user original wager insurance
$prize -= $this->wager / 2;
}
}
$this->money += $prize;
debug("Wallet::reconcile final prize [{$prize}] money [" . $this->money . "]");
}
$game->reconcile();
}
示例2: testIsEndGame
public function testIsEndGame()
{
$this->assertTrue(State::isEndGame(State::USER_BUST));
$this->assertTrue(State::isEndGame(State::DEALER_BUST));
$this->assertTrue(State::isEndGame(State::PUSH));
$this->assertTrue(State::isEndGame(State::USER_WIN));
$this->assertTrue(State::isEndGame(State::DEALER_WIN));
$this->assertTrue(State::isEndGame(State::USER_BLACKJACK));
$this->assertTrue(State::isEndGame(State::DEALER_BLACKJACK));
$this->assertFalse(State::isEndGame(State::INVALID));
$this->assertFalse(State::isEndGame(State::START));
$this->assertFalse(State::isEndGame(State::PLAYING));
$this->assertFalse(State::isEndGame(State::PLAYING_ACTIVE));
$this->assertFalse(State::isEndGame(State::OFFER_INSURANCE));
}