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.
This commit is contained in:
Tarun Kumar 2018-03-03 02:57:06 +05:30 committed by showell
parent ee611d935e
commit b8d4f0b869
3 changed files with 6 additions and 0 deletions

View file

@ -50,6 +50,7 @@ class ConnectFourBotHandler(GameAdapter):
move_regex = '(move ([1-7])$)|(([1-7])$)' move_regex = '(move ([1-7])$)|(([1-7])$)'
model = ConnectFourModel model = ConnectFourModel
gameMessageHandler = ConnectFourMessageHandler gameMessageHandler = ConnectFourMessageHandler
rules = '''Try to get four pieces in row, Diagonals count too!'''
super(ConnectFourBotHandler, self).__init__( super(ConnectFourBotHandler, self).__init__(
game_name, game_name,
@ -58,6 +59,7 @@ class ConnectFourBotHandler(GameAdapter):
move_regex, move_regex,
model, model,
gameMessageHandler, gameMessageHandler,
rules,
max_players=2 max_players=2
) )

View file

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

View file

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