aboutsummaryrefslogtreecommitdiffstats
path: root/bot/seasons/evergreen/minesweeper.py
diff options
context:
space:
mode:
Diffstat (limited to 'bot/seasons/evergreen/minesweeper.py')
-rw-r--r--bot/seasons/evergreen/minesweeper.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/bot/seasons/evergreen/minesweeper.py b/bot/seasons/evergreen/minesweeper.py
index 9f6aff95..f6fa9c47 100644
--- a/bot/seasons/evergreen/minesweeper.py
+++ b/bot/seasons/evergreen/minesweeper.py
@@ -1,7 +1,7 @@
import logging
import typing
from dataclasses import dataclass
-from random import random
+from random import randint, random
import discord
from discord.ext import commands
@@ -22,7 +22,7 @@ MESSAGE_MAPPING = {
10: ":keycap_ten:",
"bomb": ":bomb:",
"hidden": ":grey_question:",
- "flag": ":pyflag:"
+ "flag": ":flag_black:"
}
log = logging.getLogger(__name__)
@@ -36,7 +36,13 @@ class CoordinateConverter(commands.Converter):
if not 2 <= len(coordinate) <= 3:
raise commands.BadArgument('Invalid co-ordinate provided')
- digit, letter = sorted(coordinate.lower())
+ coordinate = coordinate.lower()
+ if coordinate[0].isalpha():
+ digit = coordinate[1:]
+ letter = coordinate[0]
+ else:
+ digit = coordinate[:-1]
+ letter = coordinate[-1]
if not digit.isdigit():
raise commands.BadArgument
@@ -93,6 +99,10 @@ class Minesweeper(commands.Cog):
for _ in range(10)
] for _ in range(10)
]
+
+ # make sure there is always a free cell
+ board[randint(0, 9)][randint(0, 9)] = "number"
+
for y, row in enumerate(board):
for x, cell in enumerate(row):
if cell == "number":