From 38d00e9a1eebb6736f1fe3960a9b72bfc12aa3bf Mon Sep 17 00:00:00 2001 From: Dhruv Thakker Date: Sat, 10 Mar 2018 15:41:40 +0530 Subject: [PATCH] connect_four : Add shorthand moves. --- zulip_bots/zulip_bots/bots/connect_four/connect_four.py | 6 +++--- .../zulip_bots/bots/connect_four/test_connect_four.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) 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 60e50ef..bbae313 100644 --- a/zulip_bots/zulip_bots/bots/connect_four/connect_four.py +++ b/zulip_bots/zulip_bots/bots/connect_four/connect_four.py @@ -30,7 +30,7 @@ class ConnectFourMessageHandler(object): return original_player + ' moved in column ' + column_number def game_start_message(self) -> str: - return 'Type `move ` to place a token.\n\ + return 'Type `move ` or `` to place a token.\n\ The first player to get 4 in a row wins!\n Good Luck!' @@ -46,8 +46,8 @@ class ConnectFourBotHandler(GameAdapter): game_name = 'Connect Four' bot_name = 'connect_four' move_help_message = '* To make your move during a game, type\n' \ - '```move ```' - move_regex = 'move (\d)$' + '```move ``` or ``````' + move_regex = '(move (\d)$)|((\d)$)' model = ConnectFourModel gameMessageHandler = ConnectFourMessageHandler diff --git a/zulip_bots/zulip_bots/bots/connect_four/test_connect_four.py b/zulip_bots/zulip_bots/bots/connect_four/test_connect_four.py index af3ead9..fd7ec1b 100644 --- a/zulip_bots/zulip_bots/bots/connect_four/test_connect_four.py +++ b/zulip_bots/zulip_bots/bots/connect_four/test_connect_four.py @@ -67,7 +67,7 @@ class TestConnectFourBot(BotTestCase): * To withdraw an invitation, type `cancel game` * To make your move during a game, type -```move ```''' +```move ``` or ``````''' def test_static_responses(self) -> None: self.verify_response('help', self.help_message(), 0) @@ -94,7 +94,7 @@ class TestConnectFourBot(BotTestCase): self.assertEqual(bot.gameMessageHandler.alert_move_message( 'foo', 'move 6'), 'foo moved in column 6') self.assertEqual(bot.gameMessageHandler.game_start_message( - ), 'Type `move ` to place a token.\n\ + ), 'Type `move ` or `` to place a token.\n\ The first player to get 4 in a row wins!\n Good Luck!') blank_board = [