projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Some debug, plan several short + long term TODOs
[vchess.git]
/
public
/
javascripts
/
variants
/
Checkered.js
diff --git
a/public/javascripts/variants/Checkered.js
b/public/javascripts/variants/Checkered.js
index
314cd8e
..
4a9419a
100644
(file)
--- a/
public/javascripts/variants/Checkered.js
+++ b/
public/javascripts/variants/Checkered.js
@@
-151,7
+151,10
@@
class CheckeredRules extends ChessRules
const L = this.moves.length;
if (L > 0 && this.oppositeMoves(this.moves[L-1], m))
return false;
const L = this.moves.length;
if (L > 0 && this.oppositeMoves(this.moves[L-1], m))
return false;
- return !this.underCheck(m);
+ this.play(m);
+ const res = !this.underCheck(color);
+ this.undo(m);
+ return res;
});
}
});
}
@@
-176,19
+179,13
@@
class CheckeredRules extends ChessRules
return false;
}
return false;
}
- underCheck(
move
)
+ underCheck(
color
)
{
{
- const color = this.turn;
- this.play(move);
- let res = this.isAttacked(this.kingPos[color], [this.getOppCol(color),'c']);
- this.undo(move);
- return res;
+ return this.isAttacked(this.kingPos[color], [this.getOppCol(color),'c']);
}
}
- getCheckSquares(
move
)
+ getCheckSquares(
color
)
{
{
- this.play(move);
- const color = this.turn;
// Artifically change turn, for checkered pawns
this.turn = this.getOppCol(color);
const kingAttacked = this.isAttacked(
// Artifically change turn, for checkered pawns
this.turn = this.getOppCol(color);
const kingAttacked = this.isAttacked(
@@
-197,7
+194,6
@@
class CheckeredRules extends ChessRules
? [JSON.parse(JSON.stringify(this.kingPos[color]))] //need to duplicate!
: [];
this.turn = color;
? [JSON.parse(JSON.stringify(this.kingPos[color]))] //need to duplicate!
: [];
this.turn = color;
- this.undo(move);
return res;
}
return res;
}
@@
-282,7
+278,7
@@
class CheckeredRules extends ChessRules
if (move.vanish.length > 1)
{
// Capture
if (move.vanish.length > 1)
{
// Capture
- const startColumn = V.
Get
Column(move.start.y);
+ const startColumn = V.
CoordTo
Column(move.start.y);
notation = startColumn + "x" + finalSquare +
"=" + move.appear[0].p.toUpperCase();
}
notation = startColumn + "x" + finalSquare +
"=" + move.appear[0].p.toUpperCase();
}
@@
-303,3
+299,5
@@
class CheckeredRules extends ChessRules
}
}
}
}
}
}
+
+const VariantRules = CheckeredRules;