bots: Fix tictactoe, connect_four emoji

This commit is contained in:
fishfred 2020-03-27 14:38:59 +00:00 committed by showell
parent b771bacac0
commit 0a0f9e9d21
4 changed files with 19 additions and 19 deletions

View file

@ -14,11 +14,11 @@ class ConnectFourMessageHandler(object):
board_str += '\n\n'
for column in range(0, 7):
if board[row][column] == 0:
board_str += ':heavy_large_circle: '
board_str += ':white_circle: '
elif board[row][column] == 1:
board_str += ':blue_circle: '
board_str += self.tokens[0] + ' '
elif board[row][column] == -1:
board_str += ':red_circle: '
board_str += self.tokens[1] + ' '
return board_str

View file

@ -74,18 +74,18 @@ class TestConnectFourBot(BotTestCase, DefaultTests):
def test_game_message_handler_responses(self) -> None:
board = ':one: :two: :three: :four: :five: :six: :seven:\n\n' + '\
:heavy_large_circle: :heavy_large_circle: :heavy_large_circle: :heavy_large_circle: \
:heavy_large_circle: :heavy_large_circle: :heavy_large_circle: \n\n\
:heavy_large_circle: :heavy_large_circle: :heavy_large_circle: :heavy_large_circle: \
:heavy_large_circle: :heavy_large_circle: :heavy_large_circle: \n\n\
:heavy_large_circle: :heavy_large_circle: :heavy_large_circle: :heavy_large_circle: \
:heavy_large_circle: :heavy_large_circle: :heavy_large_circle: \n\n\
:blue_circle: :red_circle: :heavy_large_circle: :heavy_large_circle: :heavy_large_circle: \
:heavy_large_circle: :heavy_large_circle: \n\n\
:blue_circle: :red_circle: :heavy_large_circle: :heavy_large_circle: :heavy_large_circle: \
:heavy_large_circle: :heavy_large_circle: \n\n\
:blue_circle: :red_circle: :heavy_large_circle: :heavy_large_circle: :heavy_large_circle: \
:heavy_large_circle: :heavy_large_circle: '
:white_circle: :white_circle: :white_circle: :white_circle: \
:white_circle: :white_circle: :white_circle: \n\n\
:white_circle: :white_circle: :white_circle: :white_circle: \
:white_circle: :white_circle: :white_circle: \n\n\
:white_circle: :white_circle: :white_circle: :white_circle: \
:white_circle: :white_circle: :white_circle: \n\n\
:blue_circle: :red_circle: :white_circle: :white_circle: :white_circle: \
:white_circle: :white_circle: \n\n\
:blue_circle: :red_circle: :white_circle: :white_circle: :white_circle: \
:white_circle: :white_circle: \n\n\
:blue_circle: :red_circle: :white_circle: :white_circle: :white_circle: \
:white_circle: :white_circle: '
bot, bot_handler = self._get_handlers()
self.assertEqual(bot.gameMessageHandler.parse_board(
self.almost_win_board), board)

View file

@ -117,7 +117,7 @@ class TestTicTacToeBot(BotTestCase, DefaultTests):
def test_player_color(self) -> None:
turn = 0
response = ':cross_mark_button:'
response = ':x:'
self._test_player_color(turn, response)
def _test_player_color(self, turn: int, expected_response: str) -> None:
@ -145,9 +145,9 @@ class TestTicTacToeBot(BotTestCase, DefaultTests):
board = [[0, 1, 0],
[0, 0, 0],
[0, 0, 2]]
response = ':one: :cross_mark_button: :three:\n\n' +\
response = ':one: :x: :three:\n\n' +\
':four: :five: :six:\n\n' +\
':seven: :eight: :o_button:\n\n'
':seven: :eight: :o:\n\n'
self._test_parse_board(board, response)
def _test_parse_board(self, board: List[List[int]], expected_response: str) -> None:

View file

@ -209,7 +209,7 @@ class TicTacToeModel(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:
''' Takes the row passed in as a list and returns it as a string. '''