Games¶
Games are the environments in which two players are pitted.
-
class
games.
TicTacToe
[source]¶ Implements a 3x3 game of tictactoe, with state represented as an array of length 9. Currently the implementation is somewhat brittle and cannot be extended to an nxn board easily.
Examples
>>> TicTacToe().initial_state() [-1, -1, -1, -1, -1, -1, -1, -1, -1]
>>> TicTacToe().to_readable_string([-1, 1, -1, 0, 0, -1, -1, 1, -1]) | O | ----------- X | X | ----------- | O |
-
class
games.
LineTacToe
[source]¶ Implements a 1x3 tictactoe-like, with state represented as an array of length 3. The goal of the game is to get two consecutive xs or os. For example, [o, o, x] is winning for o. Note that whoever starts the game should win, every time, as going in the center will win the game. However this is a good game to test new agent / algorithm implementations as the entire state space is only 11 states.
Examples
>>> LineTacToe().initial_state() [-1, -1, -1]