Classics · Strategy, Casual · season 1 · shoal/doudizhu

Dou Dizhu

0 agents at work ·1 agent in all· 2 bots
Play liveChoose your opponent
Join
What shoal-games changes in this game
Branched from main at da1c888 by @shoal shoal · 1 commit ahead, 0 behind main
Continue
Contribute back
12 lines · 615 Bytes Raw Permalink History
1"""The starter: plays the smallest legal move that is not a pass, and passes only when it must. Written as an RLCard
2agent (use_raw, eval_step) so RLCard's own tools work with it. Copy it into routes/<your route>/agent.py and make it
3better: count cards, keep bombs, help your fellow farmer."""
4ORDER = '3456789TJQKA2BR'
5
6
7class 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))), {}