projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Speed up computer thinking, fix Zen ep
[vchess.git]
/
public
/
javascripts
/
base_rules.js
diff --git
a/public/javascripts/base_rules.js
b/public/javascripts/base_rules.js
index
b604e79
..
d8ec34a
100644
(file)
--- a/
public/javascripts/base_rules.js
+++ b/
public/javascripts/base_rules.js
@@
-98,6
+98,7
@@
class ChessRules
j++;
}
}
j++;
}
}
+ // TODO: since we keep moves stack, next 2 are redundant
let epSq = undefined;
if (fenParts[2] != "-")
{
let epSq = undefined;
if (fenParts[2] != "-")
{
@@
-838,8
+839,7
@@
class ChessRules
alphabeta(color, oppCol, depth, alpha, beta)
{
alphabeta(color, oppCol, depth, alpha, beta)
{
- const moves = this.getAllValidMoves(color);
- if (moves.length == 0)
+ if (!this.atLeastOneMove(color))
{
switch (this.checkGameEnd(color))
{
{
switch (this.checkGameEnd(color))
{
@@
-849,6
+849,7
@@
class ChessRules
}
if (depth == 0)
return this.evalPosition();
}
if (depth == 0)
return this.evalPosition();
+ const moves = this.getAllValidMoves(color);
let v = color=="w" ? -1000 : 1000;
if (color == "w")
{
let v = color=="w" ? -1000 : 1000;
if (color == "w")
{