mirror of
https://github.com/lichess-org/dartchess.git
synced 2026-05-26 13:51:01 +00:00
Rename isChess960 to includeAlternateCastlingMoves
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
## 0.11.0
|
||||
|
||||
- Rename `makeLegalMove` parameter `isChess960` to
|
||||
`includeAlternateCastlingMoves` and invert its meaning. It now defaults to
|
||||
`false`.
|
||||
|
||||
## 0.10.0
|
||||
|
||||
- Remove the type parameter from `Position` class.
|
||||
|
||||
+3
-3
@@ -5,10 +5,10 @@ import 'position.dart';
|
||||
|
||||
/// Returns all the legal moves of the [Position] in a convenient format.
|
||||
///
|
||||
/// Includes both possible representations of castling moves (unless `chess960` is true).
|
||||
/// Includes both possible representations of castling moves unless `includeAlternateCastlingMoves` is false.
|
||||
IMap<Square, ISet<Square>> makeLegalMoves(
|
||||
Position pos, {
|
||||
bool isChess960 = false,
|
||||
bool includeAlternateCastlingMoves = true,
|
||||
}) {
|
||||
final Map<Square, ISet<Square>> result = {};
|
||||
for (final entry in pos.legalMoves.entries) {
|
||||
@@ -16,7 +16,7 @@ IMap<Square, ISet<Square>> makeLegalMoves(
|
||||
if (dests.isNotEmpty) {
|
||||
final from = entry.key;
|
||||
final destSet = dests.toSet();
|
||||
if (!isChess960 &&
|
||||
if (includeAlternateCastlingMoves &&
|
||||
from == pos.board.kingOf(pos.turn) &&
|
||||
entry.key.file == 4) {
|
||||
if (dests.contains(Square.a1)) {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
name: dartchess
|
||||
description: Provides chess and chess variants rules and operations including chess move generation, read and write FEN, read and write PGN.
|
||||
repository: https://github.com/lichess-org/dartchess
|
||||
version: 0.10.0
|
||||
version: 0.11.0
|
||||
platforms:
|
||||
android:
|
||||
ios:
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ void main() {
|
||||
),
|
||||
);
|
||||
expect(
|
||||
makeLegalMoves(pos, isChess960: true)[Square.b8],
|
||||
makeLegalMoves(pos, includeAlternateCastlingMoves: false)[Square.b8],
|
||||
equals(ISet(const {Square.a8, Square.c8, Square.e8})),
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user