projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Attempt to fix Alice chess
[vchess.git]
/
public
/
javascripts
/
base_rules.js
diff --git
a/public/javascripts/base_rules.js
b/public/javascripts/base_rules.js
index
ab197b6
..
8568936
100644
(file)
--- a/
public/javascripts/base_rules.js
+++ b/
public/javascripts/base_rules.js
@@
-479,8
+479,7
@@
class ChessRules
{
if (moves.length == 0)
return [];
{
if (moves.length == 0)
return [];
- let color = this.turn;
- return moves.filter(m => { return !this.underCheck(m, color); });
+ return moves.filter(m => { return !this.underCheck(m); });
}
// Search for all valid moves considering current turn (for engine and game end)
}
// Search for all valid moves considering current turn (for engine and game end)
@@
-699,6
+698,10
@@
class ChessRules
play(move, ingame)
{
play(move, ingame)
{
+ // DEBUG:
+// if (!this.states) this.states = [];
+// if (!ingame) this.states.push(JSON.stringify(this.board));
+
if (!!ingame)
move.notation = this.getNotation(move);
if (!!ingame)
move.notation = this.getNotation(move);
@@
-716,6
+719,11
@@
class ChessRules
this.moves.pop();
this.unupdateVariables(move);
this.parseFlags(JSON.parse(move.flags));
this.moves.pop();
this.unupdateVariables(move);
this.parseFlags(JSON.parse(move.flags));
+
+ // DEBUG:
+// let state = this.states.pop();
+// if (JSON.stringify(this.board) != state)
+// debugger;
}
//////////////
}
//////////////