From 1c7713a73abdbb04e7009a40ca0921653adf632f Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 25 Sep 2015 22:14:47 +1000 Subject: [PATCH] Added basic board state evaluation --- hearthbreaker/agents/game_evaluator.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 hearthbreaker/agents/game_evaluator.py diff --git a/hearthbreaker/agents/game_evaluator.py b/hearthbreaker/agents/game_evaluator.py new file mode 100644 index 00000000..aa3583d6 --- /dev/null +++ b/hearthbreaker/agents/game_evaluator.py @@ -0,0 +1,18 @@ +# note all values are experimental + +def game_evaluator(player, evaluate_once=False): + score = 0 + for minion in player.minions: + minion_score = 0 + minion_score += minion.calculate_attack() * minion.health ** 0.7 + if minion.taunt: + minion_score += minion.health * 2 + if not minion.can_be_targeted_by_spells: + minion_score *= 1.5 + score += minion_score + score += len(player.hand) * 3 + score += player.max_mana * 3 + score += player.hero.health + if not evaluate_once: + score -= game_evaluator(player.opponent, True) + return score