def __init__(self, wp=5, wb1=-10, wb2=-40, wb3=-20, we1=10, we2=80, ww=10000): self.p = PossibilityScorer(wp) self.b = BlankScorer(wb1, wb2, wb3) self.ec = EdgeCornerScorer(we1, we2) self.w = WinLoseScorer(ww)
class Evaluator_PBWEc(AbstractEvaluator): """Specific Evaluator Possibility + Blank + WinLose + EdgeCorner 盤面の評価値を着手可能数+空きマスと辺と隅のパターン+勝敗で算出 """ def __init__(self, wp=5, wb1=-10, wb2=-40, wb3=-20, we1=10, we2=80, ww=10000): self.p = PossibilityScorer(wp) self.b = BlankScorer(wb1, wb2, wb3) self.ec = EdgeCornerScorer(we1, we2) self.w = WinLoseScorer(ww) def evaluate(self, color, board, possibility_b, possibility_w): """evaluate """ score_w = self.w.get_score(color, board, possibility_b, possibility_w) # 勝敗が決まっている場合 if score_w is not None: return score_w score_p = self.p.get_score(color, board, possibility_b, possibility_w) score_b = self.b.get_score(color, board, possibility_b, possibility_w) score_ec = self.ec.get_score(color, board, possibility_b, possibility_w) return score_p + score_b + score_ec
class Evaluator_Ec(AbstractEvaluator): """Specific Evaluator EdgeCorner 辺と隅のパターンの評価値を算出 """ def __init__(self, w1=1, w2=8): self.scorer = EdgeCornerScorer(w1, w2) # 辺と隅のパターンによる評価値算出 def evaluate(self, color, board, possibility_b, possibility_w): """evaluate """ return self.scorer.get_score(color, board, possibility_b, possibility_w)
class Evaluator_EcW(AbstractEvaluator): """Specific Evaluator EdgeCorner + WinLose 盤面の評価値を辺と隅のパターン+勝敗で算出 """ def __init__(self, wec1=1, wec2=8, ww=10000): self.ec = EdgeCornerScorer(wec1, wec2) self.w = WinLoseScorer(ww) def evaluate(self, color, board, possibility_b, possibility_w): """evaluate """ score_w = self.w.get_score(color, board, possibility_b, possibility_w) # 勝敗が決まっている場合 if score_w is not None: return score_w score_ec = self.ec.get_score(color, board, possibility_b, possibility_w) return score_ec
def __init__(self, wb1=-1, wb2=-4, wb3=-2, we1=1, we2=8, ww=10000): self.b = BlankScorer(wb1, wb2, wb3) self.ec = EdgeCornerScorer(we1, we2) self.w = WinLoseScorer(ww)
def __init__(self, wec1=1, wec2=8, ww=10000): self.ec = EdgeCornerScorer(wec1, wec2) self.w = WinLoseScorer(ww)
def __init__(self, w1=1, w2=8): self.scorer = EdgeCornerScorer(w1, w2) # 辺と隅のパターンによる評価値算出