cm-chess 3.4.1 → 3.4.2
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/package.json +1 -1
- package/src/Chess.js +3 -1
package/package.json
CHANGED
package/src/Chess.js
CHANGED
|
@@ -331,6 +331,7 @@ export class Chess {
|
|
|
331
331
|
* @returns {string} "b" or "w" the color to move in the main variation
|
|
332
332
|
*/
|
|
333
333
|
turn(move = this.lastMove()) {
|
|
334
|
+
console.log("move", move)
|
|
334
335
|
let factor = 0
|
|
335
336
|
if (this.setUpFen()) {
|
|
336
337
|
const fenParts = this.setUpFen().split(" ")
|
|
@@ -338,7 +339,8 @@ export class Chess {
|
|
|
338
339
|
factor = 1
|
|
339
340
|
}
|
|
340
341
|
}
|
|
341
|
-
|
|
342
|
+
const ply = move ? move.ply : 0
|
|
343
|
+
return (ply) % 2 === factor ? COLOR.white : COLOR.black
|
|
342
344
|
}
|
|
343
345
|
|
|
344
346
|
/**
|