Skip to content

Commit

Permalink
Castling rights default parse to none
Browse files Browse the repository at this point in the history
  • Loading branch information
alexobviously committed Feb 4, 2024
1 parent 5e45cab commit 4537a33
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 1.4.1
- **Potentially breaking**: FEN strings without castling rights specified now default to no castling rights, instead of all castling rights.

### 1.4.0
- Custom move generation and processing (beta):
- `MoveGenerator`: optionally supply a list of these in `Variant.moveGenerators`. These can be used to generate custom moves based on the state. You can generate both normal move types (e.g. add an extra move to a piece on a certain square or something), or totally different types of move that can be managed by `MoveProcessor`.
Expand Down
6 changes: 2 additions & 4 deletions lib/src/fen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ ParseFenResult parseFen({
if (!(['w', 'b'].contains(turnStr))) {
throw ("Invalid FEN: colour should be 'w' or 'b'");
}
String castlingStr = (strict || sections.length > 2)
? sections[2]
: 'KQkq'; // TODO: get default castling for variant
String castlingStr = (strict || sections.length > 2) ? sections[2] : '-';
String epStr = (strict || sections.length > 3) ? sections[3] : '-';
String halfMoves = (strict || sections.length > 4) ? sections[4] : '0';
String fullMoves = (strict || sections.length > 5) ? sections[5] : '1';
Expand All @@ -88,7 +86,7 @@ ParseFenResult parseFen({
List<String> fileStrings = sections[0].split('/');
List<String> gateStrings = [
fileStrings.removeAt(0),
fileStrings.removeAt(fileStrings.length - 1)
fileStrings.removeAt(fileStrings.length - 1),
];
boardSymbols = fileStrings.join('/').split(''); // rebuild
for (int i = 0; i < 2; i++) {
Expand Down

0 comments on commit 4537a33

Please sign in to comment.