projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Alice rules implemented, but unfinished and with bugs...
[vchess.git]
/
public
/
javascripts
/
base_rules.js
diff --git
a/public/javascripts/base_rules.js
b/public/javascripts/base_rules.js
index
e757f7a
..
cb426f3
100644
(file)
--- a/
public/javascripts/base_rules.js
+++ b/
public/javascripts/base_rules.js
@@
-699,6
+699,8
@@
class ChessRules
play(move, ingame)
{
play(move, ingame)
{
+ console.log("play " + this.getNotation(move));
+ console.log(JSON.stringify(move));
if (!!ingame)
move.notation = this.getNotation(move);
if (!!ingame)
move.notation = this.getNotation(move);
@@
-716,6
+718,7
@@
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));
+ console.log("undo " + this.getNotation(move));
}
//////////////
}
//////////////
@@
-1011,10
+1014,10
@@
class ChessRules
}
// Translate final square
}
// Translate final square
-
le
t finalSquare =
+
cons
t finalSquare =
String.fromCharCode(97 + move.end.y) + (VariantRules.size[0]-move.end.x);
String.fromCharCode(97 + move.end.y) + (VariantRules.size[0]-move.end.x);
-
le
t piece = this.getPiece(move.start.x, move.start.y);
+
cons
t piece = this.getPiece(move.start.x, move.start.y);
if (piece == VariantRules.PAWN)
{
// Pawn move
if (piece == VariantRules.PAWN)
{
// Pawn move
@@
-1022,7
+1025,7
@@
class ChessRules
if (move.vanish.length > move.appear.length)
{
// Capture
if (move.vanish.length > move.appear.length)
{
// Capture
-
le
t startColumn = String.fromCharCode(97 + move.start.y);
+
cons
t startColumn = String.fromCharCode(97 + move.start.y);
notation = startColumn + "x" + finalSquare;
}
else //no capture
notation = startColumn + "x" + finalSquare;
}
else //no capture