Fix cpu play hang.

This commit is contained in:
yukirij 2024-12-18 14:44:08 -08:00
parent 8f98fec793
commit 0baf7415e9
2 changed files with 4 additions and 4 deletions

View File

@ -25,7 +25,7 @@ GAME.Board = class {
let board = new GAME.Board();
for(let i = 0; i < this.tiles.length; ++i) { board.tiles[i] = this.tiles[i].clone(); }
for(let i = 0; i < this.pieces.length; ++i) { this.pieces.push(null); }
for(let i = 0; i < this.pieces.length; ++i) { board.pieces.push(null); }
for(let i = 0; i < this.pieces.length; ++i) {
if(this.pieces[i] !== null) {
board.pieces[i] = this.pieces[i].clone();

View File

@ -354,7 +354,7 @@ const INTERFACE = {
INTERFACE.game_step();
if(!event.ctrlKey) {
if(event.preventDefault !== undefined && !event.ctrlKey) {
event.preventDefault();
}
},
@ -1773,7 +1773,7 @@ const INTERFACE = {
},
auto_play() {
let bit = 1 << ((GAME_DATA.turn + GAME_DATA.config.rules.reverse) & 1);
let bit = 1 << (GAME_DATA.turn & 1);
if((INTERFACE_DATA.Game.auto & bit) == 0 || GAME_DATA.state.checkmate) { return; }
function state_score(state, player) {
@ -1920,7 +1920,7 @@ const INTERFACE = {
return null;
}
let result = determine_play(GAME_DATA, (GAME_DATA.turn + GAME_DATA.config.rules.reverse) & 1, 1);
let result = determine_play(GAME_DATA, GAME_DATA.turn & 1, 1);
if(result !== null) {
INTERFACE.process(result.play);
} else {