コード例 #1
0
def hint():
    details = request.get_json()
    p = r.pipeline()
    p.hget(f'user:{details["id"]}', 'strategy')
    p.hmget(f'match:{details["match"]}', 'proponent', 'rounds')
    strategy, (proponent, rounds) = p.execute()
    proponent_history, opponent_history = get_histories(
        details['id'], proponent, rounds)
    proponent_strategy = getattr(_strategies, strategy)()
    proponent_strategy.history = proponent_history
    opponent_strategy = Player()
    opponent_strategy.history = opponent_history
    return jsonify(status='OK',
                   move=proponent_strategy.strategy(opponent_strategy))
コード例 #2
0
ファイル: test_backstabber.py プロジェクト: ztaylor2/Axelrod
 def setUp(self):
     self.player = Player()