aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar scragly <[email protected]>2019-08-23 17:30:39 +1000
committerGravatar GitHub <[email protected]>2019-08-23 17:30:39 +1000
commit8cbf326758d338cfef3921bc9ffd7fc616196398 (patch)
tree73aba94a8445ced2855521b5c5cf02ec6d5b3be1
parentRecommendGame pull request #258 from jakeHebert/master (diff)
parentfixed import order. (diff)
[Minesweeper] making sure there is always a non-bomb cell. (#263)
[Minesweeper] making sure there is always a non-bomb cell.
-rw-r--r--bot/seasons/evergreen/minesweeper.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/bot/seasons/evergreen/minesweeper.py b/bot/seasons/evergreen/minesweeper.py
index c99cefba..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
@@ -99,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":