diff options
| author | Aiden Woodruff <aiden.woodruff@gmail.com> | 2018-05-22 10:52:54 -0500 |
|---|---|---|
| committer | Aiden Woodruff <aiden.woodruff@gmail.com> | 2018-05-22 10:52:54 -0500 |
| commit | a172b2d15e24079d6b998220d154ec70ddf96d8f (patch) | |
| tree | 58d3fb7d768af16e70682db5641bab5e3ff2b12b | |
| parent | 7f5c0f58a7305302f5593399fc841344169bd468 (diff) | |
| download | sweeper-a172b2d15e24079d6b998220d154ec70ddf96d8f.tar.gz sweeper-a172b2d15e24079d6b998220d154ec70ddf96d8f.tar.bz2 sweeper-a172b2d15e24079d6b998220d154ec70ddf96d8f.zip | |
Fixed issue with mines equaling total number of tiles
Changed gt test to ge test
Signed-off-by: Aiden Woodruff <aiden.woodruff@gmail.com>
| -rw-r--r-- | sweeper.js | 2 |
1 files changed, 1 insertions, 1 deletions
| @@ -347,7 +347,7 @@ if (!dimensions["height"] || dimensions["height"] < 1) { | |||
| 347 | } else { | 347 | } else { |
| 348 | height = parseInt(dimensions["height"], 10); | 348 | height = parseInt(dimensions["height"], 10); |
| 349 | } | 349 | } |
| 350 | if (!dimensions["mines"] || parseInt(dimensions["mines"], 10) > (width * height)) { | 350 | if (!dimensions["mines"] || parseInt(dimensions["mines"], 10) >= (width * height)) { |
| 351 | total_mines = Math.floor(Math.sqrt(width * height)); | 351 | total_mines = Math.floor(Math.sqrt(width * height)); |
| 352 | total_mines = Math.floor((Math.random() * Math.floor(Math.sqrt(width*height))) + Math.floor(Math.sqrt(width*height))); | 352 | total_mines = Math.floor((Math.random() * Math.floor(Math.sqrt(width*height))) + Math.floor(Math.sqrt(width*height))); |
| 353 | } else { | 353 | } else { |
