}
// d --> 3 (column letter to number)
- static ColumnToCoord(colnum)
+ static ColumnToCoord(column)
{
- return String.fromCharCode(97 + colnum);
+ return column.charCodeAt(0) - 97;
}
// a4 --> {x:3,y:0}
// After move is played, update variables + flags
updateVariables(move)
{
- const piece = move.vanish[0].p;
- let c = move.vanish[0].c;
+ let piece = undefined;
+ let c = undefined;
+ if (move.vanish.length >= 1)
+ {
+ // Usual case, something is moved
+ piece = move.vanish[0].p;
+ c = move.vanish[0].c;
+ }
+ else
+ {
+ // Crazyhouse-like variants
+ piece = move.appear[0].p;
+ c = move.appear[0].c;
+ }
if (c == "c") //if (!["w","b"].includes(c))
{
// 'c = move.vanish[0].c' doesn't work for Checkered