@@ -80,3 +80,46 @@ Compatible games that have been implemented include:
80
80
* `Ultimate (or 9x9) Tic Tac Toe
81
81
<https://github.com/jbradberry/ultimate_tictactoe> `_
82
82
* `Chong <https://github.com/jbradberry/chong >`_
83
+
84
+
85
+ Implementing New Games
86
+ ----------------------
87
+
88
+ In order to create a compatible implementation of a board game, you
89
+ need to implement a class with the following methods::
90
+
91
+ class BoardGame:
92
+ def starting_state(self): pass
93
+ def display(self, state, action, _unicode=True): pass
94
+ def to_compact_state(self, data): pass
95
+ def to_json_state(self, state): pass
96
+ def to_compact_action(self, action): pass
97
+ def to_json_action(self, action): pass
98
+ def from_notation(self, notation): pass
99
+ def to_notation(self, action): pass
100
+ def next_state(self, history, action): pass
101
+ def is_legal(self, state, action): pass
102
+ def legal_actions(self, state): pass
103
+ def previous_player(self, state): pass
104
+ def current_player(self, state): pass
105
+ def is_ended(self, state): pass
106
+ def win_values(self, state): pass
107
+ def points_values(self, state): pass
108
+ def winner_message(self, winners): pass
109
+
110
+
111
+ Additionally, you need to register your new game class so that it can
112
+ be used. To do this, add at least one entry point in your setup.py
113
+ file under the ``jrb_board.games `` namespace::
114
+
115
+ setup(
116
+ ...
117
+ entry_points={
118
+ 'jrb_board.games': 'my_game = my_repo.my_module:BoardGame',
119
+ },
120
+ ...
121
+ )
122
+
123
+
124
+ Then when your package is installed, it will be ready to be used by
125
+ boardgame-socketserver, boardgame-socketplayer, and mcts.
0 commit comments