SamuelScheit / carcassonne-ai

Artificial intelligence for the game Carcassonne

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'NoneType' object has no attribute 'draw_game_state'

PeterInTheHouse opened this issue · comments

This error happened when I try "3. Render some self play games"
I try a few day, but I can't fix it.
image

Exception has occurred: RayTaskError(AttributeError)
�[36mray::SelfPlay.play_game()�[39m (pid=13172, ip=127.0.0.1, repr=<self_play.SelfPlay object at 0x0000027D88204C70>)
File "python\ray_raylet.pyx", line 663, in ray._raylet.execute_task
File "python\ray_raylet.pyx", line 667, in ray._raylet.execute_task
File "python\ray_raylet.pyx", line 614, in ray._raylet.execute_task.function_executor
File "C:\Users\s0708.conda\envs\muzero\lib\site-packages\ray_private\function_manager.py", line 701, in actor_method_executor
return method(__ray_actor, *args, **kwargs)
File "C:\Users\s0708.conda\envs\muzero\lib\site-packages\ray\util\tracing\tracing_helper.py", line 462, in _resume_span
return method(self, *_args, **_kwargs)
File "C:\Users\s0708\Desktop\carcassonne-ai-main\src\muzero\self_play.py", line 124, in play_game
self.game.render()
File "C:\Users\s0708\Desktop\carcassonne-ai-main\src\muzero\carcassonne2.py", line 218, in render
self.env.render()
File "C:\Users\s0708\Desktop\carcassonne-ai-main\src\muzero\carcassonne\carcassonne_game.py", line 60, in render
self.visualiser.draw_game_state(self.state)
AttributeError: 'NoneType' object has no attribute 'draw_game_state'
File "C:\Users\s0708\Desktop\carcassonne-ai-main\src\muzero\muzero.py", line 402, in test
ray.get(
File "C:\Users\s0708\Desktop\carcassonne-ai-main\src\muzero\muzero.py", line 677, in
muzero.test(render=True, opponent="human", muzero_player=0)
ray.exceptions.RayTaskError(AttributeError): �[36mray::SelfPlay.play_game()�[39m (pid=13172, ip=127.0.0.1, repr=<self_play.SelfPlay object at 0x0000027D88204C70>)
File "python\ray_raylet.pyx", line 663, in ray._raylet.execute_task
File "python\ray_raylet.pyx", line 667, in ray._raylet.execute_task
File "python\ray_raylet.pyx", line 614, in ray._raylet.execute_task.function_executor
File "C:\Users\s0708.conda\envs\muzero\lib\site-packages\ray_private\function_manager.py", line 701, in actor_method_executor
return method(__ray_actor, *args, **kwargs)
File "C:\Users\s0708.conda\envs\muzero\lib\site-packages\ray\util\tracing\tracing_helper.py", line 462, in _resume_span
return method(self, *_args, **_kwargs)
File "C:\Users\s0708\Desktop\carcassonne-ai-main\src\muzero\self_play.py", line 124, in play_game
self.game.render()
File "C:\Users\s0708\Desktop\carcassonne-ai-main\src\muzero\carcassonne2.py", line 218, in render
self.env.render()
File "C:\Users\s0708\Desktop\carcassonne-ai-main\src\muzero\carcassonne\carcassonne_game.py", line 60, in render
self.visualiser.draw_game_state(self.state)
AttributeError: 'NoneType' object has no attribute 'draw_game_state'

Is this code below cause this problem?
In carcassonne2.py

class Game(AbstractGame):
    """
    Game wrapper.
    """
    def __init__(self, seed=None):
        self.env = CarcassonneGame(players=2,
                                   tile_sets=[TileSet.BASE],
                                   supplementary_rules=[],
                                   visualiser=None)

My enviroment is

python=3.9.17

numpy=1.25.2
torch=2.0.1
tensorboard=2.10.0
gym=0.26.2
ray=1.12.0
seaborn=0.12.2
nevergrad=0.12.0
redis=5.0.0
graphviz=0.20.1

May you share your current requirement? Thanks a lot. 🙏🙏

sorry, this project is not maintained anymore and the state on github is the latest version