connectfour.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:Chiaki-Nanami 作者: Ikusaba-san 项目源码 文件源码
def __init__(self, ctx, opponent):
        self.ctx = ctx
        self.board = Board()
        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

        player_field = '\n'.join(itertools.starmap('{1} = **{0}**'.format, self.players))
        instructions = ('Type the number of the column to play!\n'
                        'Or `quit` to stop the game (you will lose though).')
        self._game_screen = (discord.Embed(colour=0x00FF00)
                            .set_author(name=f'Connect 4 - {self.ctx.author} vs {self.opponent}')
                            .add_field(name='Players', value=player_field)
                            .add_field(name='Current Player', value=None, inline=False)
                            .add_field(name='Instructions', value=instructions)
                            )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号