From 1fbd910ffb7a828ff1e6bec56f24383738f1e831 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Sat, 28 Sep 2019 20:17:38 +0200 Subject: [PATCH 01/11] Added board property to Pairing and Game Added table-property to Pairing:::Class Added phpdoc blocks Renamed table to board --- src/Game.php | 23 +++++++++++++++++++++++ src/Pairing.php | 23 +++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/src/Game.php b/src/Game.php index 34655b2..28ba8e1 100644 --- a/src/Game.php +++ b/src/Game.php @@ -37,6 +37,9 @@ class Game /** @var GameResult | null */ private $result; + /** @var int */ + private $Board; + /** * Returns the result for the game * @@ -128,4 +131,24 @@ class Game $this->result = $result; return $this; } + + /** + * Sets the board no of the game + * + * @return int + */ + public function getBoard(): int + { + return $this->Board; + } + + /** + * Returns the board no of the game + * + * @param int $Board + */ + public function setBoard(int $Board): void + { + $this->Board = $Board; + } } diff --git a/src/Pairing.php b/src/Pairing.php index 21c9bd8..8b2d4a6 100644 --- a/src/Pairing.php +++ b/src/Pairing.php @@ -42,6 +42,9 @@ class Pairing /** @var int */ private $Round; + /** @var int */ + private $Board; + /** * Returns the player of the pairing * @@ -151,4 +154,24 @@ class Pairing $this->Round = $Round; return $this; } + + /** + * Sets the board no of the pairing + * + * @return int + */ + public function getBoard(): int + { + return $this->Board; + } + + /** + * Returns the board no of the pairing + * + * @param int $Board + */ + public function setBoard(int $Board): void + { + $this->Board = $Board; + } } From db9c205bd1d2aec8a5570c4d56dfcc64f2229670 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Sat, 28 Sep 2019 20:31:38 +0200 Subject: [PATCH 02/11] Class fields fixup Beware of breaking change with own readers!! AllFieldsAreNowPascalCased --- src/Constants.php | 14 ++++++------- src/Enums/Color.php | 6 +++--- src/Enums/Result.php | 22 ++++++++++---------- src/Game.php | 32 ++++++++++++++--------------- src/IOFactory.php | 6 +++--- src/Readers/Pairtwo6.php | 28 ++++++++++++------------- src/Readers/Swar4.php | 36 ++++++++++++++++---------------- src/Round.php | 44 ++++++++++++++++++++-------------------- src/Tournament.php | 6 +++--- 9 files changed, 97 insertions(+), 97 deletions(-) diff --git a/src/Constants.php b/src/Constants.php index 8950dd2..68ec994 100644 --- a/src/Constants.php +++ b/src/Constants.php @@ -27,11 +27,11 @@ use JeroenED\Libpairtwo\Enums\Result; */ class Constants { - const Won = [ Result::won, Result::wonforfait, Result::wonbye, Result::wonadjourned ]; - const Draw = [ Result::draw, Result::drawadjourned ]; - const Lost = [ Result::absent, Result::bye, Result::lost, Result::adjourned ]; - const NotPlayed = [ Result::bye, Result::wonbye, Result::absent ]; - const Played = [ Result::won, Result::wonforfait, Result::wonbye, Result::wonadjourned, Result::draw, Result::drawadjourned, Result::absent, Result::bye, Result::lost, Result::adjourned ]; - const Black = [ Color::black ]; - const White = [ Color::white ]; + const Won = [ Result::Won, Result::WonForfait, Result::WonBye, Result::WonAdjourned ]; + const Draw = [ Result::Draw, Result::DrawAdjourned ]; + const Lost = [ Result::Absent, Result::Bye, Result::Lost, Result::Adjourned ]; + const NotPlayed = [ Result::Bye, Result::WonBye, Result::Absent ]; + const Played = [ Result::Won, Result::WonForfait, Result::WonBye, Result::WonAdjourned, Result::Draw, Result::DrawAdjourned, Result::Absent, Result::Bye, Result::Lost, Result::Adjourned ]; + const Black = [ Color::Black ]; + const White = [ Color::White ]; } diff --git a/src/Enums/Color.php b/src/Enums/Color.php index 9f35580..32d4827 100644 --- a/src/Enums/Color.php +++ b/src/Enums/Color.php @@ -26,7 +26,7 @@ use MyCLabs\Enum\Enum; */ class Color extends Enum { - const black = 'B'; - const white = 'W'; - const none = '*'; + const Black = 'B'; + const White = 'W'; + const None = '*'; } diff --git a/src/Enums/Result.php b/src/Enums/Result.php index a064612..15922a2 100644 --- a/src/Enums/Result.php +++ b/src/Enums/Result.php @@ -26,15 +26,15 @@ use MyCLabs\Enum\Enum; */ class Result extends Enum { - const none = '*'; - const lost = '0'; - const draw = '0.5'; - const won = '1'; - const absent = '0 FF'; - const wonforfait = '1 FF'; - const adjourned = '0 A'; - const drawadjourned = '0.5 A'; - const wonadjourned = '1 A'; - const bye = '0 Bye'; - const wonbye = '1 Bye'; + const None = '*'; + const Lost = '0'; + const Draw = '0.5'; + const Won = '1'; + const Absent = '0 FF'; + const WonForfait = '1 FF'; + const Adjourned = '0 A'; + const DrawAdjourned = '0.5 A'; + const WonAdjourned = '1 A'; + const Bye = '0 Bye'; + const WonBye = '1 Bye'; } diff --git a/src/Game.php b/src/Game.php index 28ba8e1..0da15af 100644 --- a/src/Game.php +++ b/src/Game.php @@ -29,13 +29,13 @@ use DateTime; class Game { /** @var Pairing | null */ - private $white; + private $White; /** @var Pairing | null */ - private $black; + private $Black; /** @var GameResult | null */ - private $result; + private $Result; /** @var int */ private $Board; @@ -47,8 +47,8 @@ class Game */ public function getResult(): Gameresult { - if (!is_null($this->result)) { - return $this->result; + if (!is_null($this->Result)) { + return $this->Result; } $whiteResult = $this->getWhite()->getResult(); @@ -83,18 +83,18 @@ class Game */ public function getWhite(): ?Pairing { - return $this->white; + return $this->White; } /** * Sets pairing for white player * - * @param Pairing | null $white + * @param Pairing | null $White * @return Game */ - public function setWhite(?Pairing $white): Game + public function setWhite(?Pairing $White): Game { - $this->white = $white; + $this->White = $White; return $this; } @@ -105,30 +105,30 @@ class Game */ public function getBlack(): ?Pairing { - return $this->black; + return $this->Black; } /** * Sets pairing for black player * - * @param Pairing | null $black + * @param Pairing | null $Black * @return Game */ - public function setBlack(?Pairing $black): Game + public function setBlack(?Pairing $Black): Game { - $this->black = $black; + $this->Black = $Black; return $this; } /** * Sets result for game * - * @param Gameresult | null $result + * @param Gameresult | null $Result * @return Game */ - public function setResult(?Gameresult $result): Game + public function setResult(?Gameresult $Result): Game { - $this->result = $result; + $this->Result = $Result; return $this; } diff --git a/src/IOFactory.php b/src/IOFactory.php index c5f97c5..9b3e70e 100644 --- a/src/IOFactory.php +++ b/src/IOFactory.php @@ -33,7 +33,7 @@ abstract class IOFactory * * @var array */ - private static $readers = [ + private static $Readers = [ 'Swar-4' => Readers\Swar4::class, 'Pairtwo-6' => Readers\Pairtwo6::class, 'Pairtwo-5' => Readers\Pairtwo6::class // File structure identical @@ -51,12 +51,12 @@ abstract class IOFactory */ public static function createReader(string $type): ReaderInterface { - if (!isset(self::$readers[$type])) { + if (!isset(self::$Readers[$type])) { throw new LibpairtwoException("Cannot read type $type"); } // create reader class - $readerClass = self::$readers[$type]; + $readerClass = self::$Readers[$type]; $reader = new $readerClass; return $reader; diff --git a/src/Readers/Pairtwo6.php b/src/Readers/Pairtwo6.php index 0055b21..02dafb8 100644 --- a/src/Readers/Pairtwo6.php +++ b/src/Readers/Pairtwo6.php @@ -703,15 +703,15 @@ class Pairtwo6 implements ReaderInterface switch ($this->readData('Int', substr($swscontents, $offset, $length))) { case 255: case 253: - $color = Color::black; + $color = Color::Black; break; case 1: case 3: - $color = Color::white; + $color = Color::White; break; case 0: default: - $color = Color::none; + $color = Color::None; break; } $pairing->setColor(new Color($color)); @@ -720,38 +720,38 @@ class Pairtwo6 implements ReaderInterface $length = 1; switch ($this->readData('Int', substr($swscontents, $offset, $length))) { case 1: - $result = Result::lost; + $result = Result::Lost; break; case 2: - $result = Result::absent; + $result = Result::Absent; break; case 3: - $result = Result::adjourned; + $result = Result::Adjourned; break; case 4: - $result = Result::bye; + $result = Result::Bye; break; case 6: - $result = Result::draw; + $result = Result::Draw; break; case 8: - $result = Result::drawadjourned; + $result = Result::DrawAdjourned; break; case 11: - $result = Result::won; + $result = Result::Won; break; case 12: - $result = Result::wonforfait; + $result = Result::WonForfait; break; case 13: - $result = Result::wonadjourned; + $result = Result::WonAdjourned; break; case 14: - $result = Result::wonbye; + $result = Result::WonBye; break; case 0: default: - $result = Result::none; + $result = Result::None; break; } $pairing->setResult(new Result($result)); diff --git a/src/Readers/Swar4.php b/src/Readers/Swar4.php index 8ad9e54..6d0631a 100644 --- a/src/Readers/Swar4.php +++ b/src/Readers/Swar4.php @@ -37,10 +37,10 @@ class Swar4 implements ReaderInterface private $tournament; /** @var bool|int|DateTime|string[] */ - private $binaryData; + private $BinaryData; /** @var string */ - private $release; + private $Release; /** @var array */ private const CompatibleVersions = ['v4.']; @@ -430,46 +430,46 @@ class Swar4 implements ReaderInterface } switch ($this->getTournament()->getBinaryData('Pairing_' . $ptn . '_result')) { case '1000': - $result = Result::lost; + $result = Result::Lost; break; case '01': - $result = Result::absent; + $result = Result::Absent; break; case '0010': - $result = Result::bye; + $result = Result::Bye; break; case '2000': - $result = Result::draw; + $result = Result::Draw; break; case '4000': - $result = Result::won; + $result = Result::Won; break; case '04': - $result = Result::wonforfait; + $result = Result::WonForfait; break; case '40': - $result = Result::wonbye; + $result = Result::WonBye; break; case '00': default: - $result = Result::none; + $result = Result::None; break; } if (array_search($this->getTournament()->getBinaryData('Pairing_' . $ptn . '_table'), [ 16384, 8192 ]) !== false) { - $result = Result::absent; + $result = Result::Absent; } $pairing->setResult(new Result($result)); switch ($this->getTournament()->getBinaryData('Pairing_' . $ptn . '_color')) { case 4294967295: - $color = Color::black; + $color = Color::Black; break; case 1: - $color = Color::white; + $color = Color::White; break; case 0: default: - $color = Color::none; + $color = Color::None; break; } $pairing->setColor(new Color($color)); @@ -571,15 +571,15 @@ class Swar4 implements ReaderInterface */ public function getRelease(): string { - return $this->release; + return $this->Release; } /** - * @param string $release + * @param string $Release */ - public function setRelease(string $release): void + public function setRelease(string $Release): void { - $this->release = $release; + $this->Release = $Release; } /** diff --git a/src/Round.php b/src/Round.php index cc2aa99..910f942 100644 --- a/src/Round.php +++ b/src/Round.php @@ -32,28 +32,28 @@ class Round * * @var DateTime */ - private $date; + private $Date; /** * Array of all games * * @var Game[] */ - private $games = []; + private $Games = []; /** * Number of the round * * @var int */ - private $roundNo; + private $RoundNo; /** * Array of all pairings for this round * * @var Pairing[] */ - private $pairings = []; + private $Pairings = []; /** * Adds a game to the round @@ -94,7 +94,7 @@ class Round $allPairings = $this->getPairings(); $byePairings = []; foreach ($allPairings as $pairing) { - if ($pairing->getResult() == Result::wonbye) { + if ($pairing->getResult() == Result::WonBye) { $byePairings[] = $pairing; } } @@ -112,7 +112,7 @@ class Round $allPairings = $this->getPairings(); $absentPairings = []; foreach ($allPairings as $pairing) { - if ($pairing->getResult() == Result::absent) { + if ($pairing->getResult() == Result::Absent) { $absentPairings[] = $pairing; } } @@ -126,17 +126,17 @@ class Round */ public function getDate(): DateTime { - return $this->date; + return $this->Date; } /** * Sets the date of the round * - * @param DateTime $date + * @param DateTime $Date * @return Round */ - public function setDate(DateTime $date): Round + public function setDate(DateTime $Date): Round { - $this->date = $date; + $this->Date = $Date; return $this; } /** @@ -146,17 +146,17 @@ class Round */ public function getGames(): array { - return $this->games; + return $this->Games; } /** * Sets an array of all games for the round * - * @param Game[] $games + * @param Game[] $Games * @return Round */ - public function setGames(array $games): Round + public function setGames(array $Games): Round { - $this->games = $games; + $this->Games = $Games; return $this; } /** @@ -166,17 +166,17 @@ class Round */ public function getRoundNo(): int { - return $this->roundNo; + return $this->RoundNo; } /** * Sets the round number of the round * - * @param int $roundNo + * @param int $RoundNo * @return Round */ - public function setRoundNo(int $roundNo): Round + public function setRoundNo(int $RoundNo): Round { - $this->roundNo = $roundNo; + $this->RoundNo = $RoundNo; return $this; } /** @@ -186,17 +186,17 @@ class Round */ public function getPairings(): array { - return $this->pairings; + return $this->Pairings; } /** * Sets an array of all pairings for the round * - * @param Pairing[] $pairings + * @param Pairing[] $Pairings * @return Round */ - public function setPairings(array $pairings): Round + public function setPairings(array $Pairings): Round { - $this->pairings = $pairings; + $this->Pairings = $Pairings; return $this; } } diff --git a/src/Tournament.php b/src/Tournament.php index 0a3d8f5..efce818 100644 --- a/src/Tournament.php +++ b/src/Tournament.php @@ -103,7 +103,7 @@ class Tournament private $PriorityId = 'Nation'; /** @var bool|DateTime|int|string[] */ - private $binaryData = []; + private $BinaryData = []; /** * Gets a player by its ID @@ -244,10 +244,10 @@ class Tournament } } $game = new Game(); - if ($color->getValue() == Color::white) { + if ($color->getValue() == Color::White) { $game->setWhite($pairing); $game->setBlack($opponent); - } elseif ($color->getValue() == Color::black) { + } elseif ($color->getValue() == Color::Black) { $game->setWhite($opponent); $game->setBlack($pairing); } From 0902c30f3666e71a63c16655af481cdb3828eb88 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Sat, 28 Sep 2019 20:40:12 +0200 Subject: [PATCH 03/11] Added default boardno --- src/Readers/Pairtwo6.php | 1 + src/Readers/Swar4.php | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/Readers/Pairtwo6.php b/src/Readers/Pairtwo6.php index 02dafb8..86f5aec 100644 --- a/src/Readers/Pairtwo6.php +++ b/src/Readers/Pairtwo6.php @@ -760,6 +760,7 @@ class Pairtwo6 implements ReaderInterface $pairing->setRound($x); $offset += 2; + $pairing->setBoard(-1); if ($x < $this->getBinaryData("CurrentRound")) { $this->getTournament()->addPairing($pairing); } diff --git a/src/Readers/Swar4.php b/src/Readers/Swar4.php index 6d0631a..4bae6dc 100644 --- a/src/Readers/Swar4.php +++ b/src/Readers/Swar4.php @@ -473,6 +473,8 @@ class Swar4 implements ReaderInterface break; } $pairing->setColor(new Color($color)); + + $pairing->setBoard($this->getTournament()->getBinaryData('Pairing_' . $ptn . '_table')); $ptn++; $this->getTournament()->addPairing($pairing); } From 1708a54d0aa8981fdad68ed52b8e67b309abf05b Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Sat, 28 Sep 2019 20:52:23 +0200 Subject: [PATCH 04/11] set board zerobased --- src/Readers/Swar4.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Readers/Swar4.php b/src/Readers/Swar4.php index 4bae6dc..de91687 100644 --- a/src/Readers/Swar4.php +++ b/src/Readers/Swar4.php @@ -405,7 +405,7 @@ class Swar4 implements ReaderInterface for ($j = 0; $j < $player->getBinaryData('AllocatedRounds'); $j++) { $this->getTournament()->setBinaryData('Pairing_' . $pt . '_player', $i); $this->getTournament()->setBinaryData('Pairing_' . $pt . '_round', $this->readData('Int', $swshandle) - 1); - $this->getTournament()->setBinaryData('Pairing_' . $pt . '_table', $this->readData('Int', $swshandle)); + $this->getTournament()->setBinaryData('Pairing_' . $pt . '_table', $this->readData('Int', $swshandle) - 1); $this->getTournament()->setBinaryData('Pairing_' . $pt . '_opponent', $this->readData('Int', $swshandle)); $this->getTournament()->setBinaryData('Pairing_' . $pt . '_result', $this->readData('Hex', $swshandle)); $this->getTournament()->setBinaryData('Pairing_' . $pt . '_color', $this->readData('Int', $swshandle)); @@ -473,7 +473,7 @@ class Swar4 implements ReaderInterface break; } $pairing->setColor(new Color($color)); - + $pairing->setBoard($this->getTournament()->getBinaryData('Pairing_' . $ptn . '_table')); $ptn++; $this->getTournament()->addPairing($pairing); From 2eb570ce7cd9a534c04374cbf98b99f148312ac4 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Sat, 28 Sep 2019 20:54:59 +0200 Subject: [PATCH 05/11] Implemented setting board if not set yet --- src/Tournament.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/Tournament.php b/src/Tournament.php index efce818..a9196c9 100644 --- a/src/Tournament.php +++ b/src/Tournament.php @@ -226,6 +226,10 @@ class Tournament /** @var Pairing[] */ $cache = array(); + /** @var int[] */ + $lastboards; + + /** @var Pairing $pairing */ foreach ($pairings as $pairing) { // Add pairing to player $pairing->getPlayer()->addPairing($pairing); @@ -234,6 +238,11 @@ class Tournament $this->getRoundByNo($round)->addPairing($pairing); $opponent = null; + + /** + * @var int $key + * @var Pairing $cached + */ foreach ($cache as $key=>$cached) { if (!is_null($cached)) { if (($cached->getOpponent() == $pairing->getPlayer()) && ($cached->getRound() == $pairing->getRound())) { @@ -257,6 +266,18 @@ class Tournament } else { // Check if game already exists if (!$this->gameExists($game, $round)) { + $game->setBoard($game->getWhite()->getBoard()); + // Add board if inexistent + if($game->getBoard() == -1) { + if (isset($lastboards[$round])) { + $lastboards[$round] += 1; + } else { + $lastboards[$round] = 0; + } + $game->setBoard($lastboards[$round]); + $game->getWhite()->setBoard($lastboards[$round]); + $game->getBlack()->setBoard($lastboards[$round]); + } $this->AddGame($game, $round); } } From 5314bc47f2e5c938a3d382039007fbb540fac83e Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Sat, 28 Sep 2019 21:09:56 +0200 Subject: [PATCH 06/11] Code style fixups --- src/Round.php | 8 ++++++-- src/Tournament.php | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Round.php b/src/Round.php index 910f942..8e07278 100644 --- a/src/Round.php +++ b/src/Round.php @@ -83,7 +83,6 @@ class Round return $this; } - /** * Returns an array of pairings where the player is bye * @@ -101,7 +100,6 @@ class Round return $byePairings; } - /** * Returns an array of pairings where the player is absent * @@ -139,6 +137,7 @@ class Round $this->Date = $Date; return $this; } + /** * Returns an array of all games for the round * @@ -148,6 +147,7 @@ class Round { return $this->Games; } + /** * Sets an array of all games for the round * @@ -159,6 +159,7 @@ class Round $this->Games = $Games; return $this; } + /** * Returns the round number of the round * @@ -168,6 +169,7 @@ class Round { return $this->RoundNo; } + /** * Sets the round number of the round * @@ -179,6 +181,7 @@ class Round $this->RoundNo = $RoundNo; return $this; } + /** * Returns an array of all pairings for the round * @@ -188,6 +191,7 @@ class Round { return $this->Pairings; } + /** * Sets an array of all pairings for the round * diff --git a/src/Tournament.php b/src/Tournament.php index a9196c9..f147de8 100644 --- a/src/Tournament.php +++ b/src/Tournament.php @@ -365,7 +365,7 @@ class Tournament $tosortplayers = $sortedplayers; $sortedplayers = []; foreach ($tosortplayers as $groupkey=>$sortedplayerselem) { - usort($tosortplayers[$groupkey], $this->SortTiebreak($tbkey)); + usort($tosortplayers[$groupkey], $this->sortTiebreak($tbkey)); foreach ($tosortplayers[$groupkey] as $playerkey => $player) { if (!is_null($player->getTiebreaks()[$tbkey])) { if ($playerkey != 0) { From 575b786079a879bdc0a7efa7c1008da6dde1bdd9 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Sat, 28 Sep 2019 21:19:35 +0200 Subject: [PATCH 07/11] Created function Round::getGamesbyBoard --- src/Round.php | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/Round.php b/src/Round.php index 8e07278..ca73537 100644 --- a/src/Round.php +++ b/src/Round.php @@ -117,6 +117,33 @@ class Round return $absentPairings; } + /** + * Retuns an array with the games of this round sorted by board + * + * @return Game[] + */ + public function getGamesByBoard(): array + { + $allGames = $this->getGames(); + usort($allGames, array($this, 'sortByBoard')); + return $allGames; + } + + /** + * Sort by board + * + * @param Game $a + * @param Game $b + * @return int + */ + private function sortByBoard(Game $a, Game $b): int + { + if (($a->getBoard() == $b->getBoard()) || ($a->getBoard() === false) || ($b->getBoard() === false)) { + return 0; + } + return ($a->getBoard() > $b->getBoard()) ? +1 : -1; + } + /** * Returns the date of the round * @@ -191,7 +218,7 @@ class Round { return $this->Pairings; } - + /** * Sets an array of all pairings for the round * From fe28a603440effbf1d5987e374d872c8cf036841 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Sat, 28 Sep 2019 21:21:19 +0200 Subject: [PATCH 08/11] Updated distribution to include board --- dist/template.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dist/template.php b/dist/template.php index 35d7ec1..5397094 100644 --- a/dist/template.php +++ b/dist/template.php @@ -40,11 +40,12 @@ foreach ($reader->getTournament()->getRounds() as $round) { echo '' . PHP_EOL; echo '' . PHP_EOL; - echo '' . PHP_EOL; + echo '' . PHP_EOL; echo '' . PHP_EOL; echo '' . PHP_EOL; - foreach ($round->getGames() as $game) { + foreach ($round->getGamesByBoard() as $game) { echo '' . PHP_EOL; + echo '' . PHP_EOL; echo '' . PHP_EOL; echo '' . PHP_EOL; echo '' . PHP_EOL; From 05e241d7bafc51b200d568c288a0ce4b3f7a4af4 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Sat, 28 Sep 2019 21:26:38 +0200 Subject: [PATCH 09/11] Updated changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e61d30..5f5a58d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # CHANGELOG ## vx.y.z (Release: aa-bbb-cccc) +* NEW FEATURE: `Game::getBoard()` for getting the board number of the game +* ENHANCEMENT: Some fields has been renamed to match coding guideline (Please see [1ab96fa](https://github.com/JeroenED/libpairtwo/commit/1ab96fa04782c1b0f2b6bb9d1bac8397a74ab38e) for more info) ## v1.2 (Release: 28-sep-2019) * NEW READER: `Reader::swar-4` for reading out files created with SWAR version 4. From 1793817f660557987e9eeac7ee76f07b9e9a753e Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Sat, 28 Sep 2019 21:35:52 +0200 Subject: [PATCH 10/11] Fixup of boardno in distributions template --- dist/template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/template.php b/dist/template.php index 5397094..330af7e 100644 --- a/dist/template.php +++ b/dist/template.php @@ -45,7 +45,7 @@ foreach ($reader->getTournament()->getRounds() as $round) { echo '' . PHP_EOL; foreach ($round->getGamesByBoard() as $game) { echo '' . PHP_EOL; - echo '' . PHP_EOL; + echo '' . PHP_EOL; echo '' . PHP_EOL; echo '' . PHP_EOL; echo '' . PHP_EOL; From 673821b5417de0bd003a754927dd5c56775de4ea Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Sat, 28 Sep 2019 21:47:24 +0200 Subject: [PATCH 11/11] Code style fixup --- src/Tournament.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tournament.php b/src/Tournament.php index f147de8..4a5c3be 100644 --- a/src/Tournament.php +++ b/src/Tournament.php @@ -268,7 +268,7 @@ class Tournament if (!$this->gameExists($game, $round)) { $game->setBoard($game->getWhite()->getBoard()); // Add board if inexistent - if($game->getBoard() == -1) { + if ($game->getBoard() == -1) { if (isset($lastboards[$round])) { $lastboards[$round] += 1; } else {
WhiteBlackResult
WhiteBlackResult
' . $game->getBoard() . '' . $game->getWhite()->getPlayer()->getName() . '' . $game->getBlack()->getPlayer()->getName() . '' . $game->getResult()->getValue() . '
' . $game->getBoard() . '' . ($game->getBoard() + 1) . '' . $game->getWhite()->getPlayer()->getName() . '' . $game->getBlack()->getPlayer()->getName() . '' . $game->getResult()->getValue() . '