Skip to content

Commit

Permalink
Renamed halfMoveClock as halfmoveClock
Browse files Browse the repository at this point in the history
  • Loading branch information
programarivm committed Feb 25, 2025
1 parent c7cb2b7 commit 053f364
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/Variant/AbstractBoard.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ abstract class AbstractBoard extends \SplObjectStorage
*
* @var int
*/
public int $halfMoveClock = 0;
public int $halfmoveClock = 0;

/**
* Picks a piece from the board.
Expand Down Expand Up @@ -441,7 +441,7 @@ public function undo(): AbstractBoard
$namespace = (new \ReflectionClass(get_class($this)))->getNamespaceName();
$board = "$namespace\FenToBoardFactory"::create($startFen, $this);
$this->castlingAbility = $board->castlingAbility;
$this->halfMoveClock = explode(' ', $startFen)[4] ?? 0;
$this->halfmoveClock = explode(' ', $startFen)[4] ?? 0;
array_pop($this->history);
$this->rewind();
while ($this->valid()) {
Expand Down Expand Up @@ -551,7 +551,7 @@ public function isFivefoldRepetition(): bool
*/
public function isFiftyMoveDraw(): bool
{
return $this->halfMoveClock >= 100;
return $this->halfmoveClock >= 100;
}

/**
Expand Down Expand Up @@ -698,7 +698,7 @@ public function toFen(): string
$filtered = str_replace(str_repeat('.', $i), $i, $filtered);
}

return "{$filtered} {$this->turn} {$this->castlingAbility} {$this->enPassant()} {$this->halfMoveClock}";
return "{$filtered} {$this->turn} {$this->castlingAbility} {$this->enPassant()} {$this->halfmoveClock}";
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Variant/AbstractPiece.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,14 +395,14 @@ public function updateCastlingAbility(): AbstractPiece
public function updateHalfMoveClock(): void
{
if (str_contains($this->move['case'], 'x')) {
$this->board->halfMoveClock = 0;
$this->board->halfmoveClock = 0;
} elseif (
$this->move['case'] === $this->board->move->case(Move::PAWN) ||
$this->move['case'] === $this->board->move->case(Move::PAWN_PROMOTES)
) {
$this->board->halfMoveClock = 0;
$this->board->halfmoveClock = 0;
} else {
$this->board->halfMoveClock += 1;
$this->board->halfmoveClock += 1;
}
}

Expand Down

0 comments on commit 053f364

Please sign in to comment.