GithubHelp home page GithubHelp logo

jhlywa / chess.js Goto Github PK

View Code? Open in Web Editor NEW
3.5K 3.5K 872.0 1.21 MB

A TypeScript chess library for chess move generation/validation, piece placement/movement, and check/checkmate/draw detection

License: BSD 2-Clause "Simplified" License

JavaScript 0.52% TypeScript 99.45% Shell 0.03%
chess

chess.js's People

Contributors

2sb18 avatar algotrader avatar allonhadaya avatar angarc avatar azer avatar blakmatrix avatar chrisantley1 avatar davidmpaz avatar dependabot[bot] avatar eleurent avatar fitztrev avatar gabrieldelepine avatar gavin-lb avatar icecream17 avatar imor avatar jamjomjim avatar jhlywa avatar jorgecasar avatar justinfagnani avatar jzacsh avatar kevo1ution avatar krzysiekwyka avatar linrock avatar manukyanq avatar moroshko avatar neofight78 avatar relequestual avatar sebv avatar siansell avatar svangordon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chess.js's Issues

Using prototype to static variables

Hello everybody.

fine. I was not sure to send this issue, I'm rather satisfy a doubt, and nice if also helps to improve the project.

Well, i'm not sure if variables like Chess.BLACK and Chess.PAWN should be static. if so, you could use prototype property. Something like:

Chess.prototype = {
BLACK: 'b',
WHITE: 'w',
EMPTY: -1
};

It could also be used for the functions.

Sorry for my English.

Damn subtle bug

var pos=new Chess('b3k2r/5p2/4p3/1p5p/6p1/2PR2P1/BP3qNP/6QK b k - 2 28')
undefined

pos.fen()
"b3k2r/5p2/4p3/1p5p/6p1/2PR2P1/BP3qNP/6QK b k - 2 28"

pos.move({from:'a8', to:'g2'})
Object {color: "b", from: "a8", to: "g2", flags: "c", piece: "b"…}

pos.fen()
"4k2r/5p2/4p3/1p5p/6p1/2PR2P1/BP3qbP/6QK w kq - 0 29"

The black king obtained the queenside castle! Magic! Losing castle status may happen, but restoring castle status is something very new in the chess!

npm package

Hi Jeff,

it would be nice to add a package.json and make this library available in npm. That's not exactly setting the world on fire but would be nice :)

Thanks and Greets from Germany,
Falco

Move flags

Is there a list of possible move flags combinations? In the docs, other than the single-flag string, a pc value (promotion-capture) is mentioned.

I'm not sure if there are other possible combinations like that one. Can someone enlighten me? πŸ˜„

Adding rewind option to load_pgn

I might just not fully understand how to use chess.js, but I was hoping to parse some PGN then start from the first move for a PGN player. I'm able to make this work with minor modifications that would not affect how anybody might currently be relying on load_pgn to work (returning true), as follows at the very bottom of the method. Notice that I also return the moves so that I can start from the first move for a PGN. Again maybe I'm misunderstanding how to use chess.js so if this is not useful but somebody can nevertheless please share some insight, I don't mind if the issue gets closed but with comments please ;) Thanks in advance:

  //return true;
  if (options.rewind) {
    reset();
    return moves;
  }
  else {
    return true;
  }

reformating using prototype

FYI, I've done some refactoring in this branch using prototype, and class static for constant, cause I was having a hard time to follow the code in its current form. Let me know if you want to move it to master and I'll prepare a PR.

Tests are passing, and It should be backward compatible, except for the constants which are now on the Chess classes.

package.json is broken

Just thought you should know, line 13 of package.json has a comma at the end when it shouldn't which causes chess.js to not install correctly with npm.

Trying to load a custom FEN

Hello, I'm trying to create a tutorial called Pawn Wars, which is a normal chess game with only pawns. I am loading the FEN "8/pppppppp/8/8/8/8/PPPPPPPP/8", but it keeps returning false (invalid). Can you think of any way I can load this fen into chessjs?

Promotion

Hello jhlywa,

