From b8d4f0b869f6377dd0350edf98187ba11fe0f4c9 Mon Sep 17 00:00:00 2001 From: Tarun Kumar Date: Sat, 3 Mar 2018 02:57:06 +0530 Subject: [PATCH] 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. --- zulip_bots/zulip_bots/bots/connect_four/connect_four.py | 2 ++ zulip_bots/zulip_bots/bots/game_handler_bot/game_handler_bot.py | 2 ++ zulip_bots/zulip_bots/bots/tictactoe/tictactoe.py | 2 ++ 3 files changed, 6 insertions(+) diff --git a/zulip_bots/zulip_bots/bots/connect_four/connect_four.py b/zulip_bots/zulip_bots/bots/connect_four/connect_four.py index c1b2a0a..cfee5be 100644 --- a/zulip_bots/zulip_bots/bots/connect_four/connect_four.py +++ b/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 ) diff --git a/zulip_bots/zulip_bots/bots/game_handler_bot/game_handler_bot.py b/zulip_bots/zulip_bots/bots/game_handler_bot/game_handler_bot.py index 8540a2c..1d47f67 100644 --- a/zulip_bots/zulip_bots/bots/game_handler_bot/game_handler_bot.py +++ b/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 ) diff --git a/zulip_bots/zulip_bots/bots/tictactoe/tictactoe.py b/zulip_bots/zulip_bots/bots/tictactoe/tictactoe.py index 4d4e61e..f64fffa 100644 --- a/zulip_bots/zulip_bots/bots/tictactoe/tictactoe.py +++ b/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 )