diff options
Diffstat (limited to 'ausbutler/butler.py')
-rw-r--r-- | ausbutler/butler.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/ausbutler/butler.py b/ausbutler/butler.py new file mode 100644 index 0000000..424e385 --- /dev/null +++ b/ausbutler/butler.py @@ -0,0 +1,23 @@ +import json +from os import path +import __main__ + +config = json.load( + open(path.join(path.dirname(__main__.__file__), 'config', 'butler.json'))) + +def cutoff(score): + sign = 1 if score > 0 else -1 + score = abs(score) + if score > config['cutoff_point']: + score -= config['cutoff_point'] + score *= config['cutoff_rate'] + score += config['cutoff_point'] + return score * sign + +def get_room(butler, player): + table = butler.table + if player in [table.openE, table.openW, table.openN, table.openS]: + return 'open' + if player in [table.closeE, table.closeW, table.closeN, table.closeS]: + return 'closed' + |