diff options
author | emkael <emkael@tlen.pl> | 2017-01-06 03:36:49 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2017-01-06 03:36:49 +0100 |
commit | abd09ddce26dfc8dee8b352e86c50185d548e61a (patch) | |
tree | 7e6beab92b6083278876c823940407f8e56ee55f /ausbutler/butler.py | |
parent | cbb74e0b5971fe4453477094558cdb125bee4524 (diff) |
Code formatting
Diffstat (limited to 'ausbutler/butler.py')
-rw-r--r-- | ausbutler/butler.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/ausbutler/butler.py b/ausbutler/butler.py index a88776e..d4fe1d3 100644 --- a/ausbutler/butler.py +++ b/ausbutler/butler.py @@ -7,6 +7,7 @@ def cutoff(score, cutoff_point=32, cutoff_rate=0.1): score += cutoff_point return score * sign + def get_opponents(butler, player): table = butler.table if player in [table.openE, table.openW]: @@ -18,6 +19,7 @@ def get_opponents(butler, player): if player in [table.closeN, table.closeS]: return [table.closeE, table.closeW] + def get_room(butler, player): table = butler.table if player in [table.openE, table.openW, table.openN, table.openS]: @@ -25,16 +27,20 @@ def get_room(butler, player): if player in [table.closeE, table.closeW, table.closeN, table.closeS]: return 'closed' + def get_line(butler, player): table = butler.table room = get_room(butler, player).upper() - direction = 'NS' if player in [table.openN, table.openS, table.closeN, table.closeS] else 'EW' + direction = 'NS' if player in [ + table.openN, table.openS, table.closeN, table.closeS + ] else 'EW' return '%s_%s' % (room, direction) + def normalize(butler, opp_factor=0.5): if butler.board_count == 0: return 0.0 return ( - butler.cut_score / butler.board_count - + butler.opp_score * opp_factor + butler.cut_score / butler.board_count + + butler.opp_score * opp_factor ) * butler.board_count |