can not update outdated
This commit is contained in:
1 parent
13dcdcee55
commit
0c476f4fca
2 files changed
+13
-9
No files matched your search
@@ -1,6 +1,5 @@
|
||||
import os
|
||||
import random
|
||||
import math
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
@@ -134,8 +133,8 @@ class Move:
|
||||
# needing own analysis ready
|
||||
@property
|
||||
def temperature_stats(self):
|
||||
best = float(self.analysis[0]["scoreLead"])
|
||||
worst = float(self.pass_analysis[0]["scoreLead"])
|
||||
best = self.analysis[0]["scoreLead"]
|
||||
worst = self.pass_analysis[0]["scoreLead"]
|
||||
return best, worst, max(-self.player_sign * (best - worst), 0)
|
||||
|
||||
@property
|
||||
@@ -150,15 +149,21 @@ class Move:
|
||||
@property
|
||||
def evaluation(self):
|
||||
best, worst, temp = self.parent.temperature_stats
|
||||
return self.player_sign * (self.score - worst) / temp if temp > 0 else math.nan
|
||||
return self.player_sign * (self.score - worst) / temp if temp > 0 else None
|
||||
|
||||
@property
|
||||
def outdated_evaluation(self):
|
||||
def outdated_score(move_dict):
|
||||
return move_dict.get("outdatedScoreLead") or move_dict["scoreLead"]
|
||||
|
||||
prev_analysis_current_move = [d for d in self.parent.analysis if d["move"] == self.gtp()]
|
||||
if prev_analysis_current_move:
|
||||
best_score, worst_score, prev_temp = self.parent.temperature_stats
|
||||
score = prev_analysis_current_move[0].get("outdatedScoreLead") or prev_analysis_current_move[0]["scoreLead"]
|
||||
return self.player_sign * (score - worst_score) / prev_temp if prev_temp > 0 else math.nan
|
||||
best_score = outdated_score(self.parent.analysis[0])
|
||||
worst_score = self.parent.pass_analysis[0]["scoreLead"]
|
||||
prev_temp = max(self.player_sign * (best_score - worst_score), 0)
|
||||
score = outdated_score(prev_analysis_current_move[0])
|
||||
return self.player_sign * (score - worst_score) / prev_temp if prev_temp > 0 else None
|
||||
|
||||
@property
|
||||
def ai_moves(self):
|
||||
|
||||
+2
-3
@@ -1,7 +1,6 @@
|
||||
import copy
|
||||
import json
|
||||
import os
|
||||
import math
|
||||
import random
|
||||
import re
|
||||
import shlex
|
||||
@@ -98,7 +97,7 @@ class EngineControls(GridLayout):
|
||||
self.score.text = move.format_score().replace("-", "\u2013")
|
||||
self.temperature.text = f"{move.temperature_stats[2]:.1f}"
|
||||
if move.parent and move.parent.analysis_ready:
|
||||
if not math.isnan(move.evaluation):
|
||||
if move.evaluation is not None:
|
||||
self.evaluation.text = f"{move.evaluation:.1%}"
|
||||
else:
|
||||
self.evaluation.text = f"?"
|
||||
@@ -107,7 +106,7 @@ class EngineControls(GridLayout):
|
||||
def update_evaluation(self):
|
||||
current_move = self.board.current_move
|
||||
self.score.set_prisoners(self.board.prisoner_count)
|
||||
current_player_is_human_or_both_robots = (not self.ai_auto.active(current_move.player) or self.ai_auto.active(1 - current_move.player))
|
||||
current_player_is_human_or_both_robots = not self.ai_auto.active(current_move.player) or self.ai_auto.active(1 - current_move.player)
|
||||
if current_player_is_human_or_both_robots and current_move is not self.board.root:
|
||||
self.info.text = current_move.comment(eval=True, hints=self.hints.active(current_move.player))
|
||||
self.evaluation.text = ""
|
||||
|
||||
Reference in new issue
Block a user