Git Product home page Git Product logo

carcassonne-ai's Introduction

samuelscheit

   

carcassonne-ai's People

Contributors

samuelscheit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

carcassonne-ai's Issues

Illegal actions by AI

I tried testing the models that you've trained in src/results/carcassonne2/ using the testing code in muzero.py (running the script, picking 1 to load the model and then 3 to self play) and I'm getting some strange results.

In the screenshot below, you can see that many of the moves being made are illegal. I suspect that this is either an issue with the way that legal actions are defined in https://github.com/Flam3rboy/carcassonne-ai/blob/a3a96cc0650538d78bc60e78ecf73b6e013b279d/src/muzero/carcassonne/utils/action_util.py#L43-L76
Alternatively, it might be that the interpretation of selected actions is off.

Screen Shot 2022-01-14 at 00 16 53

I'm happy to help fix the problem, but on first glance, I didn't quite understand how ActionUtil works. Do you have any ideas here? It's also entirely possible that I'm using the code in the wrong way or that I've misunderstood something else, so let me know if that's the case!

'NoneType' object has no attribute 'draw_game_state'

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. 🙏🙏

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.