コード例 #1
0
ファイル: MathTest.php プロジェクト: pherserk/tombola
 public function testFindTriples()
 {
     $array = [1, 1, 1, 2, 2, 3, 3, 2];
     $triples = Math::findTriples($array);
     $this->assertContains(2, $triples);
     $this->assertCount(2, $triples);
 }
コード例 #2
0
ファイル: Folder.php プロジェクト: pherserk/tombola
 protected function checkNumbersHistory()
 {
     if (count($this->numbersHistory) !== 15) {
         return;
     }
     $halfScores = [];
     foreach ($this->numbersHistory as $number) {
         $halfScores[] = Math::numberToHalfScore($number);
     }
     $triples = Math::findTriples($halfScores);
     if (count($triples) > 0) {
         throw new FolderException('Folder can\'t contain same halfscore more than twice');
     }
 }