projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Left some TODOs, some bugs
[vchess.git]
/
client
/
src
/
base_rules.js
diff --git
a/client/src/base_rules.js
b/client/src/base_rules.js
index
169fb2d
..
cc8292c
100644
(file)
--- a/
client/src/base_rules.js
+++ b/
client/src/base_rules.js
@@
-2,7
+2,7
@@
// Variants generally inherit from it, and modify some parts.
import { ArrayFun } from "@/utils/array";
// Variants generally inherit from it, and modify some parts.
import { ArrayFun } from "@/utils/array";
-import { randInt, s
ample, s
huffle } from "@/utils/alea";
+import { randInt, shuffle } from "@/utils/alea";
export const PiPo = class PiPo //Piece+Position
{
export const PiPo = class PiPo //Piece+Position
{
@@
-512,12
+512,6
@@
export const ChessRules = class ChessRules
return (color=="w" ? "b" : "w");
}
return (color=="w" ? "b" : "w");
}
- // Get next color (for compatibility with 3 and 4 players games)
- static GetNextCol(color)
- {
- return V.GetOppCol(color);
- }
-
// Pieces codes (for a clearer code)
static get PAWN() { return 'p'; }
static get ROOK() { return 'r'; }
// Pieces codes (for a clearer code)
static get PAWN() { return 'p'; }
static get ROOK() { return 'r'; }
@@
-1198,7
+1192,7
@@
export const ChessRules = class ChessRules
let candidates = [0]; //indices of candidates moves
for (let j=1; j<moves1.length && moves1[j].eval == moves1[0].eval; j++)
candidates.push(j);
let candidates = [0]; //indices of candidates moves
for (let j=1; j<moves1.length && moves1[j].eval == moves1[0].eval; j++)
candidates.push(j);
- let currentBest = moves1[
sample(candidates)
];
+ let currentBest = moves1[
candidates[randInt(candidates.length)]
];
// Skip depth 3+ if we found a checkmate (or if we are checkmated in 1...)
if (V.SEARCH_DEPTH >= 3 && Math.abs(moves1[0].eval) < V.THRESHOLD_MATE)
// Skip depth 3+ if we found a checkmate (or if we are checkmated in 1...)
if (V.SEARCH_DEPTH >= 3 && Math.abs(moves1[0].eval) < V.THRESHOLD_MATE)