Could we have an example in your package (in "master" or in your jquery "widget") in which you can choose the piece you want to take when you are promoting a pawn.

It could be very good for people whom don't practise javascript every day.

Thanks for that tool, it is a good one πŸ‘

Thierry

pgn generator

If no tags are used in the pgn, a newline is inserted at the start of the output.

Publish to npm

First off, let me say that this is such a great library! It's been indispensable to me in writing other JS chess code.

I'm publishing node/browser code to npm that depends on chess.js and the last published version of this library is 0.1.0 which has some differences (based on a quick diff of the code). It'd be very helpful to have the latest code on npm (and for future updates). Bonus points if it follows semver πŸ˜„

Thanks!

bug: pgn headers write in double due to forgotten regex~ness of string

bug description copy/pasted from jzacsh@232e5d0

var chess = new Chess();
chess.move({from: 'e2', to: 'e4'});
var pgn = chess.pgn({max_width: 5, newline_char: '\n'});
// output:
// [White "carolyn"]
// [Black "hippo"]
// [Date "2014-1-18"]
// 
// 1. e4

var chessB = new Chess();
chessB.load_pgn(pgn);

// BUG HERE:
chessB.pgn({max_width: 5, newline_char: '\n'});
// outputs: [[White "carolyn"] [Black "hippo"] [Date "2014-1-18"] "[White "carolyn"] [Black "hippo"] [Date "2014-1-18"]"]  1. e4

test added that confirms this behavior in: jzacsh@fa55217

What the reason for the 8 gap between rows in SQUARES?

Just wondering, I guess it is performance related.

var SQUARES = {
    a8:   0, b8:   1, c8:   2, d8:   3, e8:   4, f8:   5, g8:   6, h8:   7,
    a7:  16, b7:  17, c7:  18, d7:  19, e7:  20, f7:  21, g7:  22, h7:  23,
    a6:  32, b6:  33, c6:  34, d6:  35, e6:  36, f6:  37, g6:  38, h6:  39,
    a5:  48, b5:  49, c5:  50, d5:  51, e5:  52, f5:  53, g5:  54, h5:  55,
    a4:  64, b4:  65, c4:  66, d4:  67, e4:  68, f4:  69, g4:  70, h4:  71,
    a3:  80, b3:  81, c3:  82, d3:  83, e3:  84, f3:  85, g3:  86, h3:  87,
    a2:  96, b2:  97, c2:  98, d2:  99, e2: 100, f2: 101, g2: 102, h2: 103,
    a1: 112, b1: 113, c1: 114, d1: 115, e1: 116, f1: 117, g1: 118, h1: 119
  };

Incorrect SAN generated.

screen shot 2015-02-10 at 21 26 25

In the image attached, the knight on C3 is absolutely pinned.
The next move made is Nge2, but the SAN generated is Ne2.

FEN:

rn2k2r/pppq1ppp/5p2/3p4/1b1P4/2NQP3/PPP2PPP/R3K1NR w KQkq - 0 1

Interface and AI Created

Hi guys,

I wanted to let you know about the chess game I made ontop of chess.js. You have building a jQuery interface and AI on your todo list. Feel free to steal any of it from my code or suggest how you'd like it best put into yours and I'll port it over (its currently a wrapper around chess.js)

See the source

Play the game

Javascript Chess

Won't accept FEN

Hello,

I am using your script with chessboard.js.

Here is the FEN: '8/8/2BkbRp1/1pb1p3/7n/2N5/7P/r6K w - -'
It works fine with chessboard, but when I feed it into chess.js, the .load() returns false and the .moves() call returns empty.

I even tried feeding it to chessboard, then used the chessboard .fen() function to get a FEN for chess.js. It returned '8/8/2BkbRp1/1pb1p3/7n/2N5/7P/r6K'.

chess.js would not accept this either.

Here is my code:

var game = new Chess('8/8/2BkbRp1/1pb1p3/7n/2N5/7P/r6K');
var possibleMoves = game.moves();

take care,
lee

Function to return move history

Hi Jeff,
dont' want to annoy you with my pull requests and issues... :)

