```
# Senick's prepared the grid map how to build fences.
hunter = hero.findNearest(hero.findFriends())
fenceMap = hunter.getMap()
# This function converts grid into XY coordinates.
def convertCoor(row, col):
return {'x': 34 + col * 4, 'y': 26 + row * 4}
# Iterate over fenceMap and build at fence at all 1s.
for i in fenceMap:
for j in fenceMap:
if i == 1:
if j == 1:
site = convertCoor(i, j)
hero.buildXY('fence', site.x, site.y)
# Move back to the village after building the fences.
hero.moveXY(26, 17)
```

Just looking for some help here: basically nothing is happening at the moment!

1 Like

Is there anything else that you can tell us that would be helpful? Are there any errors? Have you completed any objectives? A screenshot would be helpful.

No errors come up. Nothing happens.

There is more than one problem here.

One of them is this:

```
for i in fenceMap: #this should be:
for i in range(len(fenceMap)):
#the same for: for j in fenceMap:
```

The other one is to do with this section:

```
if i == 1:
if j == 1:
site = convertCoor(i, j)
hero.buildXY('fence', site.x, site.y)
```

Iâ€™m not going to tell you what that bit is, or I might as well give you the answer.

I recommend reading the Hints carefully (especially the second page) and going back to other levels in this map series.

*Iâ€™ll* also give you a big Hint, if youâ€™re stuck (try first, then look at the Hint)

##
Hint

You only need one if statement, and this part is right. Donâ€™t change it!:

```
site = convertCoor(i, j)
hero.buildXY('fence', site.x, site.y)
```

1 Like

```
for i in range(len(fenceMap)):
#the same for: for j in fenceMap:
```

This advice will work in this particular case because the 2D array has the same number of rows and columns, but otherwise it will fail. We have in this level. 8X8 array filled only with 0 and 1. See the visualisation. You can replace arr with arr1 to see how the code works with an *â€śirregular arrayâ€ť*.

Edit: @mratranslate : you have similar structure in Power points stuck and you did it right then

1 Like

Conceptually, I like to think of the game battleship. Identify the grid and the X, Y coordinates to get the exact location. If that location `grid[X][Y] == 1`

, (using the battleship analogy, â€śHITâ€ť).

2 Likes