nmaguirre / minesweeper

A Simple MineSweeper Project
6 stars 4 forks source link

Add addRandomMines(int) method to MinesweeperBoard #108

Open saiema opened 8 years ago

saiema commented 8 years ago

Implement method addRandomMines(int) in MinesweeperBoard that takes a integer value that represents how many mines to add to the board, and adds them in random coordinates.

The method should check that the value is valid 0<=mines<=#(unblocked, not mined, and closed cells) and throw an IllegalArgumentException otherwise.

martinlopez commented 8 years ago

solved https://github.com/nmaguirre/minesweeper/commit/2e8201178962022a8e6653e8ec0e581ff098eba3

jheredia commented 8 years ago

@martinlopez this method sets the mines but doesn't increase the value of boardMines, this means that the amount of mines in the board is not equal to boardMines and this causes some tests to fail. Please fix this.

jheredia commented 8 years ago

Also, according to the specification given by @saiema this method should allow the 0 and n arguments, right now this is throwing a IllegalArgumentException.

The tests created in this commit: 8038bc3 referenced by this issue: #124 should be modified accordingly to pass when the amount of mines is either 0 or n.

saiema commented 8 years ago

Please hurry up solving this issue!

jheredia commented 8 years ago

Fixed in f56e25ed2dbf0df622582559b4ce7c0055b79824

jheredia commented 8 years ago

Fixed the accepted range of the amount of mines in 6dd3880e95010b01f74960518d422ee2298e58db

The tests created in this commit: 8038bc3 referenced by this issue: #124 should be modified accordingly to pass when the amount of mines is either 0 or n.