projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Prepare some more variants (unfinished)
[vchess.git]
/
public
/
javascripts
/
variants
/
Grand.js
diff --git
a/public/javascripts/variants/Grand.js
b/public/javascripts/variants/Grand.js
index
ec2afd8
..
7248f57
100644
(file)
--- a/
public/javascripts/variants/Grand.js
+++ b/
public/javascripts/variants/Grand.js
@@
-18,10
+18,13
@@
class GrandRules extends ChessRules
return true;
}
return true;
}
- static
GenRandInitFen(
)
+ static
ParseFen(fen
)
{
{
- const fen = ChessRules.GenRandInitFen();
- return fen.replace(" w 1111", " w 1111 0000000000");
+ const fenParts = fen.split(" ");
+ return Object.assign(
+ ChessRules.ParseFen(fen),
+ { captured: fenParts[4] }
+ );
}
getFen()
}
getFen()
@@
-32,7
+35,7
@@
class GrandRules extends ChessRules
getCapturedFen()
{
let counts = _.map(_.range(10), 0);
getCapturedFen()
{
let counts = _.map(_.range(10), 0);
- for (let i=0; i<V.PIECES.length
; i++)
+ for (let i=0; i<V.PIECES.length
-1; i++) //-1: no king captured
{
counts[i] = this.captured["w"][V.PIECES[i]];
counts[5+i] = this.captured["b"][V.PIECES[i]];
{
counts[i] = this.captured["w"][V.PIECES[i]];
counts[5+i] = this.captured["b"][V.PIECES[i]];
@@
-215,13
+218,12
@@
class GrandRules extends ChessRules
// TODO: some redundant checks
if (epsq.x == x+shift && Math.abs(epsq.y - y) == 1)
{
// TODO: some redundant checks
if (epsq.x == x+shift && Math.abs(epsq.y - y) == 1)
{
- let epStep = epsq.y - y;
- var enpassantMove = this.getBasicMove([x,y], [x+shift,y+epStep]);
+ var enpassantMove = this.getBasicMove([x,y], [x+shift,epsq.y]);
enpassantMove.vanish.push({
x: x,
enpassantMove.vanish.push({
x: x,
- y:
y+epStep
,
+ y:
epsq.y
,
p: 'p',
p: 'p',
- c: this.getColor(x,
y+epStep
)
+ c: this.getColor(x,
epsq.y
)
});
moves.push(enpassantMove);
}
});
moves.push(enpassantMove);
}
@@
-355,7
+357,7
@@
class GrandRules extends ChessRules
return pieces["b"].join("") +
"/pppppppppp/10/10/10/10/10/10/PPPPPPPPPP/" +
pieces["w"].join("").toUpperCase() +
return pieces["b"].join("") +
"/pppppppppp/10/10/10/10/10/10/PPPPPPPPPP/" +
pieces["w"].join("").toUpperCase() +
- " w 1111 -";
+ " w 1111 -
0000000000
";
}
}
}
}