[Adventurer] Fence Builder

The level Fence Builder is ready for testing.

It’s Mountain level from Geometry series. Do you know how to build a fence?

1 Like

completed level without issue

submitted LUA patch

Thanks, Harry!

20characters

what is the code for fence builder

We don’t post solutions here.

really we don’t post them then how am i supposed to do my codecombat i am about to finish the game i am in the ??? world

I’m not sure that I understood you. I suppose you forgot some punctuation marks.

You can read instructions and solve this level. Also, you can ask advice (not a solution). It’s possible to complete games without cheat codes and walkthroughs :slight_smile:

OK Bryukh i will try

I’m stuck on this level. This is the code that got me the farthest:

# Build a fence around the farm.

# Take coordinates of the opposite corners.
customer = hero.findNearest(hero.findFriends())
x1 = customer.leftBottom.x
y1 = customer.leftBottom.y
x2 = customer.rightTop.x
y2 = customer.rightTop.y
step = 4

# Let's build the bottom side.
for x in range(x1 + step, x2 + 1, step):
    hero.buildXY("fence", x, y1)
# Then the right side.
for y in range(y1 + step, y2 + 1, step):
    hero.buildXY("fence", x2, y)
# Build the top side.
for x in range(x1 + step, x2 -1, step):
    hero.buildXY("fence", x, y2)
# Build the left side.
for y in range(y1 + step, y2 - 1, step):
    hero.buildXY("fence", x1, y)

With this code my player builds the whole fence except for the top and bottom left corners.

Can someone tell me what I’m doing wrong?

1 Like

@Hellenar I got one fence further:

fence_builder

The third fence needs a negative step. I think the fourth does too, because my hero is starting it from the bottom, but when I put that in, she doesn’t build the fourth wall at all.

I’m not really wrapping my head around the logic of the level, but, alas, I seem able to hack away at it until I guess the right answer.

1 Like

maybe u can use move xy but my hero is not moving

Is there a way to make a hero not get stuck between fences? I just tried, and I suppose it was a bad seed.

1 Like

i couldn’t get far:

# Build a fence around the farm.

# Take coordinates of the opposite corners.
customer = hero.findNearest(hero.findFriends())
x1 = customer.leftBottom.x
y1 = customer.leftBottom.y
x2 = customer.rightTop.x
y2 = customer.rightTop.y
step = 4

# Let's build the left side.
for y in range(y2 - step, y1 - 1, -step):
    hero.buildXY("fence", x1, y)
# Build the bottom side.
for x in range(x1 + step, x2 + 1, step):
    hero.buildXY("fence", x, y1)
# Then the right side.
for x in range(x2, - step, x1 + 1, step):
    hero.buildXY("fence", x, y1)
for y in range(y1 + step, y2 - 1, step):
    hero.buildXY("fence", x1, y)

pls help, sorry if i disturbed you.

Please don’t post the same post in different topics, it just clutters up the Discourse, please stick to your previous post about Fence Builder help
Lydia