projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Finished User management implementation
[vchess.git]
/
public
/
javascripts
/
variants
/
Crazyhouse.js
diff --git
a/public/javascripts/variants/Crazyhouse.js
b/public/javascripts/variants/Crazyhouse.js
index
1fff1e9
..
3d9c743
100644
(file)
--- a/
public/javascripts/variants/Crazyhouse.js
+++ b/
public/javascripts/variants/Crazyhouse.js
@@
-11,10
+11,9
@@
class CrazyhouseRules extends ChessRules
// 6) Check promoted array
if (!fenParsed.promoted)
return false;
// 6) Check promoted array
if (!fenParsed.promoted)
return false;
- fenpromoted = fenParsed.promoted;
- if (fenpromoted == "-")
+ if (fenParsed.promoted == "-")
return true; //no promoted piece on board
return true; //no promoted piece on board
- const squares = fenpromoted.split(",");
+ const squares = fen
Parsed.
promoted.split(",");
for (let square of squares)
{
const c = V.SquareToCoords(square);
for (let square of squares)
{
const c = V.SquareToCoords(square);
@@
-30,8
+29,8
@@
class CrazyhouseRules extends ChessRules
return Object.assign(
ChessRules.ParseFen(fen),
{
return Object.assign(
ChessRules.ParseFen(fen),
{
- reserve: fenParts[
4
],
- promoted: fenParts[
5
],
+ reserve: fenParts[
5
],
+ promoted: fenParts[
6
],
}
);
}
}
);
}
@@
-48,8
+47,8
@@
class CrazyhouseRules extends ChessRules
getReserveFen()
{
getReserveFen()
{
- let counts =
_.map(_.range(10),
0);
- for (let i=0; i<V.PIECES.length
; i++)
+ let counts =
new Array(1
0);
+ for (let i=0; i<V.PIECES.length
-1; i++) //-1: no king reserve
{
counts[i] = this.reserve["w"][V.PIECES[i]];
counts[5+i] = this.reserve["b"][V.PIECES[i]];
{
counts[i] = this.reserve["w"][V.PIECES[i]];
counts[5+i] = this.reserve["b"][V.PIECES[i]];
@@
-213,7
+212,7
@@
class CrazyhouseRules extends ChessRules
super.updateVariables(move);
if (move.vanish.length == 2 && move.appear.length == 2)
return; //skip castle
super.updateVariables(move);
if (move.vanish.length == 2 && move.appear.length == 2)
return; //skip castle
- const color =
this.turn
;
+ const color =
move.appear[0].c
;
if (move.vanish.length == 0)
{
this.reserve[color][move.appear[0].p]--;
if (move.vanish.length == 0)
{
this.reserve[color][move.appear[0].p]--;