Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base work for AI #319

Open
JTBooth opened this issue Feb 20, 2016 · 3 comments
Open

Base work for AI #319

JTBooth opened this issue Feb 20, 2016 · 3 comments
Labels

Comments

@JTBooth
Copy link

JTBooth commented Feb 20, 2016

Some things we can set up to make real work on AI faster and easier. This is really not a proposal for a small amount of work, but an attempt to point out and hopefully discuss the hard things about building an AI around fireplace.

Get player's visible board state: Utility function to get all of the information available to the current player, intended to be passed to a score function. Would include minions/weapons on the board currently, cards in hand, number of cards in opponent's hand, cards in the player's deck, and number of cards in the opponent's deck. (There's definitely more information available, but this should be plenty to work with for a while)

Hypothetical Move: To work on sequencing within a turn, we'll need to be able to construct trees. So, for each command a user can input, add the option to in stead hypothetically play that move and return a copy of the game object where that move took place... without revealing any information the user can't have. Which of course means that this is actually a very complicated step and includes things like hypothetical random minions. So, fake it for now, and promise to only run the AI on cards that don't randomly pull cards from places you're not allowed to see.

Dummy AI and score functions: Define an AI base class as a thing that is constructed on a score function, takes in a game, and plays moves on it until the end of its turn, possibly writing down state internally as well. Define a score function that takes in a game and returns rand(0,1). Test this with an analog of full_game that takes way longer because the AI is calling hypothetical move a ton of times.

@smallnamespace
Copy link
Collaborator

Couple of points:

  • Most of the things you're proposing probably properly lie in a separate AI project, not in fireplace proper (e.g. utility function computation). It should be pretty easy to start up a new project and just install fireplace as a library.
  • Have you taken a look at https://github.com/Ragowit/fireplace/blob/master/mcts/uct.py? This is most of the features you're talking about. Actual AI performance is very weak right now, but it's a start.

To be clear, I think what you're proposing makes a lot of sense, but we should compartmentalize projects as a general engineering practice, even if it's slightly more work up front. I'm working on #318 to make fireplace more easily installable as a library, so this should be even more simple soon.

@smallnamespace
Copy link
Collaborator

As an aside, there are features that need to be added to fireplace to make a real AI work:

  • Support for specifying the outcome of random events explicitly, or at least allowing iteration through them or marking random nodes as such; there's a big difference between deterministic nodes and random ones
  • Hiding information that's not visible to the other player would be nice as an option, as well as flipping perspective back and forth
  • Fast deep cloning of game states (right now they take about ~200 ms to clone)

I'm slowly working on all these features, so if you'd like to help, let me know and I'll set up separate issues for them.

@JTBooth
Copy link
Author

JTBooth commented Feb 20, 2016

I feel pretty dumb for missing the uct.py file. I think I decided it was a util file. I'll give it a closer look before suggesting more features. The IRC told me someone had worked on it, but I assumed they meant offline. I'd be happy to work on the features you talked about. Would certainly want that all to be in place before I took a run at a standalone AI project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants