# PolygonCeption - Need Help

Hi, I haven’t posted in a while, so this might be a bit shabby and vague.
I need help on this level in the Glacier. I have just started and I don’t really know how to move on from this point. Here is a screenshot with my code:

Can you please post your code? It’s kind of hard to read with a screen shot. Just press the “</>” button and paste your code in the triple black tick marks -------------> ‘’'

Wait, what language is this?

python (20 characters)

Can’t really help you on that, I have also some trouble understanding vector

shoot
can anyone actually help me with my problem?
Also, Rebecca, those aren’t back ticks. I have been on this forum much longer than you have and I know how to do it. Just saying, if you click on the image you can magnify it.

For anyone that is trying to help me, my problem is that it thinks sides is an object.

can you repost your code in raw using </>

remember that a vector is a direction from 0, 0.
if you say yak.pos is a vector. and yak position is 40x 70y.
then the vector is a direction of +40x and +70y

if you say that hero.pos is a vector and hero position is 60x and 60y
then the vector is a direction of +60x and +60y.

to know the amount of X and Y the hero must move to reach the yak.position.
then you need to substract the vector yak.position - with the vector hero.position.
the result is - 20x and +10y.

So if your hero move of -20x and 10y. he should reach the yak position.

Oh. Sorry for, um, assuming things. I seriously can’t read code from screenshots though. It’s too small and I’m kind of nearsighted.

I’m nearsighted to, but I’ll type down the code

``````def  degreesToRadians(degrees):
degrees * Math.PI / 180

def polygonMaker(start, end, sides):
full = Vector(start, end)

startOffset = Vector(-15,-15)
endOffset = Vector(15, -15)
yaks = hero.findByType("ice-yak")
for yak in yaks:
sides = yak.sides

polygonMaker(start, end, 6)
``````

I also accidentally deleted it twice, so it was really, really hard.

The last time I checked, there is no line of code called `something.sides`, but I could be wrong.

Edit: I have some new code to show. I think this will work except for the original error. Here it is

``````# You are on your own this time, I hope you have learned what you need from the previous fractal levels. Check the guide for help with what you need to do and with the math required for polygons.

# You need a function to convert degrees to radians.  Multiply degrees by Math.PI / 180.
degrees * Math.PI / 180
# Your polygon function should have 3 inputs: start, end, and sides.
def polygonMaker(start, end, sides):
# Remember to make your polygon recursive, drawing extra polygons at every corner.
heroShouldStartHere = Vector.subtract(yak.pos, hero.pos)
full = Vector(start, end)
for side in sides:
i = 0
while i < len(sides):
i += 1
i = 0
break

# To get the start and end position for each polygon, add startOffset and endOffset to the yak's position.
startOffset = Vector(-15, -15)
endOffset = Vector(15, -15)
yaks = hero.findByType("ice-yak")
for yak in yaks:
sides = yak.sides # You need to loop through all the yaks, drawing a polygon for each.  Yaks are enemies.
polygonMaker(start, end, sides)

``````

oh. sorry (20 chars)

I know this is an old topic, and I shouldn’t revive it, but I am still stuck on this level. This is my code:

``````# You are on your own this time, I hope you have learned what you need from the previous fractal levels. Check the guide for help with what you need to do and with the math required for polygons.

# You need a function to convert degrees to radians.  Multiply degrees by Math.PI / 180.
degrees * Math.PI / 180
# Your polygon function should have 3 inputs: start, end, and sides.
def polygonMaker(start, end, sides):
# Remember to make your polygon recursive, drawing extra polygons at every corner.
heroShouldStartHere = Vector.subtract(yak.pos, hero.pos)
full = Vector(end, start)
for side in sides:
i = 0
while i < len(sides):
i += 1
i = 0
break

# To get the start and end position for each polygon, add startOffset and endOffset to the yak's position.
startOffset = Vector(-15, -15)
endOffset = Vector(15, -15)
enemies = hero.findEnemies()
yaks = hero.findByType("ice-yak", enemies)
for yak in yaks:
sides = yak.sides # You need to loop through all the yaks, drawing a polygon for each. Yaks are enemies.
polygonMaker(start, end, sides)

``````

@Archion Why did you say this topic was solved?
Oh, and just wondering, Neel Sharma, are you an ambassador like Munkey Shynes? Like it says on your profile.?

Somewhat
I used to be very active a year or two back, so I helped a lot of people out.

I remember you. It’s been a while. Welcome back!

Thanks, but seriously, I need help with this.

hi again. seven months now.

Oh, sorry, I was thinking an official ambassador like Munkey Shynes.

Oops it was probably an error. Sorry everyone

Now I am trying a different approach. Instead of attacking anything, why don’t I just have my people barrel through the enemies so that most of my people live. But it isn’t working, and I don’t think it is my fault. Here is my code:

``````# You can find friends through walls, but not enemies.
# Watch out for smooth, frictionless ice patches!
hero.moveXY(68, 16)
while True:
friends = hero.findFriends()
enemy1 = hero.findNearestEnemy()
enemyMissile = hero.findNearest(hero.findEnemyMissiles())
for friend in friends:
if friend:
target = {"x": 78, "y": 4}
hero.command(friend, "move", target)
if enemyMissile and hero.distanceTo(enemyMissile) < 5: