# Gridmancer Redux - Please help! (SOLVED)

**URL:** <https://discourse.codecombat.com/t/gridmancer-redux-please-help-solved/20369>\
**Category:** Level Help\
**Created:** [February 24, 2020, 11:06pm UTC](https://discourse.codecombat.com/t/gridmancer-redux-please-help-solved/20369 "2020-02-24T23:06:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![akodis](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@akodis](https://discourse.codecombat.com/u/akodis)\
**Post date:** [February 24, 2020, 11:06pm UTC](https://discourse.codecombat.com/t/gridmancer-redux-please-help-solved/20369/1 "2020-02-24T23:06:07Z")

</div>

![Screenshot 2020-02-24 at 4.58.15 PM](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/c/c9f23a555b91f7b9d4011a7e23f6b85b7c264a99.jpeg)

I am having this problem where I can’t beat the level because it keeps saying “don’t hand-place the rectangles”. But I am not hand-placing them(I think), I have them encoded in a formula. I have tried many different approaches to this, could somebody help me by telling me what I am doing wrong, or explaining exactly what “hand-placing” is?

---

<div class="post-metadata">

**Author:** ![akodis](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@akodis](https://discourse.codecombat.com/u/akodis)\
**Post date:** [February 24, 2020, 11:07pm UTC](https://discourse.codecombat.com/t/gridmancer-redux-please-help-solved/20369/2 "2020-02-24T23:07:07Z")

</div>

Here’s my code if you need it:

```python
// hero.addRect(x, y, width, height) places a rectangle to collect coins
// hero.removeRectAt(x, y) removes a previously added rectangle at the point.
// hero.navGrid is (basically) a 2-dimensional array containing "Coin" or "Wall"
var map = hero.navGrid;
function addRects(row) {
    var y = row;
    var pass = 0;
    for (var col in map[row]) {
        var pos = map[col][row];
        if (pos=="Coin"&&pass===0) {
            var x = col;
            var w = 1;
            pass = 1;
        } else if (pos=="Coin") {
            w++;
        } else if (pos=="Wall"&&pass>0) {
            hero.addRect(x,y,w,1);
            pass = 0;
        }
    }
    if (w==20) {
        hero.addRect(x,y,20,1);
    }
}
hero.wait(1);
for (var i = 0; i < 21; i++) {
    addRects(i);
}

```

---

<div class="post-metadata">

**Author:** ![akodis](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@akodis](https://discourse.codecombat.com/u/akodis)\
**Post date:** [February 25, 2020, 10:58pm UTC](https://discourse.codecombat.com/t/gridmancer-redux-please-help-solved/20369/3 "2020-02-25T22:58:01Z")

</div>

Nevermind, I figured it out.
