# {SOLVED}Hunter valley help please

**URL:** <https://discourse.codecombat.com/t/solved-hunter-valley-help-please/20899>\
**Category:** Level Help\
**Created:** [April 9, 2020, 4:41pm UTC](https://discourse.codecombat.com/t/solved-hunter-valley-help-please/20899 "2020-04-09T16:41:45Z")\
**Posts on this page:** 12\
**Page:** 1

<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:** [April 9, 2020, 4:41pm UTC](https://discourse.codecombat.com/t/solved-hunter-valley-help-please/20899/1 "2020-04-09T16:41:45Z")

</div>

@Code_Kid13

```python
def moveDownRight(step):
    hero.moveXY(hero.pos.x +- step, hero.pos.y - step)

# The function has the hero move to up and right.
def moveUpRight(step):
    # Complete this function:
    hero.moveXY(hero.pos.x - step, hero.pos.y + step)
    pass

# The hunter is kind and will show the route.
hunter = hero.findFriends()[0]
route = hunter.route
routeIndex = 0

while routeIndex < len(route):
    direction = route[routeIndex]
    if direction > 0:
        moveUpRight(8)
    else:
        # Use a function moveDownRight with the shift 8:
        moveDownRight(8)
        pass
    routeIndex += 1

```

I have been stuck on this level for days i need help so badly i am using Alejandro the Duelist and the level is hunter valley and i cannot get to the east side! 🚫  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/c/cf2cd21092a19dd4a96acdf031912dbd2a3fe36c.jpeg)  
here is what i am wearing

---

<div class="post-metadata">

**Author:** ![Code\_Kid13](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/code_kid13/32/11686_2.png) [@Code\_Kid13](https://discourse.codecombat.com/u/Code_Kid13)\
**Post date:** [April 9, 2020, 4:54pm UTC](https://discourse.codecombat.com/t/solved-hunter-valley-help-please/20899/2 "2020-04-09T16:54:37Z")

</div>

I completed it first try. You model the moveUpRight like the moveDownRight, only you add step after hero.pos.y. Then, when it asks for the shift of 8, on moveDownRight, you do:

```python
moveDownRight(8)

```

That’s it.

---

<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:** [April 9, 2020, 4:57pm UTC](https://discourse.codecombat.com/t/solved-hunter-valley-help-please/20899/3 "2020-04-09T16:57:56Z")

</div>

@dedreous

> [@ZAX155](#):
>
> @Code_Kid13
> 
> ```python
> def moveDownRight(step):
> hero.moveXY(hero.pos.x +- step, hero.pos.y - step)
> 
> # The function has the hero move to up and right.
> def moveUpRight(step):
> # Complete this function:
> hero.moveXY(hero.pos.x - step, hero.pos.y + step)
> pass
> 
> # The hunter is kind and will show the route.
> hunter = hero.findFriends()[0]
> route = hunter.route
> routeIndex = 0
> 
> while routeIndex < len(route):
> direction = route[routeIndex]
> if direction > 0:
> moveUpRight(8)
> else:
> # Use a function moveDownRight with the shift 8:
> moveDownRight(8)
> pass
> 
> ```
> 
> I have been stuck on this level for days i need help so badly i am using Alejandro the Duelist and the level is hunter valley and i cannot get to the east side! 🚫  
> ![image](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/c/cf2cd21092a19dd4a96acdf031912dbd2a3fe36c.jpeg)  
> here is what i am wearing

i still am stuck

---

<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:** [April 9, 2020, 5:03pm UTC](https://discourse.codecombat.com/t/solved-hunter-valley-help-please/20899/4 "2020-04-09T17:03:57Z")

</div>

@dedreous

```python
while True:
    def moveDownRight(step):
        hero.moveXY(hero.pos.x +- step, hero.pos.y - step)
    pass
    def moveUpRight(step):
        hero.moveXY(hero.pos.x - step, hero.pos.y + step)
    pass

```

---

<div class="post-metadata">

**Author:** ![dedreous](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/dedreous/32/13849_2.png) [@dedreous](https://discourse.codecombat.com/u/dedreous)\
**Post date:** [April 9, 2020, 5:52pm UTC](https://discourse.codecombat.com/t/solved-hunter-valley-help-please/20899/5 "2020-04-09T17:52:00Z")

</div>

First thing I see…in your moveDownRight, are you adding or subtracting step?

In both of the move functions: the hero starts at 9, 35. To move right, you add to the first element (x); to move down, you subtract from the second element (y) and to move up, you add to it instead.

Because you are using routeIndex as a counter, you need to increment it…right now, it is always going to = 0.

---

<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:** [April 9, 2020, 5:52pm UTC](https://discourse.codecombat.com/t/solved-hunter-valley-help-please/20899/6 "2020-04-09T17:52:18Z")

</div>

here is my new code

```python
# Escape to the right side of the valley.

# The function has the hero move to down and right.
def moveDownRight(step):
    hero.moveXY(hero.pos.x + step, hero.pos.y - step)

# The function has the hero move to up and right.
def moveUpRight(step):
    # Complete this function:
    hero.moveXY(hero.pos.x + step, hero.pos.y - step)
    pass

# The hunter is kind and will show the route.
hunter = hero.findFriends()[0]
route = hunter.route
routeIndex = 0
while routeIndex < len(route):
    direction = route[routeIndex]
    if direction != 0:
        moveUpRight(8)
    else:
        # Use a function moveDownRight with the shift 8:
        moveDownRight(8)
        pass
    routeIndex += 1

```

---

<div class="post-metadata">

**Author:** ![dedreous](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/dedreous/32/13849_2.png) [@dedreous](https://discourse.codecombat.com/u/dedreous)\
**Post date:** [April 9, 2020, 5:56pm UTC](https://discourse.codecombat.com/t/solved-hunter-valley-help-please/20899/7 "2020-04-09T17:56:44Z")

</div>

Ok, better…line 10, you are telling hero to move down; line 19, was correct the first time - it needs to be \> 0

---

<div class="post-metadata">

**Author:** ![Code\_Kid13](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/code_kid13/32/11686_2.png) [@Code\_Kid13](https://discourse.codecombat.com/u/Code_Kid13)\
**Post date:** [April 9, 2020, 6:23pm UTC](https://discourse.codecombat.com/t/solved-hunter-valley-help-please/20899/8 "2020-04-09T18:23:15Z")

</div>

It is supposed to be

```python
hero.moveXY(hero.pos.x + step, hero.pos.y + step)

```

on def moveUpRight

---

<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:** [April 10, 2020, 1:26pm UTC](https://discourse.codecombat.com/t/solved-hunter-valley-help-please/20899/9 "2020-04-10T13:26:15Z")

</div>

```python
# Escape to the right side of the valley.

# The function has the hero move to down and right.
def moveDownRight(step):
    hero.moveXY(hero.pos.x + step, hero.pos.y - step)

# The function has the hero move to up and right.
def moveUpRight(step):
    # Complete this function:
    hero.moveXY(hero.pos.x + step, hero.pos.y + step)
    pass

# The hunter is kind and will show the route.
hunter = hero.findFriends()[0]
route = hunter.route
routeIndex = 0
while routeIndex < len(route):
    direction = route[routeIndex]
    if direction != 0:
        moveUpRight(8)
    else:
        moveDownRight(8)
        pass
routeIndex += 1

```

---

<div class="post-metadata">

**Author:** ![dedreous](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/dedreous/32/13849_2.png) [@dedreous](https://discourse.codecombat.com/u/dedreous)\
**Post date:** [April 10, 2020, 2:51pm UTC](https://discourse.codecombat.com/t/solved-hunter-valley-help-please/20899/10 "2020-04-10T14:51:13Z")

</div>

Your final statement is out of alignment…

---

<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:** [April 10, 2020, 3:08pm UTC](https://discourse.codecombat.com/t/solved-hunter-valley-help-please/20899/11 "2020-04-10T15:08:42Z")

</div>

no i already solved it the is before i solved it

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/a/a9445509d1a758c41b5ddcddc8c8e20a5dedb67f.png) [@system](https://discourse.codecombat.com/u/system)\
**Post date:** [September 15, 2022, 2:36pm UTC](https://discourse.codecombat.com/t/solved-hunter-valley-help-please/20899/12 "2022-09-15T14:36:20Z")

</div>

Closed on September 15, 2022, 2:36pm UTC

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.
