aboutsummaryrefslogtreecommitdiffstats
path: root/bot
diff options
context:
space:
mode:
authorGravatar vivax3794 <[email protected]>2019-08-10 14:34:22 +0200
committerGravatar vivax3794 <[email protected]>2019-08-10 14:34:22 +0200
commitdeda7968e2509d2ccdad35674d98144deaa88b86 (patch)
treeca4cc04f9d3aeed71277fd68f0a205d8b6bb4257 /bot
parentchanged .flag and .reveal to be abel to run multiple cords at once (diff)
fixed a small bug
Diffstat (limited to 'bot')
-rw-r--r--bot/seasons/evergreen/minesweeper.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/bot/seasons/evergreen/minesweeper.py b/bot/seasons/evergreen/minesweeper.py
index ac1b287b..b1d27735 100644
--- a/bot/seasons/evergreen/minesweeper.py
+++ b/bot/seasons/evergreen/minesweeper.py
@@ -84,7 +84,8 @@ class Minesweeper(commands.Cog):
await ctx.send(f"{ctx.author.mention} is playing minesweeper")
chat_msg = await ctx.send(self.format_for_discord(reveled_board))
- await ctx.author.send("play by typing: `.reveal xy xy ...` or `.flag xy xy ...` \nclose the game with `.end`")
+ await ctx.author.send("play by typing: `.reveal xy xy ...` or `.flag xy xy ...` \nclose the game with `.end`\n"
+ "cords must be in format `<letter><number>")
dm_msg = await ctx.author.send(self.format_for_discord(reveled_board))
self.games[ctx.author] = {
@@ -97,10 +98,7 @@ class Minesweeper(commands.Cog):
@staticmethod
def get_cords(value1: str, value2: str) -> typing.Tuple[int, int]:
"""Take in 2 values for the cords and turn them into numbers"""
- if value1.isnumeric():
- return ord(value2.lower()) - 97, int(value1) - 1
- else:
- return ord(value1.lower()) - 97, int(value2) - 1
+ return ord(value1.lower()) - 97, int(value2) - 1
async def reload_board(self, ctx: commands.Context) -> None:
"""Update both playing boards."""
@@ -115,7 +113,7 @@ class Minesweeper(commands.Cog):
"""Place multiple flags on the board"""
board = self.games[ctx.author]["reveled"]
for cord in cords:
- x, y = self.get_cords(cord[0], cord[1])
+ x, y = self.get_cords(cord[0], cord[1:])
if board[y][x] == "hidden":
board[y][x] = "flag"
@@ -178,7 +176,7 @@ class Minesweeper(commands.Cog):
reveled = game["reveled"]
board = game["board"]
for cord in cords:
- x, y = self.get_cords(cord[0], cord[1])
+ x, y = self.get_cords(cord[0], cord[1:])
await self.reveal_one(ctx, reveled, board, x, y)
@commands.dm_only()