lichess-org / dartchess Goto Github PK
View Code? Open in Web Editor NEWDart chess library for native platforms
License: GNU General Public License v3.0
Dart chess library for native platforms
License: GNU General Public License v3.0
We need a dart PGN parser for the next lichess mobile app.
A good first version would parse a linear sequence of moves, no variations, no comments.
It's recommended to mimic the chessops typescript library:
This is a good first issue to get started with the dart language, and therefore with the development of the next mobile app.
Please drop by our discord server to discuss it https://discord.gg/lichess
EDIT:
One request: we should strive to have an immutable API because the rest of dartchess is immutable. Internal implementation can be mutable of course, for performance considerations, but the resulting Game
type should be immutable.
Hello!
I found a problem when loading pgn with '{\nsome comments' pattern. May be even inside '(' variation
I added example modified file wcc_2023_1.pgn
wcc_2023_1.txt
And when I run the following code the application hangs
void main(List<String> args) {
final String data = File('bin/pgn/wcc_2023_1.pgn').readAsStringSync();
final List<PgnGame<PgnNodeData>> games = PgnGame.parseMultiGamePgn(data);
print('Games: ${games.length}');
print('Game 1: ${games[0].makePgn()}');
}
We need the ability to parse SAN for a Position
.
Implement a method in Position
class, whose signature is Move? parseSAN(String san)
. The move returned should be a legal move of the position, if any.
It should support crazyhouse and drop moves too.
Example implementation on: https://github.com/niklasf/chessops/blob/f287455e1cc83925c9f759f3c8829e2ca89d243f/src/san.ts#L82
Hi! Excellent package! Do you plan to add web?
Currently perft tests run alongside normal tests. It prevent us to run perft with increased depth.
Hi,
Library Version: dartchess: ^0.6.1
I am using the following test-code to query the allowed moves of the king:
String fen =
"rnbqk2r/ppppbppp/4p1N1/4P3/8/B7/PPPPBPPP/RN1QK2R w KQkq - 0 1";
final chess = Chess.fromSetup(Setup.parseFen(fen));
SquareSet set = chess.legalMovesOf(Squares.e1);
for (var element in set.squares) {
developer.log(element.toString());
}
Iterable<Square> squares = set.squares;
expect(squares.length, 2);
expect(squares.first, Squares.f1);
expect(squares.last, Squares.g1);
Expected: King has two fields, f1 and g1 (in case of castling).
Problem: legalMovesOf gives back the fields f1 and h1, which seems to be odd?
When executing a move, it is possible to execute the move chess.play(NormalMove(from: Squares.e1, to: Squares.g1));
, which again seems to be odd, as g1 is not recognized as a legal move.
Best Regards,
Tobias
_copyWith() carries the epSquare forward to the next move when a DropMove is played, which makes this sequence possible:
Should increase performance by removing the wrapper class.
Cf: #13 for perft tests that discovered new bugs.
Currently the Setup class supports the fen with Setup.parseFen constructor,
almost lichess endpoints for puzzles returns a Pgn string, it would be nice if there is some Setup.parsePgn
_getCastlingSide() creates all sorts of "legal" castling moves where the king is moved onto another piece of its own color.
e.g. depending on the setup, I saw things like Ka2, Kd4, and Kf3 (moving onto his own pawn or knight) resulting in a kingside castle, and Ke1 (moving onto its own square) resulting in a queenside castle. In one position I had 13 legal moves that resulted in a castle. They all involved moving onto another friendly piece or e1.
Hi Vincent!
Yes, something is messed up in my repo. I can no longer make commits and from my googling it looks like the only option I have is to delete it entirely and rebuild. Here are screenshots of the diffs and comments, because I assume that all that history will be lost once I do that.
Sorry for the hassle.
Kind regards,
David
ChessSharp PR 1 - diffs and comments.pdf
ChessSharp PR 2 - diffs.pdf
Currently 2 tests are not passing:
Currently 1 test is not passing:
https://github.com/lichess-org/dartchess/blob/main/test/pgn_test.dart#L317
See #13 for perft tests that discovered new bugs.
This position cannot be reached by standard chess from initial position:
id align-ep
epd 8/8/8/1k6/3Pp3/8/8/4KQ2 b - d3
perft 1 6
perft 2 121
perft 3 711
When dartchess supports optional validity requirements, it should be able to validate that perft.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.