-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMinesweeper Architecture.txt
84 lines (73 loc) · 2.56 KB
/
Minesweeper Architecture.txt
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Minesweeper architechture
Grid class # IMPLEMENTATION DONE!
!Has two 2dimension tuples:
!`` One is just True/False mines
! Other is list ints -1=mine, 0-8=neighbors
!Init: takes in list of mines as shown above
! Then runs sanity check + reindex on it
!Has mine count, dimensions, etc
!All sanity checking happens in grid
!NOHas calls to chnage mine position
!NO will update neighbors, minecount
! RETURN NEW GRID
! GRID IS IMMUTABLE
! to do that internal tuple is hidden,
! Get with @property, .setter undefined
!Cannot change dimensions bc immutable
!NO#Save to file/text function (Pickle, xml,
!NO #etc) for multiple games
! NoNoNo. Has function to get mine list
! just return mines list
! No processing needed, is min to
! make new grid
! Does not return neighbors grid
! New grid is made from minelist
!Does not store visibility info
!NOHas function to reindex mines, mine count, neighbors, sanity check
There is a function outside of any class that takes in dinensions and mine count and returns True, False if is reasonable.
Such as: check that x, y size is above a
harcoded min
At least 1 mine, at most (x*y)-1
Used by generators for param sanity
check
Various grid generators/loaders/savers
RandomGridGenerator class:
!Takes dimensions, # of mines
! Take random generator or seed?
! Predictability
!Can generate infinite Grids based on initial
! params
!Cannot change params after init
Can save seed/rng and state to file/text # How?
!Two ways to generate rng:
!THIS 1 item /pos, pick x items
!NO! Gen random x, y, mark mine. If already
!NO! mine, try again
Game takes grid and player as param
#Timer?
Runs sanity check on grid
Abort if error
Make grid
Player abstract class
Has functions to ask for command
Flag, remove flag, mine
Each function pass in grid
Grid with visibility mask
After each move, update mask in Game
Initialize with dimensions
CmdPlayer subclass of player
Runs above of helper.get_text get_number
Each tick: print time, ask for command
Get x, y coor
Use gettext so can get x, y coor
On same question
Human ui
And can cancel
Might make tkinter interface
Grid of small butons, color change
Aiplayer interface. Idk how
Player class return Command instance
Command class
Just a thing that has property
IsOpen, IsFlag, and x, y
Error checking, immutable, really simple