projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improve Alice variant
[vchess.git]
/
public
/
javascripts
/
base_rules.js
diff --git
a/public/javascripts/base_rules.js
b/public/javascripts/base_rules.js
index
ec5f937
..
0f637c5
100644
(file)
--- a/
public/javascripts/base_rules.js
+++ b/
public/javascripts/base_rules.js
@@
-479,8
+479,7
@@
class ChessRules
{
if (moves.length == 0)
return [];
{
if (moves.length == 0)
return [];
- let color = this.turn;
- return moves.filter(m => { return !this.underCheck(m, color); });
+ return moves.filter(m => { return !this.underCheck(m); });
}
// Search for all valid moves considering current turn (for engine and game end)
}
// Search for all valid moves considering current turn (for engine and game end)
@@
-781,10
+780,9
@@
class ChessRules
getComputerMove()
{
const color = this.turn;
getComputerMove()
{
const color = this.turn;
-
- // Rank moves using a min-max at depth 2
let moves1 = this.getAllValidMoves();
let moves1 = this.getAllValidMoves();
+ // Rank moves using a min-max at depth 2
for (let i=0; i<moves1.length; i++)
{
moves1[i].eval = (color=="w" ? -1 : 1) * 1000; //very low, I'm checkmated
for (let i=0; i<moves1.length; i++)
{
moves1[i].eval = (color=="w" ? -1 : 1) * 1000; //very low, I'm checkmated