I'm a software developer.
Some technologies I enjoy working with include React, Next, Gatsby, Jamstack (JavaScript, APIs + Markup), Styled Components and GraphQL.
Chessboard logic with movement check
Thanks a lot for this very nice library. As far as I understand, the only way to add a move would be
chess.move('e2','e4');
However, there a couple of notations, for example, Stockfish and Lc0 produce moves like e2e4
and if you play at chess.com they notate it like e4
or Nf3
etc.
I've used chess.js before and that lib has a very extended support for moves, but that project seems dead to me. Any plans to support that?
I just ran into the following situation with castling. The fen is
1r2k2r/ppp2ppp/8/3N1b2/3n4/8/PP2PPPP/R3KB1R w KQk - 0 13
(source)
White to move, which does: e1c1
import { Chess } from 'chess-base';
const fen = '1r2k2r/ppp2ppp/8/3N1b2/3n4/8/PP2PPPP/R3KB1R w KQk - 0 13';
const chess = new Chess(fen);
chess.move('e1c1');
Which gives an error ending with: castling target
We've discussed this before ( #3 ) and I must say that I find the castling notation very confusing. Any ideas what might be the problem in this situation?
Thanks for adding this already. I noticed two issues (I think)
First one is castling. Consider the following
import { Chess } from 'chess-base';
const chess = new Chess('rnbq1rk1/p3bpp1/1p2pn1p/2ppN3/3P3B/2N1P3/PPP1BPPP/R2QK2R w KQ c6 0 9');
When I try to castle
chess.move('e1', 'g1'); // --> Throws error
It seems that you can only castle with
chess.castlingKing(); // or
chess.move('O-O'); // <- very nice!!
It would be nice to support 'e1', 'g1' notation (I get this notation from chess engines)
The other issue I noticed is with the following fen string 8/P7/7k/8/8/8/K7/8 w - - 0 61
If the pawn moves from a7
to a8
you cannot do
chess.move('a8', 'q');
but instead you have to do
chess.move('a7', 'a8', 'q');
Hope this makes any sense, cheers!
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.