-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplanning.txt
54 lines (47 loc) · 1.74 KB
/
planning.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
Planning
Generate Bomb locations
Generate grid
Empty or bomb
Click
Bomb = Game over
Empty = square change colour
Planning extra feature - how many bombs nearby
Need:
1) way to look up cell number and what's in the cell
2) count the number of bombs surrounding clicked cell
3) display the number on clicked cell
1) way to look up cell number and what's in the cell
Adding object of whats inside each cell
2) count the number of bombs surrounding clicked cell
When cell clicked, looks up bomb object to count number of bombs nearby.
Scenarios - cell clicked is:
middle
edge
corner
Current flow:
Start of game:
game board made,
each cell has event listener
each cell has unique ID (0-99)
click cell
checks whether cell contains bomb
- if yes -> game over: losing screen
- if no
checks bombs in all nearby cells.
returns a number representing number of nearby bombs
checks if current score = max score. If yes, game over: winning screen
adds square to cells clicked array
Want to add: feature/ if cell has no bombs nearby, all nearby cells are automatically clicked
Need:
- separate CSS class to differentiate manually clicked and automatically clicked cell
- function to check if nearby cells have been clicked already
if yes -> nothing
if no -> "click it"
Current functions:
- handleClick
- this defines variables id and cell
- checks if bomb space contains bomb
- if yes -> end game
- if no -> passes to EmptyCellClicked and updates Score, removes eventlistener
- handleEmptyCellClicked
-