It would be nice to have a function which returns all played moves so far. The pgn() method does exactly what I need if the .info() wasn't set before. With the current version the only workaround is to create the pgn before setting the PGN info, to get just the played moves.
Perhaps a simple method which returns a history as an array of SAN moves would be more flexible, that's your choice.

Thanks for your help!
Falco

Request: get moves for piece

I'd like to get a list of possible moves the piece on a particular space. Right now the "moves" function returns all possible moves for every piece of the color taking the turn. I can filter that list down to the piece I'm interested in, however it seems fairly inefficient to build the full list and then pare it back down.

User Story: As a player, I want to see all possible moves for the piece I've selected so that I can choose where to move the piece.

Strange jump of bishop to other color field

I'm playing with chessboardjs.com example (pieces highlighting 1). After about 5 minutes of the 'game' one of the bishop made wrong move - from white field to black field, as a result I can see two white bishops on black fields.
screenclip
In comments in the chess.js on the site I can see
"// downloaded from https://github.com/jhlywa/chess.js/blob/master/chess.js
// on 27 July 2013
// commit: eed8f8a"
I hope that this issue was already fixed. In other case I hope my report helps to fix it.

Thanks!

load_pgn fails to parse multi-char move evaluation symbols

Evaluation symbols like ?? (blunder) and !! (brilliant) are valid after moves

var c = new Chess();

c.load_pgn('1. e4!');    // true
c.load_pgn('1. e4?');    // true
c.load_pgn('1. e4??');   // false, but should be true
c.load_pgn('1. e4?!');   // false, but should be true
c.load_pgn('1. e4!!');   // false, but should be true

More symbols here:
https://en.wikipedia.org/wiki/Chess_annotation_symbols#Move_evaluation_symbols

Looks like it was broken in this commit: 64b63d1

.move() causes variable leak

var chess = new Chess();
chess.move();

causes move and moves variables to be leaked into the global namespace. I'm guessing somewhere a 'var' is missing.

Software License?

Which software license are you guys using for chess.js? You should probably pick one if you haven't already.

Minified version

Just for convenience, it would be great to have a minified version.
I am really impressed with the quality and core readability.
Thanks for a beatiful product

pgn generator

The pgn output doesn't indicate what the starting position was. Use SetUp and FEN tags to indicate a starting position different than the usual.

Error: Cannot read property 'type' of undefined (line 474)

Call:

Chess("8/3r4/8/8/8/2R5/1Q6/8 b KQkq - 0 1").game_over(); 

In file chess.js:

