diff options
author | 2019-08-13 04:58:22 +0200 | |
---|---|---|
committer | 2019-08-13 04:58:22 +0200 | |
commit | 5bfbd5a07896736a03a5e07625acfa6f6b47a073 (patch) | |
tree | 692e7f42e12b758cf8784b84d3e43fa3429467f8 /bot/seasons/evergreen/minesweeper.py | |
parent | fixed commit issue. (diff) |
Apply suggestions from code review
Co-Authored-By: Mark <[email protected]>
Diffstat (limited to 'bot/seasons/evergreen/minesweeper.py')
-rw-r--r-- | bot/seasons/evergreen/minesweeper.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/bot/seasons/evergreen/minesweeper.py b/bot/seasons/evergreen/minesweeper.py index 60e0c2ae..9ca36d57 100644 --- a/bot/seasons/evergreen/minesweeper.py +++ b/bot/seasons/evergreen/minesweeper.py @@ -126,8 +126,8 @@ class Minesweeper(commands.Cog): await ctx.author.send( f"Play by typing: `{Client.prefix}reveal xy [xy]` or `{Client.prefix}flag xy [xy]` \n" - "Close the game with `.end`\n" - "Coordinates must be in format `<letter><number>`" + f"Close the game with `{Client.prefix}end`\n" + "Coordinates must be in the format `<letter><number>`" ) dm_msg = await ctx.author.send(self.format_for_discord(revealed_board)) @@ -160,15 +160,15 @@ class Minesweeper(commands.Cog): """The player lost the game""" game = self.games[ctx.author.id] game.revealed = game.board - await ctx.author.send(":fire: You lost! :fire: ") - await game.chat_msg.channel.send(f":fire: {ctx.author.mention} just lost minesweeper :fire:") + await ctx.author.send(":fire: You lost! :fire:") + await game.chat_msg.channel.send(f":fire: {ctx.author.mention} just lost Minesweeper! :fire:") async def won(self, ctx: commands.Context) -> None: """The player won the game""" game = self.games[ctx.author.id] game.revealed = game.board - await ctx.author.send(":tada: You won! :tada: ") - await game.chat_msg.channel.send(f":tada: {ctx.author.mention} just won minesweeper :tada:") + await ctx.author.send(":tada: You won! :tada:") + await game.chat_msg.channel.send(f":tada: {ctx.author.mention} just won Minesweeper! :tada:") def reveal_zeros(self, revealed: GameDict, board: GameDict, x: int, y: int) -> None: """Recursively reveal adjacent cells when a 0 cell is encountered.""" @@ -183,7 +183,7 @@ class Minesweeper(commands.Cog): """Checks if a player has won""" for x in range(10): for y in range(10): - if revealed[y][x] == "hidden" and board[y][x] != "bomb": + if revealed[y][x] == "hidden": return False else: await self.won(ctx) @@ -222,12 +222,12 @@ class Minesweeper(commands.Cog): game = self.games[ctx.author.id] game.revealed = game.board await self.update_boards(ctx) - await ctx.author.send(":no_entry: you canceled the game :no_entry:") - await game.chat_msg.channel.send(f"{ctx.author.mention} just canceled minesweeper") + await ctx.author.send(":no_entry: You canceled the game. :no_entry:") + await game.chat_msg.channel.send(f"{ctx.author.mention} just canceled Minesweeper.") del self.games[ctx.author.id] def setup(bot: commands.Bot) -> None: """Load the Minesweeper cog.""" bot.add_cog(Minesweeper(bot)) - log.info("minesweeper cog loaded") + log.info("Minesweeper cog loaded") |