def test_efg_game(self): game = pyspiel.load_efg_game(pyspiel.get_sample_efg_data()) # EFG games loaded directly by string cannot serialize because the game's # data cannot be passed in via string parameter. for _ in range(0, 100): self.sim_game( game, check_pyspiel_serialization=False, check_pickle_serialization=False) game = pyspiel.load_efg_game(pyspiel.get_kuhn_poker_efg_data()) for _ in range(0, 100): self.sim_game( game, check_pyspiel_serialization=False, check_pickle_serialization=False) # EFG games loaded by file should serialize properly: filename = file_utils.find_file( "open_spiel/games/efg/sample.efg", 2) if filename is not None: game = pyspiel.load_game("efg_game(filename=" + filename + ")") for _ in range(0, 100): self.sim_game(game) filename = file_utils.find_file( "open_spiel/games/efg/sample.efg", 2) if filename is not None: game = pyspiel.load_game("efg_game(filename=" + filename + ")") for _ in range(0, 100): self.sim_game(game)
def test_kuhn_poker_efg(self): game = pyspiel.load_efg_game(pyspiel.get_kuhn_poker_efg_data()) val1, val2, _, _ = sequence_form_lp.solve_zero_sum_game(game) # value from Kuhn 1950 or https://en.wikipedia.org/wiki/Kuhn_poker self.assertAlmostEqual(val1, -1 / 18) self.assertAlmostEqual(val2, +1 / 18)