Feedback: Basin Stampede

I found this level very disappointing. I can see from the feedback above that my experience if not my reaction is typical. I was disappointed because I am using CodeCombat to teach my son programming.

I consider this a major problem. When he correctly applies the indicated to code to the problem and the code doesn’t work, there are a number of unproductive reactions. They all manifest as frustration and disappointment, and they all make it harder to teach him an appreciation of logic and its application to programming.

This is not the first time I have noticed counter productive elements in some of the levels. In the “Agrippa Defense”, the student is instructed to preserve their cleave function until it is most useful, but the instructions implies that the value of cleave is function of proximity (distanceTo) rather than population. In the next problem, “Munchkin Swarm”, the enemy waits until there is a sufficiently large group before attacking. In this scenario, proximity can stand in for population. The “Agrippa Defense” would teach a better of appreciation of problem solving and do a better job of setting up the “Munchkin Swarm” if the munchkins in that first behaved as the munchkins in the second.

Overall, I think that CodeCombat is an effective tool, but there are definitely some issues to be addressed.

4 Likes

This level is still being playtested: bugs and errors are to be expected.

As for Agrippa Defense, the purpose is not to teach the best use of cleave, but rather how to use an if / else statement to see if something is true and take action if it is

The best logic for cleave would be checking the amount of enemies within a certain amount distance:

enemies = self.findEnemies()
cleavable = 0
index = 0
while index < len(enemies):
    enemy = enemies[index]
    if distanceTo(enemy) < 4:
        cleavable += 1
    index += 1
if isReady('cleave') and cleavable > 4:
   self.cleave(enemy)

This is way too difficult at this point (he should be able to do it by the end of the desert world though)

3 Likes

Hello. Could you explain what actually is wrong with Basin Stampede level?

Maybe it would be better to write about “Agrippa Defense” here.

4 Likes

Hi George,

Do you notice failures when applying the ‘correct’ code? I playtest with a few seeds to make sure there isn’t any random-losses at play, but, please let me know what problems you see with the level and I will do my best to fix them.

3 Likes

A) You are right, he can do it at the end of the course.
B) The enemies all move in a cluster. They don’t come at random intervals.
C) The logic of the game provides the problem that is solved with each problem. Since The Agrippa narrative stipulates that the point of the problem is to preserve cleave until it can best be used, it does, in fact, claim teach the best use of cleave. Admittedly, my interest is in my son learning Python, and not the game environment, but the game environment is the environment in which learning occurs. Logical inconsistencies in the game environment will decrease learning efficiency. The target market for this course are still primarily concrete thinkers.
D) Acknowledged: bugs and errors are to be expected.

3 Likes

Hey there,

I am having a lot of trouble with this level. Can you help me?

Here is my code:

# Uh oh, a stampede! Use your cunning to make it to the oasis.

loop:
    enemy = self.findNearest(self.findEnemies())
    xPos = self.pos.x + 5
    yPos = 17
    if enemy:
        # You only need to shift up/down 1m to dodge the yaks!
        if enemy.pos.y > self.pos.y:
            # If the Yak is above you, adjust yPos downwards!
            
            pass
        elif enemy.pos.y < self.pos.y:
            # If the Yak is below you, adjust yPos upwards!
            
            pass
    self.moveXY(xPos, yPos)

EDIT: This time i’ve formatted.:grinning:

4 Likes

It doesn’t appear that you have done any work on this code. What you want to do is add or subtract one from yPos, depending on whether the yak is below or above you.

3 Likes

The thing about Basin Stampede is that once a yak hits you, it stops moving, and when the character tries to go back to his original position so he can continue the gauntlet (as he inevitably will), the yak hits the character again, causing the character to never get back on course and ending up dead.

3 Likes

My son is having a issue with Basin Stampede. I’m fairly certain his code is correct but everytime his character moves back his original position he hits a dead yak and never gets on course. Any tips?

3 Likes

Hi, can you post your son’s code so we can see what is happening when it runs?

1 Like
// Uh oh, a stampede! Use your cunning to make it to the oasis.

