projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix Pandemonium + Janggi (first move)
[vchess.git]
/
client
/
src
/
variants
/
Magnetic.js
diff --git
a/client/src/variants/Magnetic.js
b/client/src/variants/Magnetic.js
index
a59ce41
..
dc228ce
100644
(file)
--- a/
client/src/variants/Magnetic.js
+++ b/
client/src/variants/Magnetic.js
@@
-1,6
+1,7
@@
import { ChessRules, PiPo } from "@/base_rules";
import { ChessRules, PiPo } from "@/base_rules";
-export const VariantRules = class MagneticRules extends ChessRules {
+export class MagneticRules extends ChessRules {
+
static get HasEnpassant() {
return false;
}
static get HasEnpassant() {
return false;
}
@@
-116,7
+117,8
@@
export const VariantRules = class MagneticRules extends ChessRules {
cmove.appear[i].p = piece;
moves.push(cmove);
}
cmove.appear[i].p = piece;
moves.push(cmove);
}
- // Swap appear[i] and appear[0] for moves presentation (TODO: this is awkward)
+ // Swap appear[i] and appear[0] for moves presentation
+ // (TODO: this is awkward)
moves.forEach(m => {
let tmp = m.appear[0];
m.appear[0] = m.appear[i];
moves.forEach(m => {
let tmp = m.appear[0];
m.appear[0] = m.appear[i];
@@
-169,7
+171,8
@@
export const VariantRules = class MagneticRules extends ChessRules {
psq.x == oppFirstRank &&
this.castleFlags[oppCol].includes(psq.y)
) {
psq.x == oppFirstRank &&
this.castleFlags[oppCol].includes(psq.y)
) {
- this.castleFlags[oppCol][psq.y == this.castleFlags[oppCol][0] ? 0 : 1] = 8;
+ const flagIdx = (psq.y == this.castleFlags[oppCol][0] ? 0 : 1);
+ this.castleFlags[oppCol][flagIdx] = 8;
}
});
}
}
});
}
@@
-196,7
+199,7
@@
export const VariantRules = class MagneticRules extends ChessRules {
// King disappeared
return color == "w" ? "0-1" : "1-0";
if (this.atLeastOneMove())
// King disappeared
return color == "w" ? "0-1" : "1-0";
if (this.atLeastOneMove())
- //
g
ame not over
+ //
G
ame not over
return "*";
return "1/2"; //no moves but kings still there
}
return "*";
return "1/2"; //no moves but kings still there
}
@@
-208,4
+211,5
@@
export const VariantRules = class MagneticRules extends ChessRules {
static get SEARCH_DEPTH() {
return 2;
}
static get SEARCH_DEPTH() {
return 2;
}
+
};
};