cm-chess 2.1.7 → 2.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/package.json +2 -2
- package/src/cm-chess/Chess.js +4 -4
- package/test/TestChess.js +2 -2
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# cm-chess
|
|
2
2
|
|
|
3
3
|
It is like [chess.js](https://github.com/jhlywa/chess.js),
|
|
4
|
-
but is an ES6 module, can handle history
|
|
4
|
+
but is an ES6 module, can handle history variations (tree-structured move history),
|
|
5
5
|
PGN header values, Nags and Comments.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
@@ -11,7 +11,7 @@ PGN header values, Nags and Comments.
|
|
|
11
11
|
## Features
|
|
12
12
|
|
|
13
13
|
- It has a similar API to chess.js
|
|
14
|
-
- It can handle history
|
|
14
|
+
- It can handle history variations
|
|
15
15
|
- It can add Nags, Comments and Annotations
|
|
16
16
|
- It is used by the 7,000 users of [chessmail](https://www.chessmail.de) (it works)
|
|
17
17
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cm-chess",
|
|
3
|
-
"version": "2.1.
|
|
4
|
-
"description": "Like chess.js, but in ES6 and can handle
|
|
3
|
+
"version": "2.1.8",
|
|
4
|
+
"description": "Like chess.js, but in ES6 and can handle variations (tree-structured move history)",
|
|
5
5
|
"main": "./src/cm-chess/Chess.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "mocha --require babel-core/register ./test/*.js",
|
package/src/cm-chess/Chess.js
CHANGED
|
@@ -172,7 +172,7 @@ export class Chess {
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
/**
|
|
175
|
-
* Load a PGN with
|
|
175
|
+
* Load a PGN with variations, NAGs, header and annotations. cm-chess uses cm-pgn
|
|
176
176
|
* fot the header and history. See https://github.com/shaack/cm-pgn
|
|
177
177
|
* @param pgn
|
|
178
178
|
*/
|
|
@@ -183,7 +183,7 @@ export class Chess {
|
|
|
183
183
|
/**
|
|
184
184
|
* Make a move in the game.
|
|
185
185
|
* @param move
|
|
186
|
-
* @param previousMove optional, the previous move (
|
|
186
|
+
* @param previousMove optional, the previous move (for variations)
|
|
187
187
|
* @param sloppy to allow sloppy SAN
|
|
188
188
|
* @returns {{}|undefined}
|
|
189
189
|
*/
|
|
@@ -200,7 +200,7 @@ export class Chess {
|
|
|
200
200
|
* @returns {string} the PGN of the game.
|
|
201
201
|
*/
|
|
202
202
|
renderPgn() {
|
|
203
|
-
// TODO create pgn with
|
|
203
|
+
// TODO create pgn with variations, annotations, nags (for now just render main variant)
|
|
204
204
|
const chess = new ChessJs(this.setUpFen())
|
|
205
205
|
const moves = this.pgn.history.moves
|
|
206
206
|
for (const move of moves) {
|
|
@@ -281,4 +281,4 @@ export class Chess {
|
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
|
|
284
|
-
}
|
|
284
|
+
}
|
package/test/TestChess.js
CHANGED
|
@@ -2,7 +2,7 @@ import {Chess, COLOR, FEN} from "../src/cm-chess/Chess.js"
|
|
|
2
2
|
import {TAGS} from "../lib/cm-pgn/Header.js"
|
|
3
3
|
import {describe, it, assert} from "../node_modules/teevi/src/teevi.js"
|
|
4
4
|
|
|
5
|
-
// TODO create a test, which demonstrates all features, including
|
|
5
|
+
// TODO create a test, which demonstrates all features, including variations
|
|
6
6
|
|
|
7
7
|
describe("Chess", function () {
|
|
8
8
|
|
|
@@ -209,4 +209,4 @@ describe("Chess", function () {
|
|
|
209
209
|
assert.true(chess.move("e4"))
|
|
210
210
|
})
|
|
211
211
|
|
|
212
|
-
})
|
|
212
|
+
})
|