diff options
author | 2019-08-23 17:30:39 +1000 | |
---|---|---|
committer | 2019-08-23 17:30:39 +1000 | |
commit | 8cbf326758d338cfef3921bc9ffd7fc616196398 (patch) | |
tree | 73aba94a8445ced2855521b5c5cf02ec6d5b3be1 | |
parent | RecommendGame pull request #258 from jakeHebert/master (diff) | |
parent | fixed 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.py | 6 |
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": |