GitHub: github.com/deepmind/open_spiel
Paper: https://arxiv.org/abs/1908.09453
The library has about 25 games implemented (including chess and Go), all using the same interface, so if you write an AI that plays games using that interface, it will be able to play any of those games (of course, writing an AI that actually plays all those games well is extremely difficult!). Some of the games are imperfect information, some are not zero-sum, some have more than 2 players, and some aren't turn-based.
Here is a list of games: https://github.com/deepmind/open_spiel/ ... s/games.md
There are also many example algorithms implemented that can play those games - CFR, MCTS, minimax (alpha-beta), fictitious play, tabular policies, etc. Some of those algorithms are implemented in both C++ and Python as examples.
Games are implemented in C++, but can be interacted with using either Python or C++.
Contributions very welcomed! https://github.com/deepmind/open_spiel/ ... ibuting.md
I'm happy to answer questions but I'm only a minor contributor (porting chess implementation from AlphaZero).
OpenSpiel: DeepMind's new generic games library
Moderators: hgm, Rebel, chrisw
-
- Posts: 793
- Joined: Sun Aug 03, 2014 4:48 am
- Location: London, UK
OpenSpiel: DeepMind's new generic games library
Disclosure: I work for DeepMind on the AlphaZero project, but everything I say here is personal opinion and does not reflect the views of DeepMind / Alphabet.
-
- Posts: 476
- Joined: Sun Mar 17, 2019 12:00 pm
- Full name: Henk Drost
Re: OpenSpiel: DeepMind's new generic games library
No checkers or other draughts-like games?
-
- Posts: 94
- Joined: Thu Feb 27, 2014 8:19 pm
Re: OpenSpiel: DeepMind's new generic games library
Very cool! I've wanted to play around with CFR and similar algorithms.
-
- Posts: 265
- Joined: Sat Feb 22, 2014 8:37 pm
Re: OpenSpiel: DeepMind's new generic games library
Very nice!
Would it be straightforward to implement an AI that plays to tetris?
Where the drawing of tetrominoes would be as random as possible (instead of the fake random function commonly used, which does not allow more than 7 or so tetrominoes to be picked without leaving the other different tetrominoes chosen at least once). We would not care about the speed at which pieces "fall down" at all. Instead, only the given state of the "board" and the available tetromino in hand (as well as possibly the knowledge of the next N tetrominoes) would be given. The AI would then have to make a choice where to place it.
It was proven that such a game eventually ends, it is impossible to make a game last forever. That's because at some point one would get 2 tetrominoes in an alternate way over and over, and there's no way to avoid making holes, eventually leading to losing the game. Note that with the fake random picker commonly used, this sequence has probability 0 to occur so a game may be infinite.
So, an AI could approach the "perfect" play more than humans, I hope. By perfect I mean that in average the game lasts as long as possible (say, a few million moves). I remember Ronald de Man used to think that a professional human player, given enough time to think, would always outperform the AI. I do not see, for the life of me, why this would be the case. It isn't a trivial statement at all, to me, and I wouldn't be the slightest surprised if the AI could outperform any human.
Would it be straightforward to implement an AI that plays to tetris?
Where the drawing of tetrominoes would be as random as possible (instead of the fake random function commonly used, which does not allow more than 7 or so tetrominoes to be picked without leaving the other different tetrominoes chosen at least once). We would not care about the speed at which pieces "fall down" at all. Instead, only the given state of the "board" and the available tetromino in hand (as well as possibly the knowledge of the next N tetrominoes) would be given. The AI would then have to make a choice where to place it.
It was proven that such a game eventually ends, it is impossible to make a game last forever. That's because at some point one would get 2 tetrominoes in an alternate way over and over, and there's no way to avoid making holes, eventually leading to losing the game. Note that with the fake random picker commonly used, this sequence has probability 0 to occur so a game may be infinite.
So, an AI could approach the "perfect" play more than humans, I hope. By perfect I mean that in average the game lasts as long as possible (say, a few million moves). I remember Ronald de Man used to think that a professional human player, given enough time to think, would always outperform the AI. I do not see, for the life of me, why this would be the case. It isn't a trivial statement at all, to me, and I wouldn't be the slightest surprised if the AI could outperform any human.
-
- Posts: 265
- Joined: Sat Feb 22, 2014 8:37 pm
Re: OpenSpiel: DeepMind's new generic games library
Here's a tetris AI that uses 4 functions to assess/compute the score of a given position: https://github.com/LeeYiyuan/tetrisai, as explained there: https://codemyroad.wordpress.com/2013/0 ... ct-player/.
The guy apparently used a genetic algorithm to determine the best values of the 4 coefficients of the functions to maximize or minimize. However he implemented the game with the poor random tetrominoes generator so that long sequences of a single tetromino or alternating sequences, are avoided. But I guess it's very easy to modify his code (in particular this file https://github.com/LeeYiyuan/tetrisai/b ... nerator.js) to make it use totally random (or close to it) tetrominoes.
Should one start from such a program to implement tetris in OpenSpiel? Or is it better to start from scratch?
The guy apparently used a genetic algorithm to determine the best values of the 4 coefficients of the functions to maximize or minimize. However he implemented the game with the poor random tetrominoes generator so that long sequences of a single tetromino or alternating sequences, are avoided. But I guess it's very easy to modify his code (in particular this file https://github.com/LeeYiyuan/tetrisai/b ... nerator.js) to make it use totally random (or close to it) tetrominoes.
Should one start from such a program to implement tetris in OpenSpiel? Or is it better to start from scratch?
-
- Posts: 793
- Joined: Sun Aug 03, 2014 4:48 am
- Location: London, UK
Re: OpenSpiel: DeepMind's new generic games library
Contributions warmly welcomed . We had limited time and wanted to implement a wide range of games from different categories, so some popular games have not been implemented.
Yes! Technically, once you have the tetris game implemented, you can already use any of the existing algorithms to play it.Would it be straightforward to implement an AI that plays to tetris?
That does sound like a very interesting variant of the game.
In terms of implementing the tetris environment, I would say it's probably easier to start from scratch., especially since that project seems to be in Javascript.Should one start from such a program to implement tetris in OpenSpiel? Or is it better to start from scratch?
Here are instructions for how to implement a game: https://github.com/deepmind/open_spiel/ ... r_guide.md
The game has to be implemented in C++, but afterwards the AI can be implemented in C++ or Python (potentially Swift and Go in the future).
Disclosure: I work for DeepMind on the AlphaZero project, but everything I say here is personal opinion and does not reflect the views of DeepMind / Alphabet.