Error: Cannot read property 'type' of undefined (line 474)

      /* if pawn promotion */
      if (board[from].type === PAWN &&
//.........etc...................

load_pgn should ignore annotation variations

load_pgn doesn't load PGNs that contain move sequences in parentheses:

1. d4 d5 2. c4 e6 3. e3 Nf6 4. a3 c6 5. Nf3 Bd6 6. cxd5?!
(6. Bd3 O-O 7. O-O dxc4 8. Bxc4 c5 9. Nc3 Nc6 10. dxc5 Bxc5)
6... cxd5 7. Bd3 a6

This should be valid according to the PGN spec:

8.2.5: Movetext RAV (Recursive Annotation Variation)

An RAV (Recursive Annotation Variation) is a sequence of movetext containing
one or more moves enclosed in parentheses.  An RAV is used to represent an
alternative variation.  The alternate move sequence given by an RAV is one that
may be legally played by first unplaying the move that appears immediately
prior to the RAV.  Because the RAV is a recursive construct, it may be nested.

*** The specification for import/export representation of RAV elements needs
further development.

Sources:
http://www6.chessclub.com/help/PGN-spec
http://en.wikipedia.org/wiki/Portable_Game_Notation#Movetext

load_pgn() option to load only game headers

Would be useful when reading a PGN file to have the option of reading only the game tags if the moves aren't required, to reduce overhead.

For example for a PGN viewer, where you might need a list of the contents of the PGN file, but the moves don't need to be parsed until a particular game is loaded.

https://github.com/siansell/pgnviewer is my first attempt at a PGN viewer with chess.js and chessboard.js.

es6 rewrite and support for PGN variations

Hello.

I've been working on an extensive rewrite of chess.js for several months. I was wondering if you or the community had any interest in my work -- or if I should just release it as a separate repo. ("chess-es6.js"...?)

The biggest feature I added was PGN parser support for variations, as well as cursor semantics for iterating back and forth across moves. Making a new move from anything other than the head of a variation implicitly creates a new variation.

    test("many nested variations", () => {
        const pgn = '1. d4 (1. c4 (1. b4 (1. a4 a5) 1... b5) 1... c5) (1. e4 (1. f4 (1. g4 (1. h4 h5) 1... g5) 1... f5) 1... e5) 1... d5 (1... c5 (1... b5 (1... a5))) (1... e5 (1... f5 (1... g5 2. g3) 2. f3) 2. e3) 2. e3 (2. f3 f6) (2. g3 g6) (2. h3 h6) 2... e6';
        chess.loadPgn(pgn);
        assert.equal(chess.toPgn(), pgn, "PGN parser failed to reassemble the given PGN text");
    });

Thanks.

Incorrect parsing of PGN

The regular expression PGN parser occasionally moves the wrong piece when parsing moves without a disambiguator. See below:

var chess = new ch.Chess();
var pgn = '1. d4 Nf6  2. c4 e6  3. Nf3 c5  4. Nc3 cxd4  5. Nxd4 Bb4 6. Nb5';
chess.load_pgn(pgn);
util.puts(chess.pgn());

1. d4 Nf6 2. c4 e6 3. Nf3 c5 4. Nc3 cxd4 5. Nxd4 Bb4 6. Ncb5

Normally the move 6. Nb5 would need a disamiguator; however, the knight on c3 is pinned in this case, so none is needed. Furthur, the PGN output 6. Ncb5 is an illegal move.

load_pgn() problem (issue 85)

Hello!

Same problem in load_pgn (with black):

chess = new Chess();
pgn = ['[SetUp "1"]', '[FEN "r4r1k/1p4b1/3p3p/5qp1/1RP5/6P1/3NP3/2Q2RKB b KQkq - 0 1"]', "", '1. ... Qc5+'];
chess.load_pgn(pgn.join("\n")); // false. Why? It is correct PGN

load_pgn() problem

Call:

chess = new Chess();
pgn = ['[SetUp "1"]', '[FEN "7k/5K2/4R3/8/8/8/8/8 w KQkq - 0 1"]', "", '1. Rh6#'];
chess.load_pgn(pgn.join("\n")); // false. Why? It is correct PGN

Then:

chess.pgn(); // '[SetUp "1"]\n'+'[FEN "7k/5K2/4R3/8/8/8/8/8 w KQkq - 0 1"]'

count number of pieces or count captures

I would like to be able to query the game for how many of each piece type are still on the board at any given time. For example, game.count('bP') could return 8. I would like to do this so I can display captured pieces on a sidebar. The simplest method I can think of is to check if the number of pawns < 8, then put the remainder of pawn icons in the sidebar. Any suggestions? Thank you in advance :).

Fooling check detection

Hi,

It seems that the check detection fails in some situations. An example:

c = new Chess('N3k3/8/8/8/8/8/5b2/4K3 w - - 0 1');
c.ascii();
// Returns:   +------------------------+
//          8 | N  .  .  .  k  .  .  . |
//          7 | .  .  .  .  .  .  .  . |
//          6 | .  .  .  .  .  .  .  . |
//          5 | .  .  .  .  .  .  .  . |
//          4 | .  .  .  .  .  .  .  . |
//          3 | .  .  .  .  .  .  .  . |
//          2 | .  .  .  .  .  b  .  . |
//          1 | .  .  .  .  K  .  .  . |
//            +------------------------+
//              a  b  c  d  e  f  g  h

c.moves().join(' ');
// Returns: Kd2 Ke2 Kxf2 Kf1 Kd1
// -> The white knight in a8 cannot move, as the king is in check.
//    Everything is correct.

c.put({type: 'k', color: 'w'}, 'a1');
c.put({type: 'q', color: 'w'}, 'a1');
c.remove('a1');
c.ascii();
// Returns:   +------------------------+
//          8 | N  .  .  .  k  .  .  . |
//          7 | .  .  .  .  .  .  .  . |
//          6 | .  .  .  .  .  .  .  . |
//          5 | .  .  .  .  .  .  .  . |
//          4 | .  .  .  .  .  .  .  . |
//          3 | .  .  .  .  .  .  .  . |
//          2 | .  .  .  .  .  b  .  . |
//          1 | .  .  .  .  K  .  .  . |
//            +------------------------+
//              a  b  c  d  e  f  g  h
// -> Seems that nothing has changed, however...

c.moves().join(' ');
// Returns: Nc7+ Nb6 Kd2 Ke2 Kxf2 Kf1 Kd1
// -> Now the knight can move, while the white king is still in check.

In this example, the internal variable kings['w'], that normally points to the square where the white king is located, points to a1. That makes check detection fails.

Problem with chess.load

Hello, the first great work.

Now my problem / question is that I think there is a problem because it always fails to be entirely correct movement.

  1. e4 e5 2. Qf3 Nh6 3. Bc4 Bc5 4. Qxf7

If I write :

chess.load_pgn("1. e4 e5 2. Qf3 Nh6 3. Bc4 Bc5 4. Qxf7")

Return false

I think it is wrong qeu return that value. And of course there is the chess.fen (); returned do not see the move "Qxf7"

Extract comments from PGN.

Right now, the script just replaces comments by the

ms = ms.replace(/(\{[^}]+\})+?/g, '');

Feature request : Extract comments and associate them with the corresponding moves

CDN

Thank you from someone very grateful for this library!

We'd like to use chess.js (with chessboard.js) on a competitive play site. The other js/css libraries we utilize have CDN (we use fallbacks to local downloads if they can't be reached). Has there been some thought to adding this to a CDN? I believe it's free to add javascript libraries to cdnjs

Castling in chess 960

I tried to use your amazing library to play chess 960.

I am initializing it
var chess = new Chess('nrbqkrnb/pppppppp/8/8/8/8/PPPPPPPP/NRBQKRNB w KQkq -'); and then I can play it nicely. Till I have to castle. Is is possible to add ability to recognize castling in chess 960?

Hello from Russia )

Hello Jeff!

My neme is Michael and I'm from Belarus and speak Russian )
At first I want to thanks you for high quality chest plugin.
Sorry for my english ))
I wat to ask you about one thing. When I using command "fen" and in case black start first, I can't do it. Just possible start white.
Can I make game.turn() = 'b' ? I got a problem with it. Default is white....
Thanks for your'e time )

FEN + history

Hi. Thank you for the great library first of all!

I was experimenting with Meteor and created a simple app http://chess.meteor.com first by myself, but then found this lib and it works almost great. First I used PGN - it worked perfectly with one exception - it's too slow to be reloaded several times per turn. Then I switched to FEN, it works fast, but now I've lost history and repeated position draw check. I've fixed it by reloading from PGN right before making a move, but it doesn't look good.

Maybe it's possible to use FEN to load current game position and quickly parse PGN just for history without moves validation?

Bug in .moves() method while castling?

[15:40:01.593] var chess = new Chess()
[15:40:01.594] undefined
[15:40:19.412] chess.load('rnbqk2r/ppp1pp1p/5n1b/3p2pQ/1P2P3/B1N5/P1PP1PPP/R3KBNR b KQkq - 3 5')
[15:40:19.414] true
[15:42:42.097] chess.moves({'square' : 'f1', 'verbose' : true})
[15:42:42.099] [{color:"b", from:"e8", to:"g8", flags:"k", piece:"k", san:"O-O"}]

Unable to load correct PGN

It seems that there might be a bug in the load_pgn method.
When using following PGN:

