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
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.
âš TODO
🚧 IN PROGRESS
✅ DONE
+-+-+-+
| | | |
+-+-+-+
| | | |
+-+-+-+
| | | |
+-+-+-+
[Sandbox 3x3] Game created
+-+-+-+
| | | |
+-+-+-+
| |X| |
+-+-+-+
| | | |
+-+-+-+
[Sandbox 3x3] BOOM! – Game Over.
+-+-+-+
| | | |
+-+-+-+
| | | |
+-+-+-+
|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.
+-+-+-+
|2|2|1|
+-+-+-+
|*|*|2|
+-+-+-+
|3|*|2|
+-+-+-+
[Sandbox 3x3] the land is cleared! GOOD JOB!
+-+-+-+
|_|1| |
+-+-+-+
|_|1|1|
+-+-+-+
|_|_|_|
+-+-+-+
[Sandbox 3x3] the land is cleared! GOOD JOB!
As a player I start the game I want to see the empty board So that I can start to play the game...
GIVEN nothing WHEN drawing the board THEN I will see the new empty board
As a player I step on a bomb I want to see BOOM! – Game Over So that I know I did a wrong movement
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
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
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
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
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.
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.
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.
As a player I want to mark the bombs expected So that I can think on the next cleaning step
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.
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.
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.
As a player I want to mark all the bombs expected So that I can win the game
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!
As a player I want win automatically if the massive cleaning function clear the board So that I can win the game
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!