davecom / chess.dart Goto Github PK
View Code? Open in Web Editor NEWA library for legal chess move generation, maintenance of game state, and format conversion.
License: Other
A library for legal chess move generation, maintenance of game state, and format conversion.
License: Other
Hello, thank you for your chess package.
There's a problem though.
When I do load_pgn, I don't get pgn headers except for Result.
Is it a bug or feature?
I have a package flutter_chess_board on DartPub which has chess as a dependency. It worked fine until Dart 2.1.0 was released. After release, pub analysis gives this as an analysis error:
ERR: The current Dart SDK version is 2.1.0-dev.1.0.flutter-69fce633b7.
Because flutter_chess_board depends on chess >=0.0.2 which requires SDK version <2.0.0, version solving failed.
Note: This is my pubspec.yaml dependency line ->
chess: ">=0.6.4 <0.7.0"
I am calling the pgn() method on a board in progress, and the resulting move text is not terminated with the expect * character that denotes an in progress game.
An example of a string that the pgn method is returning is as follows...
"1. d4 d5 2. Qd3 c5 3. e4 "
I am observing a very strange behaviour where sometimes a copied board will have a different turn....sort of. The issue is not yet reproducible reliably, but I am obseriving it happen often.
Basically, I have a Chess object whose turn variable is white. I deep copy the object, and the resulting boards turn variable toString() returns 'b'. It seems like the internal int value (which underneath is like a double) has some sort of precision error.
Observations:
-the turn variable is a Color class.
-the initial turn variable Color instance, and the subsequent copied turn variable Color instance both have an internal value of 0 (aka WHITE).
-if you call toString() on the first instance it returns 'w', and on the second instance 'b'.
-if you use the value of the new turn variable for comparisons, it will not match to either white of black.
-because of this, the generate_moves() (with legal flag), always returns and empty list (when it should actually return many moves).
Some thoughts....
Could the Color class just be an enum to simplify things? I was looking into making this change (and it did fix the problem), but I am not quite sure if I broke something. For example there is a ColorMap class that seems intimately coupled with the Color class.
Hi,
great work! Do you plan to support null safety anytime soon?
Hi,
when exporting a pgn game and the starting position differs from default, the [FEN]-Header is correctly exported. But when reading the same pgn game, the [FEN] header seems to be ignored - so game data cannot be loaded correctly.
Bug or Feature?
Best Regards and thanks for the great library,
Tobias
In the Chess class, the variable name "half_move" is being used as a counter for the 50-move rule. At first sight it seems like half_move is another name for a ply(A half move) and can be easily misunderstood. "half_move" being named to something like drawCounter would be more appropriate in my opinion.
The moves function within the package generates inaccurate moves for a pawn situated on square e5 in specific scenarios. The issue arises when it produces the following available moves:
e5 to e6
e5 to d6 (incorrect move)
Additionally, the function incorrectly permits the pawn to move to d6, resulting in the removal of the pawn on d5 from the board.
Steps to Reproduce the Issue:
Set up a scenario where either your or your opponent's pawn is already positioned on the 6th row.
Move a pawn from a neighboring column two steps forward.
This sequence triggers the generation of incorrect moves, including the flawed move from e5 to d6.
Sample fen:
rnbqkbnr/ppp1p1pp/8/3pPp2/8/8/PPPP1PPP/RNBQKBNR w KQkq d6 0 3
Is there currently any support for detecting pawn promotion?
I've noticed that each row in SQUARES map skips by 8 each row, is there a reason for this?
even tho I assign a correct fen always give this error 6th field (move number) must be a positive integer.
Ng6 notation not working on move method.
Is possible, this notation will be supported in futur ?
I've a pgn string which has only FEN and SetUp headers.
[FEN "1q3rk1/2p2ppp/8/5N2/8/2PQ4/PP6/1K1R4 w - - 0 1"]
[SetUp "1"]
As shown on the image I can easily use this pgn in Chess.com's Analysis Part.
I can also download the regular pgn format (you can see on the attached image) for this game from 'Download' part.
The problem is for these kind of formats when loadPgn method returns always false even if I use the standart pgn format which I get from the Chess.com
I think the main reason is about the initial board position because on the Debug section I got a null 'Move' variable in line 1467.
Hey Dave,
Running pub build --web-compiler=dartdevc while having dependencies: chess: 0.6.2
will fail. The gist is what pub outputs https://gist.github.com/unibeck/6fd1246fc8444cb6cb8d3cd481413838. Let me know if you need anymore information.
The following PGN is not loaded successfully because of "...":
[SetUp "1"]
[FEN "rnbqkbnr/pppppppp/8/8/3PP3/8/PPP2PPP/RNBQKBNR b KQkq - 0 1"]
1. ... c5 2. dxc5 Qa5+
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.