Continuous integration Lines of Code Coverage Code Smells Bugs Duplicated Lines (%)

To set up the project, you need node installed.

To install dependencies, run the following:

npm install

To run the tests, there is a script in the project root called test. It calculates code coverage, incorporates watch mode, and prints in verbose mode, so all test file's test report will be visible. Alternatively, you can achieve the same with the command the script contains:

npm test -- --watchAll --collect-coverage --verbose

Instructions

Mine Sweeper - Game Rules:

You are presented with a board of squares. Some squares contain mines (bombs), others don't. If you step on a square containing a bomb, you lose. If you manage to clear all the squares (without clicking on any bombs) you win. Clearing a square which doesn't have a bomb reveals the number of neighbouring squares containing bombs. If you guess a square contains a bomb mark it with a flag. A squares "neighbours" are the squares adjacent above, below, left, right, and all 4 diagonals. Squares on the sides of the board or in a corner have fewer neighbors. The board does not wrap around the edges. If you clear a square with 0 neighboring bombs, all its neighbors will automatically open; recursively. The first square you open could be a bomb. You don't have to mark all the bombs to win; you just need to open all non-bomb squares.

Legend

âš  TODO
🚧 IN PROGRESS
✅ DONE

UAT Scenarios:

1 – Game Board Creation phase:

+-+-+-+ 
| | | | 
+-+-+-+ 
| | | | 
+-+-+-+ 
| | | | 
+-+-+-+ 

[Sandbox 3x3] Game created 

2 – Game Over - Step on a bomb on 1;1

+-+-+-+ 
| | | | 
+-+-+-+ 
| |X| | 
+-+-+-+ 
| | | | 
+-+-+-+ 
 
[Sandbox 3x3] BOOM! – Game Over. 

3 – Clean square 0;0 and get the number of bombs around

+-+-+-+ 
| | | | 
+-+-+-+ 
| | | | 
+-+-+-+ 
|3| | | 
+-+-+-+ 
 
[Sandbox 3x3] 3 bombs around your square. 

4 – Mark the bombs around – What I expect after I marked the 3 squares as bombs [1;0 + 1;1 + 0;1].

+-+-+-+ 
| | | | 
+-+-+-+ 
|*|*| | 
+-+-+-+ 
|3|*| | 
+-+-+-+ 
 
[Sandbox 3x3] Square flagged as bomb. 

5 – Game Victory – After I cleared the all the squares [2;0 + 2;1 + 2;2 + 1;2 + 1;2]

+-+-+-+ 
|2|2|1| 
+-+-+-+ 
|*|*|2| 
+-+-+-+ 
|3|*|2| 
+-+-+-+ 
 
[Sandbox 3x3] the land is cleared! GOOD JOB! 

6 – Massive cleaning and victory clicking on 0;0

+-+-+-+ 
|_|1| | 
+-+-+-+ 
|_|1|1| 
+-+-+-+ 
|_|_|_| 
+-+-+-+ 
 
[Sandbox 3x3] the land is cleared! GOOD JOB! 

User Story #1 ✅

As a player I start the game I want to see the empty board So that I can start to play the game...

Scenario #1

GIVEN nothing WHEN drawing the board THEN I will see the new empty board

User Story #2 ✅

As a player I step on a bomb I want to see BOOM! – Game Over So that I know I did a wrong movement

Scenario #1

GIVEN step to position 1;1 WHEN drawing the board THEN I will see an X in 1;1 on the board and the message BOOM! – Game Over

Scenario #2

GIVEN step to position 0;2 WHEN drawing the board THEN I will see an X in 0;2 on the board and the message BOOM! – Game Over

Scenario #3

GIVEN step to position 2;0 WHEN drawing the board THEN I will see an X in 2;0 on the board and the message BOOM! – Game Over

User Story #3 ✅

As a player I step on a clean position I want to see the number of bombs around So that I can plan my next step

Scenario #1

GIVEN step to position 1;1 WHEN drawing the board THEN I will see an 3 in 1;1 on the board and the message 3 bombs around your square.

Scenario #2

GIVEN step to position 0;2 WHEN drawing the board THEN I will see an 2 in 0;2 on the board and the message 2 bombs around your square.

Scenario #3

GIVEN step to position 2;0 WHEN drawing the board THEN I will see an 1 in 2;0 on the board and the message 1 bombs around your square.

User Story #4 ✅

As a player I want to mark the bombs expected So that I can think on the next cleaning step

Scenario #1

GIVEN a positon [1;0] to mark WHEN drawing the board THEN I will see 1;0 is marked on the board and the message Square flagged as bomb.

Scenario #2

GIVEN two positons [1;0 + 1;1] to mark WHEN drawing the board THEN I will see 1;0 and 1;1 are marked on the board and the message Square flagged as bomb.

Scenario #3

GIVEN a positon [1;0 + 1;1 + 0;1] to mark WHEN drawing the board THEN I will see an 1;0 and 1;1 and 0;1 are marked on the board and the message Square flagged as bomb.

User Story #5 ✅

As a player I want to mark all the bombs expected So that I can win the game

Scenario #1

GIVEN all the squares [2;0 + 2;1 + 2;2 + 1;2 + 1;2] to mark WHEN drawing the board THEN I will see all the markings on the board and the message the land is cleared! GOOD JOB!

User Story #6 ✅

As a player I want win automatically if the massive cleaning function clear the board So that I can win the game

Scenario #1

GIVEN bomb on [0,2] then click on [0,0] WHEN drawing the board THEN I will see all squares cleared and the message the land is cleared! GOOD JOB!