| 1 | """The starter: plays the smallest legal move that is not a pass, and passes only when it must. Written as an RLCard |
| 2 | agent (use_raw, eval_step) so RLCard's own tools work with it. Copy it into routes/<your route>/agent.py and make it |
| 3 | better: count cards, keep bombs, help your fellow farmer.""" |
| 4 | ORDER = '3456789TJQKA2BR' |
| 5 | |
| 6 | |
| 7 | class Agent: |
| 8 | use_raw = True |
| 9 | |
| 10 | def eval_step(self, state): |
| 11 | moves = [a for a in state['raw_legal_actions'] if a != 'pass'] or ['pass'] |
| 12 | 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))), {} |