Improve cpu player.

This commit is contained in:
yukirij 2025-02-03 17:01:24 -08:00
parent 09a89880e6
commit 6231238d27

View File

@ -945,8 +945,10 @@ const INTERFACE = {
} }
if(GAME_DATA.config.rules.par != 0) { if(GAME_DATA.config.rules.par != 0) {
if(GAME_DATA.turn >= (GAME_DATA.config.rules.par * 2)) {
message = "Par " + GAME_DATA.config.rules.par; message = "Par " + GAME_DATA.config.rules.par;
} }
}
switch(GAME_DATA.state.code) { switch(GAME_DATA.state.code) {
case GAME.Const.State.Resign: { case GAME.Const.State.Resign: {
@ -1976,6 +1978,7 @@ const INTERFACE = {
if(move.valid) { if(move.valid) {
moves.push({ moves.push({
score: 0, score: 0,
true_score: 0,
play: new GAME.Play(1, p, move.tile), play: new GAME.Play(1, p, move.tile),
}); });
} }
@ -2009,12 +2012,13 @@ const INTERFACE = {
st.process(moves[mv].play); st.process(moves[mv].play);
moves[mv].score = state_score(st, player); moves[mv].score = state_score(st, player);
if(depth == 0) { moves[mv].true_score = state_score(st, search_player);
moves[mv].score = state_score(st, search_player);
} else { if(depth > 0) {
let result = determine_play(st, search_player, depth - 1); let result = determine_play(st, search_player, depth - 1);
if(result !== null) { if(result !== null) {
moves[mv].score = result.score; moves[mv].score = result.true_score;
moves[mv].true_score = result.true_score;
} }
} }
} }