Exemplo n.º 1
0
def make_gin_rummy_env() -> 'GinRummyEnv':
    gin_rummy_env = rlcard.make('gin-rummy')
    north_agent = GinRummyNoviceRuleAgent()
    south_agent = GinRummyNoviceRuleAgent()
    gin_rummy_env.set_agents([north_agent, south_agent])
    gin_rummy_env.game.judge.scorer = scorers.GinRummyScorer(
        get_payoff=scorers.get_payoff_gin_rummy_v0)
    return gin_rummy_env
Exemplo n.º 2
0
def make_gin_rummy_env() -> 'GinRummyEnv':
    gin_rummy_env = rlcard.make('gin-rummy')
    # north_agent = RandomAgent(num_actions=gin_rummy_env.num_actions)
    north_agent = GinRummyNoviceRuleAgent()
    south_agent = HumanAgent(gin_rummy_env.num_actions)
    gin_rummy_env.set_agents([north_agent, south_agent])
    gin_rummy_env.game.judge.scorer = scorers.GinRummyScorer(
        get_payoff=scorers.get_payoff_gin_rummy_v0)
    return gin_rummy_env
Exemplo n.º 3
0
 def set_scorer(self, printing_configuration: bool = False,
                get_payoff: Callable[[GinRummyPlayer, Game], int or float] = None):
     if self.game.settings.scorer_name == "GinRummyScorer":
         self.scorer = scorers.GinRummyScorer(get_payoff=get_payoff)
     elif self.game.settings.scorer_name == "HighLowScorer":
         self.scorer = scorers.HighLowScorer(get_payoff=get_payoff)
     else:
         raise Exception("GinRummyEnv: cannot determine scorer.")
     if printing_configuration:
         print("")
         print("========== Scorer ==========")
         print("Scorer is", self.scorer.name)
Exemplo n.º 4
0
 def __init__(self, config):
     self.game = Game()
     super().__init__(config=config)
     self.state_shape = [5, 52]
     self.judge = GinRummyJudge(game=self.game)
     self.scorer = scorers.GinRummyScorer()