def __init__(self, ctx, opponent):
self.ctx = ctx
self.board = Board(ctx._ttt_size)
self.opponent = opponent
xo = random.sample((Tile.X, Tile.O), 2)
self.players = random.sample(list(map(Player, (self.ctx.author, self.opponent), xo)), 2)
self._current = None
self._runner = None
size = self.ctx._ttt_size
help_text = ('Type the column and the row in the format `column row` to make your move!\n'
'Or `quit` to stop the game (you will lose though).')
player_field = '\n'.join(itertools.starmap('{1} = **{0}**'.format, self.players))
self._game_screen = (discord.Embed(colour=0x00FF00)
.set_author(name=f'Tic-Tac-toe - {size} x {size}')
.add_field(name='Players', value=player_field)
.add_field(name='Current Player', value=None, inline=False)
.add_field(name='Instructions', value=help_text)
)
评论列表
文章目录