datamllab / rlcard

Reinforcement Learning / AI Bots in Card (Poker) Games - Blackjack, Leduc, Texas, DouDizhu, Mahjong, UNO.
http://www.rlcard.org
MIT License
2.91k stars 630 forks source link

Can I add my own rule-based model for Dou dizhu? #31

Closed gogov5 closed 4 years ago

gogov5 commented 4 years ago

Can I used the Agents as below for game Dou dizhu?

First, add my own Rule based model Agent, then

agent_CFR = cfr_gent() agent_RuleBased = MyRuleAgent() anent_NFSP = nfsp_agent() env = rlcard.make('doudizhu') env.set_agents([agent_CFR, agent_RuleBased, anent_NFSP])

daochenzha commented 4 years ago

@gogov5 Yes, you can. The provided random agent can actually also be regarded as a kind of rule agent. You can refer to https://github.com/datamllab/rlcard/blob/master/rlcard/agents/random_agent.py

The env will call step in training and eval_step in testing. As long as the rule agent has these two functions, I think it should work.