while(true) {
    var enemy = hero.findNearestEnemy();
    var xPos = hero.pos.x + 5;
    var yPos = 17;
    if(enemy) {
        // You only need to shift up/down 1m to dodge the yaks!
        if(enemy.pos.y > hero.pos.y) {
            // If the Yak is above you, adjust yPos downwards!
            var newX = hero.pos.x + 5;
            var newY = hero.pos.y - 1;
            hero.moveXY(newX, newY);
        } else if (enemy.pos.y < hero.pos.y) {
            // If the Yak is below you, adjust yPos upwards!
            newX = hero.pos.x + 5;
            newY = hero.pos.y + 1;
            hero.moveXY(newX, newY);
        }
    } 
    hero.moveXY(xPos, yPos);
}
2 Likes

@visualjeff The code you have posted updates the hero’s y position by ± 1. I believe that should be ± 3.

1 Like

Appreciate your help, but it doesn’t work. I am still dying. I tried several times.

2 Likes

Oh, I also noticed another problem with the code: the hero.moveXY method is called twice per loop iteration (one time inside the if/else if and another at the end of the loop).

You can remove the hero.moveXY commands from inside the if / else if, as well as the newX and newY variables. You just need to increment or decrement the yPos variable (put yPos += 3 and yPos -= 3 inside the corresponding conditional blocks) and the hero will move to the correct position in the moveXY command at the end of while block.

2 Likes

Ok. I updated my code but it still doesn’t work?

while(true) {
    var enemy = hero.findNearestEnemy();
    var xPos = hero.pos.x + 5;
    var yPos = 17;
    if(enemy) {
        // You only need to shift up/down 1m to dodge the yaks!
        if(enemy.pos.y > hero.pos.y) {
            // If the Yak is above you, adjust yPos downwards!
            yPos = hero.pos.y - 3;
        } else if (enemy.pos.y < hero.pos.y) {
            // If the Yak is below you, adjust yPos upwards!
            yPos = hero.pos.y + 3;
        }
    } 
    hero.moveXY(xPos, yPos);
}
2 Likes

Hey @visualjeff, sorry for the delay.

This level expects you to adjust the yPos variable based on the initial yPos value (which is the vertical center of the level). In other words, it expects you to write yPos = yPos + 1 and yPos = yPos - 1. In my previous reply, I have used the equivalent shorthand syntax: yPos += 1 and yPos -= 1.

By the way, although I have initially beaten the level applying ± 3 to the yPos, I have now checked the level comments and it actually recommends using ± 1. I’ve tested with ± 1 and it works as well. I just wanted to mention that the comments are not wrong. :smile:
(The last time I playtested the level, there were no comments to go by)

2 Likes

Ok. This worked for me. Figured it out. Thank you for your help.

[redacted, please don’t post solutions]

2 Likes

No problem. :smile:

In hindsight, the logic for this level seems a little too unclear/confusing. I wonder if we could make some kind of improvement?

2 Likes

Warrior w/ ring of speed, still has issues. Used the self.moveXY(3000, 17) instead, it worked due to ton of armor.
Still would be nicer if the suggested code worked. — However, not sure if ring is relevant, because if I take out the silly second instance of moveXY it works, too:

// Uh oh, a stampede! Use your cunning to make it to the oasis.

while(true) {
    var enemy = hero.findNearestEnemy();
    var xPos = hero.pos.x + 5;
    var yPos = 17;
    if(enemy) {
        // You only need to shift up/down 1m to dodge the yaks!
        if(enemy.pos.y > hero.pos.y) {
            // If the Yak is above you, adjust yPos downwards!
            hero.moveXY(xPos, yPos-1);
        } else if (enemy.pos.y < hero.pos.y) {
            // If the Yak is below you, adjust yPos upwards!
            hero.moveXY(xPos, yPos+1);
            
        }
    }
}

2 Likes

Can you take a picture of what equipment you are using, or email us at team@codecombat.com? When I run your code right there, it works fine.

1 Like