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))
def setUp(self): self.player = Player()