connect_four : Add shorthand moves.

This commit is contained in:
Dhruv Thakker 2018-03-10 15:41:40 +05:30 committed by showell
parent 9fe64b85d0
commit 38d00e9a1e
2 changed files with 5 additions and 5 deletions

View file

@ -30,7 +30,7 @@ class ConnectFourMessageHandler(object):
return original_player + ' moved in column ' + column_number
def game_start_message(self) -> str:
return 'Type `move <column>` to place a token.\n\
return 'Type `move <column-number>` or `<column-number>` 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 <column-number>```'
move_regex = 'move (\d)$'
'```move <column-number>``` or ```<column-number>```'
move_regex = '(move (\d)$)|((\d)$)'
model = ConnectFourModel
gameMessageHandler = ConnectFourMessageHandler

View file

@ -67,7 +67,7 @@ class TestConnectFourBot(BotTestCase):
* To withdraw an invitation, type
`cancel game`
* To make your move during a game, type
```move <column-number>```'''
```move <column-number>``` or ```<column-number>```'''
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 <column>` to place a token.\n\
), 'Type `move <column-number>` or `<column-number>` to place a token.\n\
The first player to get 4 in a row wins!\n Good Luck!')
blank_board = [