Ejemplo n.º 1
0
 public static function create($playerIdByGroup)
 {
     $setup = new TournamentSetup();
     $seed = RoundSetupSeed::create($playerIdByGroup);
     // create seed with n groups
     $seed->setAdvance(-1);
     // seed defaults to advance -1
     $setup->setSeed($seed);
     $groupRound = RoundSetupAva::createStraight();
     // create an AvA round with straight input
     $groupRound->setAdvance(2);
     // each group, best 2 advance
     $groupRound->setGameMode(new GameMode(GameMode::FIRST_TO, 3));
     $groupRound->setLegMode(new LegMode(LegMode::SINGLE_OUT_301));
     $setup->addRound($groupRound);
     // adding bottom first walking upwards
     $crisCrossRound = RoundSetupAva::createStep(1);
     // create an AvA round with step-1 input
     $crisCrossRound->setAdvance(1);
     $crisCrossRound->setGameMode(new GameMode(GameMode::FIRST_TO, 3));
     $crisCrossRound->setLegMode(new LegMode(LegMode::SINGLE_OUT_301));
     $setup->addRound($crisCrossRound);
     $xRound = RoundSetupAva::createReduce();
     // create an AvA round with reduce input
     $xRound->setAdvance(2);
     $xRound->setGameMode(new GameMode(GameMode::FIRST_TO, 3));
     $xRound->setLegMode(new LegMode(LegMode::SINGLE_OUT_301));
     $setup->addRound($xRound);
     $yRound = RoundSetupAva::createSamePlace();
     // create an AvA round with same-place input
     $yRound->setAdvance(2);
     $yRound->setGameMode(new GameMode(GameMode::FIRST_TO, 3));
     $yRound->setLegMode(new LegMode(LegMode::SINGLE_OUT_301));
     $setup->addRound($yRound);
     $zRound = RoundSetupNull::createStack();
     // create an Null round with stack input
     $zRound->setAdvance(-1);
     // null defaults to advance -1
     $setup->addRound($zRound);
     return $setup;
 }
Ejemplo n.º 2
0
 public function testFullTournament()
 {
     $setup = new TournamentSetup();
     $seed = RoundSetupSeed::create(4);
     // create seed with 4 groups
     $seed->setAdvance(-1);
     // seed defaults to advance -1
     $setup->setSeed($seed);
     $groupRound = RoundSetupAva::createStraight();
     // create an AvA round with straight input
     $groupRound->setAdvance(4);
     // each group, best 4 advance
     $setup->addRound($groupRound);
     // adding bottom first walking upwards
     $knockOutRound = RoundSetupBvw::createStep(1);
     // create an BvW round with step-1 input
     $knockOutRound->setAdvance(2);
     // each group, best 2 advance
     $setup->addRound($knockOutRound);
     $crisCrossRound = RoundSetupAva::createStep(2);
     // create an AvA round with step-2 input
     $crisCrossRound->setAdvance(1);
     $setup->addRound($crisCrossRound);
     $xRound = RoundSetupAva::createReduce();
     // create an AvA round with reduce input
     $xRound->setAdvance(2);
     $setup->addRound($xRound);
     $yRound = RoundSetupAva::createSamePlace();
     // create an AvA round with same-place input
     $yRound->setAdvance(2);
     $setup->addRound($yRound);
     $zRound = RoundSetupNull::createStack();
     // create an Null round with stack input
     $zRound->setAdvance(-1);
     // null defaults to advance -1
     $setup->addRound($zRound);
 }