## Update:

The challenge above requires you to consider the mines as normal cell values. They do not have a static value of 1 as what this diagram might lead you to believe:

To make this clear, look at this other example:

My response below is based on what I initially understood - mines have a special value of 1 - so it is not valid for this challenge. But it does provide some some sort of a clue about how you could approach and/or solve this problem. So with some modifications, you could use the response below to solve this problem.

It seems that you *don’t* want to create a Minesweeper AI. From what I understood:

- You have been provided with a pre-arranged board with the mines spotted.
- The numbered cells are omitted.
- Your job is to fill the neighboring cells with the correct values.

I don’t know how to effectively replace Boolean values with an appropriate number

There are several ways to solve this problem. But you should consider the following:

- There is a
**special value** in the board output, the mine’s value; They should always be 1.
- The mine’s radius of effect is 1. Whatever inside this radius will have an
**incremented** value of n+1.

### Let’s visualize this a bit:

- Consider we have a given board of:

```
/*
[F, F, F]
[F, T, F]
[F, F, F]
*/
```

- Any true value will have a static value of 1 – Let’s assign that as “X” for now –

Anything else will have a base value of 0:

```
/*
[F, F, F] [0, 0, 0]
[F, T, F] => [0, X, 0]
[F, F, F] [0, 0, 0]
*/
```

- Each “X” (mine) has an AoE of 1. Therefore, if there is an “X” in the middle:

```
/*
[0, 0, 0] [1, 1, 1]
[0, X, 0] => [1, X, 1]
[0, 0, 0] [1, 1, 1]
+1 to all surrounding cells.
*/
```

- Now let’s turn that “X” into its own static value; 1:

```
/*
[1, 1, 1] [1, 1, 1]
[1, X, 1] => [1, 1, 1]
[1, 1, 1] [1, 1, 1]
*/
```

### Let’s try this algorithm on the board you provided:

- Step 1: Turn it into a usable board

```
/*
[T, F, F] [X, 0, 0]
[F, T, F] => [0, X, 0]
[F, F, F] [0, 0, 0]
*/
```

- Step 2: Working on mine(1,1)

```
/*
[X, 0, 0] [X, 1, 0]
[0, X, 0] => [1, X, 0]
[0, 0, 0] [0, 0, 0]
*/
```

- Step 3: Working on mine(2,2)

```
/*
[X, 1, 0] [X, 2, 1]
[1, X, 0] => [2, X, 1]
[0, 0, 0] [1, 1, 1]
*/
```

- Step 4: Turn the "X"s into 1s

```
/*
[X, 2, 1] [1, 2, 1]
[2, X, 1] => [2, 1, 1]
[1, 1, 1] [1, 1, 1]
*/
```

There you go, the output requested.

Following this approach for each mine, you should get your correct numbered cells after several loops or so.

Now, this is a thoughtless method to solve this problem. A good knowledge of matrices and linear algebra could possibly provide a better solution which I can’t figure out. More and over, keep in mind there are some hurdles you will encounter while writing your code in which I am leaving them for you to figure out.

**Tip:** .map() will help.

Goodluck.

Here is my solution while writing this response since you solved it…