Skip to content

Commit

Permalink
Updated the 'Data Conversion' section
Browse files Browse the repository at this point in the history
  • Loading branch information
programarivm committed May 8, 2024
1 parent 7548c34 commit 358d702
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions docs/data-conversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

✨ FEN stands for Forsyth-Edwards Notation and is the standard way for describing chess positions using text strings.

Almost everything in PHP Chess can be done with a chessboard object. At some point you'll definitely want to convert a FEN string into a chessboard object for further processing, and this can be done with the [Chess\FenToBoardFactory](https://github.com/chesslablab/php-chess/blob/main/src/FenToBoardFactory.php) class according to the variants supported.

Let's continue a classical game from the FEN position of B54, which is the ECO code for "Sicilian Defense: Modern Variations, Main Line" previously discussed in [Read PGN](https://php-chess.docs.chesslablab.org/read-pgn/).
At some point you'll definitely want to convert a FEN string into a chessboard object for further processing, and this can be done with the [Chess\FenToBoardFactory](https://github.com/chesslablab/php-chess/blob/main/src/FenToBoardFactory.php) class according to the variants supported.

```php
use Chess\FenToBoardFactory;
Expand All @@ -23,7 +21,7 @@ echo $board->toFen();
r1bqkb1r/pp2pppp/2np1n2/8/3NP3/2N5/PPP2PPP/R1BQKB1R w KQkq -
```

It is worth saying that after 5.Nc3 Nc6, B54 has turned into B56 which is the ECO code for "Sicilian Defense: Classical Variation" and the history contains two moves only.
When a single parameter is passed in the form of a FEN string into the factory create method, it will be assumed that you want to create a classical chess board object. In this example the game history contains two moves only.

```php
var_dump($board->getHistory());
Expand Down

0 comments on commit 358d702

Please sign in to comment.