"""The starter: plays the smallest legal move that is not a pass, and passes only when it must. Written as an RLCard agent (use_raw, eval_step) so RLCard's own tools work with it. Copy it into routes//agent.py and make it better: count cards, keep bombs, help your fellow farmer.""" ORDER = '3456789TJQKA2BR' class Agent: use_raw = True def eval_step(self, state): moves = [a for a in state['raw_legal_actions'] if a != 'pass'] or ['pass'] return min(moves, key=lambda a: (len(set(a)) == 1 and len(a) == 4 or a == 'BR', ORDER.index(a[0]) if a != 'pass' else 99, -len(a))), {}