bots: Fix tictactoe, connect_four emoji
This commit is contained in:
parent
b771bacac0
commit
0a0f9e9d21
|
@ -14,11 +14,11 @@ class ConnectFourMessageHandler(object):
|
||||||
board_str += '\n\n'
|
board_str += '\n\n'
|
||||||
for column in range(0, 7):
|
for column in range(0, 7):
|
||||||
if board[row][column] == 0:
|
if board[row][column] == 0:
|
||||||
board_str += ':heavy_large_circle: '
|
board_str += ':white_circle: '
|
||||||
elif board[row][column] == 1:
|
elif board[row][column] == 1:
|
||||||
board_str += ':blue_circle: '
|
board_str += self.tokens[0] + ' '
|
||||||
elif board[row][column] == -1:
|
elif board[row][column] == -1:
|
||||||
board_str += ':red_circle: '
|
board_str += self.tokens[1] + ' '
|
||||||
|
|
||||||
return board_str
|
return board_str
|
||||||
|
|
||||||
|
|
|
@ -74,18 +74,18 @@ class TestConnectFourBot(BotTestCase, DefaultTests):
|
||||||
|
|
||||||
def test_game_message_handler_responses(self) -> None:
|
def test_game_message_handler_responses(self) -> None:
|
||||||
board = ':one: :two: :three: :four: :five: :six: :seven:\n\n' + '\
|
board = ':one: :two: :three: :four: :five: :six: :seven:\n\n' + '\
|
||||||
:heavy_large_circle: :heavy_large_circle: :heavy_large_circle: :heavy_large_circle: \
|
:white_circle: :white_circle: :white_circle: :white_circle: \
|
||||||
:heavy_large_circle: :heavy_large_circle: :heavy_large_circle: \n\n\
|
:white_circle: :white_circle: :white_circle: \n\n\
|
||||||
:heavy_large_circle: :heavy_large_circle: :heavy_large_circle: :heavy_large_circle: \
|
:white_circle: :white_circle: :white_circle: :white_circle: \
|
||||||
:heavy_large_circle: :heavy_large_circle: :heavy_large_circle: \n\n\
|
:white_circle: :white_circle: :white_circle: \n\n\
|
||||||
:heavy_large_circle: :heavy_large_circle: :heavy_large_circle: :heavy_large_circle: \
|
:white_circle: :white_circle: :white_circle: :white_circle: \
|
||||||
:heavy_large_circle: :heavy_large_circle: :heavy_large_circle: \n\n\
|
:white_circle: :white_circle: :white_circle: \n\n\
|
||||||
:blue_circle: :red_circle: :heavy_large_circle: :heavy_large_circle: :heavy_large_circle: \
|
:blue_circle: :red_circle: :white_circle: :white_circle: :white_circle: \
|
||||||
:heavy_large_circle: :heavy_large_circle: \n\n\
|
:white_circle: :white_circle: \n\n\
|
||||||
:blue_circle: :red_circle: :heavy_large_circle: :heavy_large_circle: :heavy_large_circle: \
|
:blue_circle: :red_circle: :white_circle: :white_circle: :white_circle: \
|
||||||
:heavy_large_circle: :heavy_large_circle: \n\n\
|
:white_circle: :white_circle: \n\n\
|
||||||
:blue_circle: :red_circle: :heavy_large_circle: :heavy_large_circle: :heavy_large_circle: \
|
:blue_circle: :red_circle: :white_circle: :white_circle: :white_circle: \
|
||||||
:heavy_large_circle: :heavy_large_circle: '
|
:white_circle: :white_circle: '
|
||||||
bot, bot_handler = self._get_handlers()
|
bot, bot_handler = self._get_handlers()
|
||||||
self.assertEqual(bot.gameMessageHandler.parse_board(
|
self.assertEqual(bot.gameMessageHandler.parse_board(
|
||||||
self.almost_win_board), board)
|
self.almost_win_board), board)
|
||||||
|
|
|
@ -117,7 +117,7 @@ class TestTicTacToeBot(BotTestCase, DefaultTests):
|
||||||
|
|
||||||
def test_player_color(self) -> None:
|
def test_player_color(self) -> None:
|
||||||
turn = 0
|
turn = 0
|
||||||
response = ':cross_mark_button:'
|
response = ':x:'
|
||||||
self._test_player_color(turn, response)
|
self._test_player_color(turn, response)
|
||||||
|
|
||||||
def _test_player_color(self, turn: int, expected_response: str) -> None:
|
def _test_player_color(self, turn: int, expected_response: str) -> None:
|
||||||
|
@ -145,9 +145,9 @@ class TestTicTacToeBot(BotTestCase, DefaultTests):
|
||||||
board = [[0, 1, 0],
|
board = [[0, 1, 0],
|
||||||
[0, 0, 0],
|
[0, 0, 0],
|
||||||
[0, 0, 2]]
|
[0, 0, 2]]
|
||||||
response = ':one: :cross_mark_button: :three:\n\n' +\
|
response = ':one: :x: :three:\n\n' +\
|
||||||
':four: :five: :six:\n\n' +\
|
':four: :five: :six:\n\n' +\
|
||||||
':seven: :eight: :o_button:\n\n'
|
':seven: :eight: :o:\n\n'
|
||||||
self._test_parse_board(board, response)
|
self._test_parse_board(board, response)
|
||||||
|
|
||||||
def _test_parse_board(self, board: List[List[int]], expected_response: str) -> None:
|
def _test_parse_board(self, board: List[List[int]], expected_response: str) -> None:
|
||||||
|
|
|
@ -209,7 +209,7 @@ class TicTacToeModel(object):
|
||||||
|
|
||||||
|
|
||||||
class TicTacToeMessageHandler(object):
|
class TicTacToeMessageHandler(object):
|
||||||
tokens = [':cross_mark_button:', ':o_button:']
|
tokens = [':x:', ':o:']
|
||||||
|
|
||||||
def parse_row(self, row: Tuple[int, int], row_num: int) -> str:
|
def parse_row(self, row: Tuple[int, int], row_num: int) -> str:
|
||||||
''' Takes the row passed in as a list and returns it as a string. '''
|
''' Takes the row passed in as a list and returns it as a string. '''
|
||||||
|
|
Loading…
Reference in a new issue