Enforce 'rules' command in existing games.
Add 'rules' command in connect_four.py.
Add 'rules' command in tictactoe.py.
Add 'rules' command in game_handler_bot.py.
MODIFY
zulip_bots/zulip_bots/bots/connect_four/connect_four.py
zulip_bots/zulip_bots/bots/connect_four/connect_four.py
@@ -50,6 +50,7 @@ class ConnectFourBotHandler(GameAdapter):
move_regex = '(move ([1-7])$)|(([1-7])$)'
model = ConnectFourModel
gameMessageHandler = ConnectFourMessageHandler
+ rules = '''Try to get four pieces in row, Diagonals count too!'''
super(ConnectFourBotHandler, self).__init__(
game_name,
@@ -58,6 +59,7 @@ class ConnectFourBotHandler(GameAdapter):
move_regex,
model,
gameMessageHandler,
+ rules,
max_players=2
)

MODIFY
zulip_bots/zulip_bots/bots/game_handler_bot/game_handler_bot.py
zulip_bots/zulip_bots/bots/game_handler_bot/game_handler_bot.py
@@ -56,6 +56,7 @@ class GameHandlerBotHandler(GameAdapter):
move_regex = 'move (\d)$'
model = MockModel
gameMessageHandler = GameHandlerBotMessageHandler
+ rules = ''
super(GameHandlerBotHandler, self).__init__(
game_name,
@@ -64,6 +65,7 @@ class GameHandlerBotHandler(GameAdapter):
move_regex,
model,
gameMessageHandler,
+ rules,
max_players=2,
supports_computer=True
)

MODIFY
zulip_bots/zulip_bots/bots/tictactoe/tictactoe.py
zulip_bots/zulip_bots/bots/tictactoe/tictactoe.py
@@ -262,6 +262,7 @@ class ticTacToeHandler(GameAdapter):
move_regex = '(move (\d)$)|((\d)$)'
model = TicTacToeModel
gameMessageHandler = TicTacToeMessageHandler
+ rules = '''Try to get three in horizontal or vertical or diagonal row to win the game.'''
super(ticTacToeHandler, self).__init__(
game_name,
bot_name,
@@ -269,6 +270,7 @@ class ticTacToeHandler(GameAdapter):
move_regex,
model,
gameMessageHandler,
+ rules,
supports_computer=True
)

Enforce 'rules' command in existing games.

Add 'rules' command in connect_four.py.
Add 'rules' command in tictactoe.py.
Add 'rules' command in game_handler_bot.py.