From 414f43ad7cf955c1ad62b2bc4b1ea2bc3298de79 Mon Sep 17 00:00:00 2001 From: Lautaro Dragan Date: Tue, 11 Aug 2020 00:56:14 -0300 Subject: [PATCH] [lib] fix: recursive reveal corners Fixes https://github.com/lautarodragan/minesweeper/issues/1 --- api/package-lock.json | 6 +++--- api/package.json | 2 +- lib/package-lock.json | 2 +- lib/package.json | 2 +- lib/src/reveal.ts | 8 ++++++-- web/package-lock.json | 6 +++--- web/package.json | 2 +- 7 files changed, 16 insertions(+), 12 deletions(-) diff --git a/api/package-lock.json b/api/package-lock.json index e47db98..7eb1d20 100644 --- a/api/package-lock.json +++ b/api/package-lock.json @@ -55,9 +55,9 @@ } }, "@taros-minesweeper/lib": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@taros-minesweeper/lib/-/lib-1.1.1.tgz", - "integrity": "sha512-o+DCrq0bfBcdCIZ9GICqYsYH+lj8eIqpSJHMi6qqwg7aKl/wdBYI7gOVtCNzID4M4poBkn1d4NWhDz0rUiw9Qg==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@taros-minesweeper/lib/-/lib-1.1.2.tgz", + "integrity": "sha512-xEceWhpjzmS0OU5sJhgO32cZMOCXAiTC0jX6E74j6rV6S3/Wo4wfFWgI113YDpV2p3jBzdwAe8e+U4ubltyUQw==" }, "@types/accepts": { "version": "1.3.5", diff --git a/api/package.json b/api/package.json index 94cc17e..ca17373 100644 --- a/api/package.json +++ b/api/package.json @@ -27,7 +27,7 @@ "@koa/cors": "3.1.0", "@koa/router": "9.3.1", "@taros-minesweeper/client": "1.0.0", - "@taros-minesweeper/lib": "1.1.1", + "@taros-minesweeper/lib": "1.1.2", "koa": "2.13.0", "koa-bodyparser": "4.3.0", "koa-jwt": "4.0.0", diff --git a/lib/package-lock.json b/lib/package-lock.json index 7877437..bddaf3f 100644 --- a/lib/package-lock.json +++ b/lib/package-lock.json @@ -1,6 +1,6 @@ { "name": "@taros-minesweeper/lib", - "version": "1.1.1", + "version": "1.1.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/lib/package.json b/lib/package.json index acb7a4e..0f5a6c6 100644 --- a/lib/package.json +++ b/lib/package.json @@ -1,6 +1,6 @@ { "name": "@taros-minesweeper/lib", - "version": "1.1.1", + "version": "1.1.2", "description": "", "main": "dist/index.js", "scripts": { diff --git a/lib/src/reveal.ts b/lib/src/reveal.ts index d2a3942..5407fe6 100644 --- a/lib/src/reveal.ts +++ b/lib/src/reveal.ts @@ -19,10 +19,14 @@ export const reveal = (board: Board, x: number, y: number): Board => { if (getSurroundingMineCount(board, x, y)) return + recursive(x, y - 1) + recursive(x + 1, y - 1) recursive(x + 1, y) - recursive(x - 1, y) + recursive(x + 1, y + 1) recursive(x, y + 1) - recursive(x, y - 1) + recursive(x - 1, y + 1) + recursive(x - 1, y) + recursive(x - 1, y - 1) } recursive(x, y) diff --git a/web/package-lock.json b/web/package-lock.json index 49fa27c..76deee5 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -1554,9 +1554,9 @@ } }, "@taros-minesweeper/lib": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@taros-minesweeper/lib/-/lib-1.1.1.tgz", - "integrity": "sha512-o+DCrq0bfBcdCIZ9GICqYsYH+lj8eIqpSJHMi6qqwg7aKl/wdBYI7gOVtCNzID4M4poBkn1d4NWhDz0rUiw9Qg==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@taros-minesweeper/lib/-/lib-1.1.2.tgz", + "integrity": "sha512-xEceWhpjzmS0OU5sJhgO32cZMOCXAiTC0jX6E74j6rV6S3/Wo4wfFWgI113YDpV2p3jBzdwAe8e+U4ubltyUQw==" }, "@testing-library/dom": { "version": "6.16.0", diff --git a/web/package.json b/web/package.json index 22e141e..632ba4b 100644 --- a/web/package.json +++ b/web/package.json @@ -5,7 +5,7 @@ "dependencies": { "@auth0/auth0-react": "1.0.0", "@taros-minesweeper/client": "1.0.1", - "@taros-minesweeper/lib": "1.1.1", + "@taros-minesweeper/lib": "1.1.2", "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.5.0", "@testing-library/user-event": "^7.2.1",