コード例 #1
0
ファイル: MergeCollectionPass.php プロジェクト: fervo/rollo
 public function action(DieCollection $outerColl, DieCollection $innerColl)
 {
     $this->doRun($innerColl);
     if ($innerColl->getOperator() == $outerColl->getOperator() || count($innerColl->getDice()) == 1) {
         $outerColl->replaceDieWithDice($innerColl, $innerColl->getDice());
     }
 }
コード例 #2
0
ファイル: DieCollectionTest.php プロジェクト: fervo/rollo
 public function testComplextCollectionGivesCorrectDescriptionForSubtraction()
 {
     $threeD6 = new DieCollection([new ConstantDie(1), new ConstantDie(2), new ConstantDie(3)]);
     $threeD6MinusOne = new DieCollection([$threeD6, new ConstantDie(1)], DieCollection::OPERATOR_SUBTRACTION);
     $this->assertEquals('[[#1 + #2 + #3]=6 - #1]=5', $threeD6MinusOne->getValueDescription());
 }