projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Draft of Ultima chess rules; almost OK HalfChess
[vchess.git]
/
public
/
javascripts
/
base_rules.js
diff --git
a/public/javascripts/base_rules.js
b/public/javascripts/base_rules.js
index
a8f2489
..
750cd2d
100644
(file)
--- a/
public/javascripts/base_rules.js
+++ b/
public/javascripts/base_rules.js
@@
-752,6
+752,7
@@
class ChessRules
// END OF GAME
// Basic check for 3 repetitions (in the last moves only)
// END OF GAME
// Basic check for 3 repetitions (in the last moves only)
+ // TODO: extend to usual 3-repetition recognition (storing FEN with move?)
checkRepetition()
{
if (this.moves.length >= 8)
checkRepetition()
{
if (this.moves.length >= 8)
@@
-988,9
+989,9
@@
class ChessRules
// Setup the initial random (assymetric) position
static GenRandInitFen()
{
// Setup the initial random (assymetric) position
static GenRandInitFen()
{
- let pieces =
[new Array(8), new Array(8)]
;
+ let pieces =
{ "w": new Array(8), "b": new Array(8) }
;
// Shuffle pieces on first and last rank
// Shuffle pieces on first and last rank
- for (let c
= 0; c <= 1; c++
)
+ for (let c
of ["w","b"]
)
{
let positions = _.range(8);
{
let positions = _.range(8);
@@
-1032,9
+1033,9
@@
class ChessRules
pieces[c][knight2Pos] = 'n';
pieces[c][rook2Pos] = 'r';
}
pieces[c][knight2Pos] = 'n';
pieces[c][rook2Pos] = 'r';
}
- let fen = pieces[
0
].join("") +
+ let fen = pieces[
"b"
].join("") +
"/pppppppp/8/8/8/8/PPPPPPPP/" +
"/pppppppp/8/8/8/8/PPPPPPPP/" +
- pieces[
1
].join("").toUpperCase() +
+ pieces[
"w"
].join("").toUpperCase() +
" 1111"; //add flags
return fen;
}
" 1111"; //add flags
return fen;
}