-
Notifications
You must be signed in to change notification settings - Fork 1
/
minesManager.py
36 lines (30 loc) · 1.03 KB
/
minesManager.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from minesMaker import generateMines
class MinesManager:
__levels = [
{'width': 9, 'height': 9, 'countOfMines': 10},
{'width': 15, 'height': 10, 'countOfMines': 30},
{'width': 20, 'height': 15, 'countOfMines': 50}
]
def __init__(self):
self.__width = 0
self.__height = 0
self.__countOfMines = 0
self.__level = 0
def __setLevel(self):
level = self.__level % len(self.__levels)
self.__width = self.__levels[level]['width']
self.__height = self.__levels[level]['height']
self.__countOfMines = self.__levels[level]['countOfMines']
self.__level += 1
def getMines(self):
self.__setLevel()
gameData = {
'columns': self.__width,
'rows': self.__height,
'countOfMines': self.__countOfMines,
'message': '',
'clickedX': -1,
'clickedY': -1,
'data': generateMines(self.__width, self.__height, self.__countOfMines)
}
return gameData