# Fractalization level help

**URL:** <https://discourse.codecombat.com/t/fractalization-level-help/34994>\
**Category:** Level Help\
**Created:** [February 25, 2023, 3:59pm UTC](https://discourse.codecombat.com/t/fractalization-level-help/34994 "2023-02-25T15:59:50Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheCodingCrusader22](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thecodingcrusader22/32/46084_2.png) [@TheCodingCrusader22](https://discourse.codecombat.com/u/TheCodingCrusader22)\
**Post date:** [February 25, 2023, 3:59pm UTC](https://discourse.codecombat.com/t/fractalization-level-help/34994/1 "2023-02-25T15:59:50Z")

</div>

my code:

```python
# Check the guide for the description of the problem
# Here are some functions to help draw the curves.

def degreesToRadians(degrees):
    # All vector operations require working in radians rather than degrees.
    return Math.PI / 180 * degrees
    
def koch(start, end):
    # This function will draw a Koch Curve between two Vector positions
    # Start by creating a vector from start to end using Vector.subtract.
    # full = ...
    full = Vector.subtract(start,end)
    
    # Use the magnitude of the vector to check for the stop condition.
    if 
        # Move into position and draw the line, don't forget to toggle flowers properly.
        
        return
    
    # Need to draw 4 shorter Koch curves with sides 1/3 the length.
    # We will calculate the 3 intermediate points, A, B, & C.
    # We just need the point that is one-third of the full Vector from the start Vector.
    third = Vector.multiply(full, 1 / 3)
    A = Vector.add(start, third)
    # This one needs to be rotated 60 degrees from A but the same length. Use rotate and add to get B.
    
    # This point works out to adding another third to A.
    
    # Now we can draw the 4 curves connecting start, A, B, C, and end.
    
whiteXs = [Vector(6, 6), Vector(74, 6), Vector(74, 61), Vector(6, 61)]

```

i do not understand what the first if command should be

---

<div class="post-metadata">

**Author:** ![Jason\_king\_lin](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@Jason\_king\_lin](https://discourse.codecombat.com/u/Jason_king_lin)\
**Post date:** [February 27, 2023, 2:43am UTC](https://discourse.codecombat.com/t/fractalization-level-help/34994/2 "2023-02-27T02:43:36Z")

</div>

The whole code whould be like:

```python
# Check the guide for the description of the problem
# Here are some functions to help draw the curves.

def degreesToRadians(degrees):
    # All vector operations require working in radians rather than degrees.
    return Math.PI / 180 * degrees
    
def koch(start, end):
    # This function will draw a Koch Curve between two Vector positions
    # Start by creating a vector from start to end using Vector.subtract.
    # full = ...
    full = Vector.subtract(end, start)
    distance = full. _______ #what?..Look t the hink down there!
    
    # Use the magnitude of the vector to check for the stop condition.
    if distance < ____ #think, think, think! Hint:a very small number.
        # Move into position and draw the line, don't forget to toggle flowers properly.
        hero.toggleFlowers(False)
        hero.move(#where do you move? start or end?)
        hero.toggleFlowers(True)
        hero.move(#where do you move? start or end?)
        return
    
    # Need to draw 4 shorter Koch curves with sides 1/3 the length.
    # We will calculate the 3 intermediate points, A, B, & C.
    # We just need the point that is one-third of the full Vector from the start Vector.
    third = Vector.multiply(full, 1 / 3)
    A = Vector.add(start, third)
    # This one needs to be rotated 60 degrees from A but the same length. Use rotate and add to get B.
    B = Vector.add(_, Vector.rotate(____, degreesToRadians(__)))
    # This point works out to adding another third to A.
    C = Vector.add(_, _____ )
    # Now we can draw the 4 curves connecting start, A, B, C, and end.
    #use "koch"
    #Start ~ A
    #A ~ B
    #B ~ C
    #C ~ End
whiteXs = [Vector(6, 6), Vector(74, 6), Vector(74, 61), Vector(6, 61)]
hero.setFlowerColor("white")
# 0~1
# 1~2
# 2~3
# 3 ~ 0

```

also click hint to see more

---

<div class="post-metadata">

**Author:** ![TheCodingCrusader22](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thecodingcrusader22/32/46084_2.png) [@TheCodingCrusader22](https://discourse.codecombat.com/u/TheCodingCrusader22)\
**Post date:** [February 27, 2023, 7:09pm UTC](https://discourse.codecombat.com/t/fractalization-level-help/34994/3 "2023-02-27T19:09:20Z")

</div>

still no work my new code is

```python
# Check the guide for the description of the problem
# Here are some functions to help draw the curves.

def degreesToRadians(degrees):
    # All vector operations require working in radians rather than degrees.
    return Math.PI / 180 * degrees
    
def koch(start, end):
    # This function will draw a Koch Curve between two Vector positions
    # Start by creating a vector from start to end using Vector.subtract.
    # full = ...
    full = Vector.subtract(end, start)
    distance = full.magnitude
    
    # Use the magnitude of the vector to check for the stop condition.
    if distance < 1:#think, think, think! Hint:a very small number.
        # Move into position and draw the line, don't forget to toggle flowers properly.
        hero.toggleFlowers(False)
        hero.move(start)
        hero.toggleFlowers(True)
        hero.move(end)
        return
    
    # Need to draw 4 shorter Koch curves with sides 1/3 the length.
    # We will calculate the 3 intermediate points, A, B, & C.
    # We just need the point that is one-third of the full Vector from the start Vector.
    third = Vector.multiply(full, 1 / 3)
    A = Vector.add(start, third)
    # This one needs to be rotated 60 degrees from A but the same length. Use rotate and add to get B.
    B = Vector.add(third, Vector.rotate(A, degreesToRadians(60)))
    # This point works out to adding another third to A.
    C = Vector.add(third, A)
    # Now we can draw the 4 curves connecting start, A, B, C, and end.
    #use "koch"
    koch(start,A)
    koch(A,B)
    koch(B,C)
    koch(C,end)
whiteXs = [Vector(6, 6), Vector(74, 6), Vector(74, 61), Vector(6, 61)]
hero.setFlowerColor("white")
koch(whiteXs[0],whiteXs[1])
koch(whiteXs[1],whiteXs[2])
koch(whiteXs[2],whiteXs[3])
koch(whiteXs[3],whiteXs[0])

```

---

<div class="post-metadata">

**Author:** ![Jason\_king\_lin](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@Jason\_king\_lin](https://discourse.codecombat.com/u/Jason_king_lin)\
**Post date:** [February 28, 2023, 1:44am UTC](https://discourse.codecombat.com/t/fractalization-level-help/34994/4 "2023-02-28T01:44:44Z")

</div>

> [@TheCodingCrusader22](#):
>
> `distance = full.magnitude`

```python
magnitude

```

is an function

> [@TheCodingCrusader22](#):
>
> `1`

Click hint to see the number

> [@TheCodingCrusader22](#):
>
> `return`

It is “pass”

> [@TheCodingCrusader22](#):
>
> `1 / 3`

Its not this

---

<div class="post-metadata">

**Author:** ![TheCodingCrusader22](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thecodingcrusader22/32/46084_2.png) [@TheCodingCrusader22](https://discourse.codecombat.com/u/TheCodingCrusader22)\
**Post date:** [February 28, 2023, 2:03am UTC](https://discourse.codecombat.com/t/fractalization-level-help/34994/5 "2023-02-28T02:03:06Z")

</div>

still no work

```python

# Check the guide for the description of the problem
# Here are some functions to help draw the curves.
def degreesToRadians(degrees):
    # All vector operations require working in radians rather than degrees.
    return Math.PI / 180 * degrees
    
def koch(start, end):
    # This function will draw a Koch Curve between two Vector positions
    # Start by creating a vector from start to end using Vector.subtract.
    # full = ...
    full = Vector.subtract(end, start)
    distance = full.magnitude
    
    # Use the magnitude of the vector to check for the stop condition.
    if distance < 3:
        # Move into position and draw the line, don't forget to toggle flowers properly.
        hero.toggleFlowers(False)
        hero.move(start)
        hero.toggleFlowers(True)
        hero.move(end)
        pass
    
    # Need to draw 4 shorter Koch curves with sides 1/3 the length.
    # We will calculate the 3 intermediate points, A, B, & C.
    # We just need the point that is one-third of the full Vector from the start Vector.
    third = Vector.multiply(full, 3)
    A = Vector.add(start, third)
    # This one needs to be rotated 60 degrees from A but the same length. Use rotate and add to get B.
    B = Vector.add(third, Vector.rotate(A, degreesToRadians(60)))
    # This point works out to adding another third to A.
    C = Vector.add(third, A)
    # Now we can draw the 4 curves connecting start, A, B, C, and end.
    #use "koch"
    koch(start,A)
    koch(A,B)
    koch(B,C)
    koch(C,end)
whiteXs = [Vector(6, 6), Vector(74, 6), Vector(74, 61), Vector(6, 61)]
hero.setFlowerColor("white")
koch(whiteXs[0],whiteXs[1])
koch(whiteXs[1],whiteXs[2])
koch(whiteXs[2],whiteXs[3])
koch(whiteXs[3],whiteXs[0])

```

---

<div class="post-metadata">

**Author:** ![Jason\_king\_lin](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@Jason\_king\_lin](https://discourse.codecombat.com/u/Jason_king_lin)\
**Post date:** [February 28, 2023, 2:03am UTC](https://discourse.codecombat.com/t/fractalization-level-help/34994/6 "2023-02-28T02:03:55Z")

</div>

> [@TheCodingCrusader22](#):
>
> `distance = full.magnitude`

should be this:

```python
distance = full.magnitude()

```

---

<div class="post-metadata">

**Author:** ![TheCodingCrusader22](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thecodingcrusader22/32/46084_2.png) [@TheCodingCrusader22](https://discourse.codecombat.com/u/TheCodingCrusader22)\
**Post date:** [February 28, 2023, 2:06am UTC](https://discourse.codecombat.com/t/fractalization-level-help/34994/7 "2023-02-28T02:06:12Z")

</div>

still not working

```python

# Check the guide for the description of the problem
# Here are some functions to help draw the curves.
def degreesToRadians(degrees):
    # All vector operations require working in radians rather than degrees.
    return Math.PI / 180 * degrees
    
def koch(start, end):
    # This function will draw a Koch Curve between two Vector positions
    # Start by creating a vector from start to end using Vector.subtract.
    # full = ...
    full = Vector.subtract(end, start)
    distance = full.magnitude()
    
    # Use the magnitude of the vector to check for the stop condition.
    if distance < 3:
        # Move into position and draw the line, don't forget to toggle flowers properly.
        hero.toggleFlowers(False)
        hero.move(start)
        hero.toggleFlowers(True)
        hero.move(end)
        pass
    
    # Need to draw 4 shorter Koch curves with sides 1/3 the length.
    # We will calculate the 3 intermediate points, A, B, & C.
    # We just need the point that is one-third of the full Vector from the start Vector.
    third = Vector.multiply(full, 3)
    A = Vector.add(start, third)
    # This one needs to be rotated 60 degrees from A but the same length. Use rotate and add to get B.
    B = Vector.add(third, Vector.rotate(A, degreesToRadians(60)))
    # This point works out to adding another third to A.
    C = Vector.add(third, A)
    # Now we can draw the 4 curves connecting start, A, B, C, and end.
    #use "koch"
    koch(start,A)
    koch(A,B)
    koch(B,C)
    koch(C,end)
whiteXs = [Vector(6, 6), Vector(74, 6), Vector(74, 61), Vector(6, 61)]
hero.setFlowerColor("white")
koch(whiteXs[0],whiteXs[1])
koch(whiteXs[1],whiteXs[2])
koch(whiteXs[2],whiteXs[3])
koch(whiteXs[3],whiteXs[0])

```

---

<div class="post-metadata">

**Author:** ![Jason\_king\_lin](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@Jason\_king\_lin](https://discourse.codecombat.com/u/Jason_king_lin)\
**Post date:** [February 28, 2023, 2:08am UTC](https://discourse.codecombat.com/t/fractalization-level-help/34994/8 "2023-02-28T02:08:14Z")

</div>

> [@TheCodingCrusader22](#):
>
> ` hero.move(start)`

> [@TheCodingCrusader22](#):
>
> ` hero.move(end)`

Remember “move” function will just move a little, you should use `moveXY`

---

<div class="post-metadata">

**Author:** ![Jason\_king\_lin](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@Jason\_king\_lin](https://discourse.codecombat.com/u/Jason_king_lin)\
**Post date:** [February 28, 2023, 2:09am UTC](https://discourse.codecombat.com/t/fractalization-level-help/34994/9 "2023-02-28T02:09:03Z")

</div>

> [@TheCodingCrusader22](#):
>
> `third = Vector.multiply(full, 1 / 3)`

Sorry , this is right 🙏

---

<div class="post-metadata">

**Author:** ![TheCodingCrusader22](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thecodingcrusader22/32/46084_2.png) [@TheCodingCrusader22](https://discourse.codecombat.com/u/TheCodingCrusader22)\
**Post date:** [February 28, 2023, 2:16am UTC](https://discourse.codecombat.com/t/fractalization-level-help/34994/10 "2023-02-28T02:16:04Z")

</div>

still not working

```python

# Check the guide for the description of the problem
# Here are some functions to help draw the curves.
def degreesToRadians(degrees):
    # All vector operations require working in radians rather than degrees.
    return Math.PI / 180 * degrees
    
def koch(start, end):
    # This function will draw a Koch Curve between two Vector positions
    # Start by creating a vector from start to end using Vector.subtract.
    # full = ...
    full = Vector.subtract(end, start)
    distance = full.magnitude()
    
    # Use the magnitude of the vector to check for the stop condition.
    if distance < 3:
        # Move into position and draw the line, don't forget to toggle flowers properly.
        hero.toggleFlowers(False)
        hero.moveXY(start.x,start.y)
        hero.toggleFlowers(True)
        hero.moveXY(end.x,end.y)
        pass
    
    # Need to draw 4 shorter Koch curves with sides 1/3 the length.
    # We will calculate the 3 intermediate points, A, B, & C.
    # We just need the point that is one-third of the full Vector from the start Vector.
    third = Vector.multiply(full, 1/3)
    A = Vector.add(start, third)
    # This one needs to be rotated 60 degrees from A but the same length. Use rotate and add to get B.
    B = Vector.add(third, Vector.rotate(A, degreesToRadians(60)))
    # This point works out to adding another third to A.
    C = Vector.add(third, A)
    # Now we can draw the 4 curves connecting start, A, B, C, and end.
    #use "koch"
    koch(start,A)
    koch(A,B)
    koch(B,C)
    koch(C,end)
whiteXs = [Vector(6, 6), Vector(74, 6), Vector(74, 61), Vector(6, 61)]
hero.setFlowerColor("white")
koch(whiteXs[0],whiteXs[1])
koch(whiteXs[1],whiteXs[2])
koch(whiteXs[2],whiteXs[3])
koch(whiteXs[3],whiteXs[0])

```

---

<div class="post-metadata">

**Author:** ![Jason\_king\_lin](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@Jason\_king\_lin](https://discourse.codecombat.com/u/Jason_king_lin)\
**Post date:** [February 28, 2023, 4:15am UTC](https://discourse.codecombat.com/t/fractalization-level-help/34994/11 "2023-02-28T04:15:32Z")

</div>

You ignore what i said

---

<div class="post-metadata">

**Author:** ![TheCodingCrusader22](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thecodingcrusader22/32/46084_2.png) [@TheCodingCrusader22](https://discourse.codecombat.com/u/TheCodingCrusader22)\
**Post date:** [February 28, 2023, 2:12pm UTC](https://discourse.codecombat.com/t/fractalization-level-help/34994/12 "2023-02-28T14:12:43Z")

</div>

Everything?!?!? (20 chars)

---

<div class="post-metadata">

**Author:** ![MarmiteOnToast](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/marmiteontoast/32/46649_2.png) [@MarmiteOnToast](https://discourse.codecombat.com/u/MarmiteOnToast)\
**Post date:** [February 28, 2023, 2:31pm UTC](https://discourse.codecombat.com/t/fractalization-level-help/34994/13 "2023-02-28T14:31:47Z")

</div>

`whiteXs = [Vector(6, 6), Vector(74, 6), Vector(74, 62), Vector(6, 62)]`  
Try copying and pasting this into your code to replace  
`whiteXs = [Vector(6, 6), Vector(74, 6), Vector(74, 61), Vector(6, 61)]`

---

<div class="post-metadata">

**Author:** ![ZAX155](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/zax155/32/34141_2.png) [@ZAX155](https://discourse.codecombat.com/u/ZAX155)\
**Post date:** [February 28, 2023, 3:02pm UTC](https://discourse.codecombat.com/t/fractalization-level-help/34994/14 "2023-02-28T15:02:08Z")

</div>

@TheCodingCrusader22 What does the hint say and your current code look like? Also could I have the level link please?  
-Wrathion, The Black Prince

---

<div class="post-metadata">

**Author:** ![Yisrael\_Hefter](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/yisrael_hefter/32/44884_2.png) [@Yisrael\_Hefter](https://discourse.codecombat.com/u/Yisrael_Hefter)\
**Post date:** [February 28, 2023, 3:06pm UTC](https://discourse.codecombat.com/t/fractalization-level-help/34994/15 "2023-02-28T15:06:43Z")

</div>

Adding to that, please post your hero and equipment.

---

<div class="post-metadata">

**Author:** ![TheCodingCrusader22](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thecodingcrusader22/32/46084_2.png) [@TheCodingCrusader22](https://discourse.codecombat.com/u/TheCodingCrusader22)\
**Post date:** [February 28, 2023, 6:10pm UTC](https://discourse.codecombat.com/t/fractalization-level-help/34994/16 "2023-02-28T18:10:11Z")

</div>

this is not a fighting level it is a flower art level

---

<div class="post-metadata">

**Author:** ![TheCodingCrusader22](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thecodingcrusader22/32/46084_2.png) [@TheCodingCrusader22](https://discourse.codecombat.com/u/TheCodingCrusader22)\
**Post date:** [March 12, 2023, 1:13am UTC](https://discourse.codecombat.com/t/fractalization-level-help/34994/17 "2023-03-12T01:13:46Z")

</div>

i am still stuck can someone help me

---

<div class="post-metadata">

**Author:** ![TheCodingCrusader22](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thecodingcrusader22/32/46084_2.png) [@TheCodingCrusader22](https://discourse.codecombat.com/u/TheCodingCrusader22)\
**Post date:** [March 12, 2023, 1:14am UTC](https://discourse.codecombat.com/t/fractalization-level-help/34994/18 "2023-03-12T01:14:42Z")

</div>

my curent code

```python
# Check the guide for the description of the problem
# Here are some functions to help draw the curves.
def degreesToRadians(degrees):
    # All vector operations require working in radians rather than degrees.
    return Math.PI / 180 * degrees
    
def koch(start, end):
    # This function will draw a Koch Curve between two Vector positions
    # Start by creating a vector from start to end using Vector.subtract.
    # full = ...
    full = Vector.subtract(end, start)
    distance = full.magnitude()
    
    # Use the magnitude of the vector to check for the stop condition.
    
        # Move into position and draw the line, don't forget to toggle flowers properly.
    if distance < 3:
        hero.toggleFlowers(False)
        hero.moveXY(start.x,start.y)
        hero.toggleFlowers(True)
        hero.moveXY(end.x,end.y)
            
    
    # Need to draw 4 shorter Koch curves with sides 1/3 the length.
    # We will calculate the 3 intermediate points, A, B, & C.
    # We just need the point that is one-third of the full Vector from the start Vector.
    third = Vector.multiply(full, 1/3)
    A = Vector.add(start, third)
    # This one needs to be rotated 60 degrees from A but the same length. Use rotate and add to get B.
    B = Vector.add(third, Vector.rotate(A, degreesToRadians(60)))
    # This point works out to adding another third to A.
    C = Vector.add(third, A)
    # Now we can draw the 4 curves connecting start, A, B, C, and end.
    #use "koch"
    koch(start,A)
    koch(A,B)
    koch(B,C)
    koch(C,end)
whiteXs = [Vector(6, 6), Vector(74, 6), Vector(74, 61), Vector(6, 61)]
hero.setFlowerColor("white")
koch(whiteXs[0],whiteXs[1])
koch(whiteXs[1],whiteXs[2])
koch(whiteXs[2],whiteXs[3])
koch(whiteXs[3],whiteXs[0])

```

---

<div class="post-metadata">

**Author:** ![TheCodingCrusader22](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thecodingcrusader22/32/46084_2.png) [@TheCodingCrusader22](https://discourse.codecombat.com/u/TheCodingCrusader22)\
**Post date:** [March 13, 2023, 8:23pm UTC](https://discourse.codecombat.com/t/fractalization-level-help/34994/19 "2023-03-13T20:23:40Z")

</div>

nvm i did it (20 chars)
