コード例 #1
0
ファイル: RouletteTest.php プロジェクト: delboy1978uk/casino
 protected function _before()
 {
     $del = new Player('Del');
     $del->addChips(500);
     $game = new Game();
     $game->addPlayer($del);
     $this->turn = new Roulette($del, $game);
 }
コード例 #2
0
ファイル: RouletteTest.php プロジェクト: delboy1978uk/casino
 public function testRoundOfPlay()
 {
     $this->roulette->nextPlayersTurn()->betRed(100);
     $this->roulette->nextPlayersTurn()->betBlack(100);
     $this->roulette->nextPlayersTurn()->betGreen(100);
     $this->roulette->spinWheel();
     $bal1 = $this->roulette->getNextPlayer()->getBalance();
     $bal2 = $this->roulette->getNextPlayer()->getBalance();
     $bal3 = $this->roulette->getNextPlayer()->getBalance();
     $this->assertNotEquals(1000, $bal1);
     $this->assertNotEquals(1000, $bal2);
     $this->assertNotEquals(1000, $bal3);
     $this->roulette->nextPlayersTurn()->betEven(100);
     $this->roulette->nextPlayersTurn()->betOdd(100);
     $this->roulette->nextPlayersTurn()->betEven(100);
     $this->roulette->spinWheel();
     $bal4 = $this->roulette->getNextPlayer()->getBalance();
     $bal5 = $this->roulette->getNextPlayer()->getBalance();
     $bal6 = $this->roulette->getNextPlayer()->getBalance();
     $this->assertNotEquals($bal4, $bal1);
     $this->assertNotEquals($bal5, $bal2);
     $this->assertNotEquals($bal6, $bal3);
     $this->roulette->nextPlayersTurn()->betSplit(31, 34, 10)->betSplit(35, 32, 10)->betSplit(33, 36, 10)->betSplit(27, 30, 10)->betSplit(26, 29, 10)->betSplit(25, 28, 10);
     $this->roulette->nextPlayersTurn()->betSplit(3, 6, 10)->betSplit(2, 5, 10)->betSplit(1, 4, 10)->betSplit(9, 12, 10)->betSplit(8, 11, 10)->betSplit(7, 10, 10);
     $this->roulette->nextPlayersTurn()->betSplit(15, 18, 10)->betSplit(14, 17, 10)->betSplit(13, 16, 10)->betSplit(18, 21, 10)->betSplit(17, 20, 10)->betSplit(16, 19, 10);
     $this->roulette->spinWheel();
     $bal1 = $this->roulette->getNextPlayer()->getBalance();
     $bal2 = $this->roulette->getNextPlayer()->getBalance();
     $bal3 = $this->roulette->getNextPlayer()->getBalance();
     $this->assertNotEquals($bal4, $bal1);
     $this->assertNotEquals($bal5, $bal2);
     $this->assertNotEquals($bal6, $bal3);
     $this->roulette->nextPlayersTurn()->betNumber(0, 10)->betNumber(1, 10)->betNumber(2, 10)->betNumber(3, 10)->betNumber(4, 10);
     $this->roulette->nextPlayersTurn()->betNumber(5, 10)->betNumber(6, 10)->betNumber(7, 10)->betNumber(8, 10)->betNumber(9, 10);
     $this->roulette->nextPlayersTurn()->betNumber(10, 10)->betNumber(11, 10)->betNumber(12, 10)->betNumber(13, 10)->betNumber(14, 10);
     $this->roulette->spinWheel();
     $bal4 = $this->roulette->getNextPlayer()->getBalance();
     $bal5 = $this->roulette->getNextPlayer()->getBalance();
     $bal6 = $this->roulette->getNextPlayer()->getBalance();
     $this->assertNotEquals($bal4, $bal1);
     $this->assertNotEquals($bal5, $bal2);
     $this->assertNotEquals($bal6, $bal3);
 }
コード例 #3
0
ファイル: Roulette.php プロジェクト: delboy1978uk/casino
 /**
  * @param $num1
  * @param $num2
  * @param $amount
  * @return $this
  */
 public function betNumber($num, $amount)
 {
     $bet = new Bet($this->player, new Number($num), $amount);
     $this->game->addBet($bet);
     return $this;
 }