[Event "Live Chess"]
[Site "Chess.com"]
[Date "2015.11.10"]
[White "Passero82"]
[Black "bgknight"]
[Result "0-1"]
[WhiteElo "1175"]
[BlackElo "1255"]
[TimeControl "30|0"]
[Termination "bgknight won by resignation"]

1.e4 e5 2.Nf3 d6 3.d4 Bg4 4.dxe5 Bxf3 5.Qxf3 dxe5 6.Qf5 Nc6 7.Bb5 Nge7 8.Qxe5 Qd7 9.O-O Nxe5 10.Bxd7+ Nxd7
11.Rd1 O-O-O 12.Nc3 Ng6 13.Be3 a6 14.Ba7 b6 15.Na4 Kb7 16.Bxb6 cxb6 17.b3 b5 18.Nb2 Nge5 19.f3 Rc8 20.Rac1 Ba3
21.Rb1 Rxc2 22.f4 Ng4 23.Rxd7+ Kc6 24.Rxf7 Bxb2 25.Rxg7 Ne3 26.Rg3 Bd4 27.Kh1 Rxa2 28.Rc1+ Kb6 29.e5 Rf8 30.e6 Rxf4
31.e7 Re4 32.Rg7 Bxg7 0-1

and use:
var chess = new Chess();
chess.load_pgn(pgn);

it returns false however applications like Fritz are able to read the PGN properly so I started to investigate and added some additional debug info in the load_pgn method.

In this specific PGN, it seems like the algoritm thinks that the move 7... Nge7 is not a valid move.

In this code from the load_pgn method:
for (var half_move = 0; half_move < moves.length - 1; half_move++) {
move = get_move_obj(moves[half_move]);

            /* move not possible! (don't clear the board to examine to show the
             * latest valid position)
             */
            if (move == null) {
                console.log("Invalid move for " + half_move + " " + moves[half_move]);
                return false;
            } else {
                make_move(move);
            }
        }

move == null for the half move 13 which is 7... Nge7

I have another PGN with the exact move:

[Event "Live Chess"]
[Site "Chess.com"]
[Date "2015.11.10"]
[White "awhichi"]
[Black "Passero82"]
[Result "0-1"]
[WhiteElo "1103"]
[BlackElo "1165"]
[TimeControl "30|0"]
[Termination "Passero82 won by checkmate"]

1.e4 e5 2.d4 exd4 3.Qxd4 Nc6 4.Qe3 d6 5.Bc4 Be6 6.Bb5 Nge7 7.Bxc6+ Nxc6 8.Nc3 Be7 9.Bd2 O-O 10.O-O-O Ne5
11.Nf3 Nc4 12.Qe2 c5 13.a3 Qb6 14.Bf4 Qxb2# 0-1

load_pgn also fails to load the PGN here for the same move: Nge7.

#history drops last move when white player moved last

var pgnDump = ['[White "carolyn"]', '[Black "hippo"]', '[Date "2014-1-18"]', "", "1. e4 d5", "2. exd5 c5", "3. dxc6 Nxc6", "4. Bb5 b6", "5. Bxc6+ Qd7", "6. Bxd7+ Bxd7", "7. Qg4 Bxg4", "8. Kf1 Be2+", "9. Kxe2 Rd8", "10. d4 Rxd4", "11. Be3 Rd2+", "12. Kxd2"].join('\n');

var chess = new Chess();
chess.load_pgn(pgnDump);  // should load 23 moves

I haven't found the exact line of code that causes the bug, but notice the 12th move is missing (Kxd2):

chess.history().length; // returns 22
chess.history().join('\n');
 e4
 d5
 exd5
 c5
 dxc6
 Nxc6
 Bb5
 b6
 Bxc6+
 Qd7
 Bxd7+
 Bxd7
 Qg4
 Bxg4
 Kf1
 Be2+
 Kxe2
 Rd8
 d4
 Rxd4
 Be3
 Rd2+

Force turn

Hello,

Before calling the .moves() function, is it possible to set the turn to black or white?

lee

Read header

There is no exposed (or documented) function to read header from loaded PGN.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.