summaryrefslogtreecommitdiff
path: root/ausbutler/butler.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-01-04 00:26:31 +0100
committeremkael <emkael@tlen.pl>2017-01-04 20:56:20 +0100
commit66cd9985aec868e393842d302beb3f01bcd2ba31 (patch)
tree8d74db2d6120449dd927e94c1a7296b321625a79 /ausbutler/butler.py
parent9e475e3cc99849c3238995aebac9a1dd361bfec3 (diff)
Applying normalization to butler scores
Diffstat (limited to 'ausbutler/butler.py')
-rw-r--r--ausbutler/butler.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/ausbutler/butler.py b/ausbutler/butler.py
index fb78fdb..2fae840 100644
--- a/ausbutler/butler.py
+++ b/ausbutler/butler.py
@@ -32,3 +32,10 @@ def get_room(butler, player):
if player in [table.closeE, table.closeW, table.closeN, table.closeS]:
return 'closed'
+def normalize(butler):
+ if butler.board_count == 0:
+ return 0.0
+ return (
+ butler.cut_score / butler.board_count
+ + butler.opp_score * config['opponent_factor']
+ ) * butler.board_count