# Lost viking... .py

**URL:** <https://discourse.codecombat.com/t/lost-viking-py/9100>\
**Category:** Uncategorized\
**Created:** [September 28, 2016, 8:49pm UTC](https://discourse.codecombat.com/t/lost-viking-py/9100 "2016-09-28T20:49:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssxxxxss](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@ssxxxxss](https://discourse.codecombat.com/u/ssxxxxss)\
**Post date:** [September 28, 2016, 8:49pm UTC](https://discourse.codecombat.com/t/lost-viking-py/9100/1 "2016-09-28T20:49:57Z")

</div>

sooo…  
I’m doing: [https://codecombat.com/play/level/lost-viking](https://codecombat.com/play/level/lost-viking)  
and… Well I don’t understand it at all and kinda makes me disappointed in myself,  
how do I add new values too old values correctly…  
Where do they learn you that,  
Like I got it to move with:

```python
SLIDE=9
SWITCH=5
SKIP=7
sidemove = 1
sideSteps = 1
steps = 1
X_PACE_LENGTH = 4
Y_PACE_LENGTH = 6

while steps <= 35:
    hero.moveXY(steps * X_PACE_LENGTH, sideSteps * Y_PACE_LENGTH);
    if (steps % SWITCH == 0):
        sidemove -= 1;
    sideSteps += sidemove
    if (steps % SKIP == 0):
        sideSteps += sidemove
    if (sideSteps > SLIDE):
        sideSteps -= SLIDE;
        if (sideSteps < 1):
            sideSteps += SLIDE;
    steps += 1
```

but it just ends up walking into the mines…  
I’ve no understanding of how the mission works, Even with the “hints”…  
I feel like I’ve missed a huge part of this game some how…?  
this is what it looks like [https://s.put.re/kXsyYN8.gif](https://s.put.re/kXsyYN8.gif)

---

<div class="post-metadata">

**Author:** ![ssxxxxss](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@ssxxxxss](https://discourse.codecombat.com/u/ssxxxxss)\
**Post date:** [September 30, 2016, 9:38am UTC](https://discourse.codecombat.com/t/lost-viking-py/9100/2 "2016-09-30T09:38:28Z")

</div>

It has been a while and no one has given me any help yet…

---

<div class="post-metadata">

**Author:** ![htrnblr](https://avatars.discourse-cdn.com/v4/letter/h/f9ae1b/32.png) [@htrnblr](https://discourse.codecombat.com/u/htrnblr)\
**Post date:** [September 30, 2016, 11:38am UTC](https://discourse.codecombat.com/t/lost-viking-py/9100/3 "2016-09-30T11:38:47Z")

</div>

Level is really hard  
I was planning to help you  
but  
Even considering that I finished the level  
I look at my code, and not particularly understand what he is doing

---

<div class="post-metadata">

**Author:** ![htrnblr](https://avatars.discourse-cdn.com/v4/letter/h/f9ae1b/32.png) [@htrnblr](https://discourse.codecombat.com/u/htrnblr)\
**Post date:** [September 30, 2016, 10:30pm UTC](https://discourse.codecombat.com/t/lost-viking-py/9100/4 "2016-09-30T22:30:14Z")

</div>

switch - manage hero.pos.y

sideSteps++  
**until switch, then**  
sideSteps–  
**until switch, then**  
sideSteps++  
**until switch, then**  
sideSteps–  
etc

skip - manage hero.pos.y, relative current switch

sideSteps++  
sideSteps++  
or  
sideSteps–  
sideSteps–

slide - manage hero.pos.y, limiter

sideSteps \> slide  
reset sideSteps to the 1  
sideSteps \< 1  
reset sideSteps to the slide

We need

1. mechanism to Switch between sideStep++ and sideStep–
2. mechanism to execute Skip regarding current Switch
3. limiter for max and min sideStep

regarding your code  
You have no 1  
have part of 2  
and have 3

```python
sidemove = 1
if (steps % SWITCH == 0):
        sidemove -= 1;

```

sidemove = 1 - 1 = 0  
sideSteps += 0  
gorizontal move until next switch
