Wishing Well - adventurer feedback


Great level! Simple concept, well designed, and clear! No issues found (and no hacks attempted) :relaxed:

edit: requiredCoins could be randomised, to avoid hardcoding the value in the code



requiredCoins could be randomised, to avoid hardcoding the value in the code

The well use random initial values for left and right borders for guessing.


I managed to pass the level the conventional way, then I tried another strategy:
When the combined values >= requiredValue, go straight in and try to collect the exact amount. This also passes, but it’s harder to implement and more error-prone.


I know about that method and I didn’t close it on purpose, because as you wrote “it’s harder to implement” :wink:


Hey there, nice level, I managed to finish it in python and javascript.

I have some feedback though and I will use javascript for my examples. It seems that right after you say either “Nimis” or “Non satis”, there are temporarily no coins on the field. The consequence of this is that unless you are careful, items.length !== 0 evaluates to false. This means that temporarily the loop reads


Which is an infinite loop. In Python this somehow this does not lead to a problem. In javascript I had to add something in order for my hero to wait. The loop is then temporarily equivalent to



Interesting. It should be in one frame. Do you know how to get your sessionID? It can help to reproduce the bug.


Unfortunately, I’m not sure how to get the sessionID. I did find a cookie from codecombat.com with a field codecombat.sess. Perhaps the value of this is what you want? Anyway I’d rather not paste something I don’t understand, giving away my token sounds like a bad idea.

Do you have a javascript solution that does not cause an infinite loop?

I think the problem is pretty common, I believe there is even an item that grants hero.wait(), just to be able to avoid situations like this, but I didn’t want so spend gems on it. I think another way of waiting is just to let your hero move to its own coordinates.



Do you know how to open dev tools in your browser? In console should be a string with sessionID


I did a bit of reading and it seems to me that a session ID is a private bit of information. See the following site and the quote from it

Broadly speaking a client authenticates with its credentials and receives a session_id (which can be stored in a cookie) and attaches this to every subsequent outgoing request. So this could be considered a “token” as it is the equivalent of a set of credentials

Based on this I would assume you can (temporarily) take over my account with this information. I think we can manage by simply exchanging code instead…


It’s not session_id for authorization. Anyway, if you think it’s dangerous to share it with me, write to team@codecombat.com . Is it ok for you?

It’s not the same. There are can be a problematic seed or equipment.


Well, my original intended solution seems to always fail without the added “else + wait” and what I think is the intended solution always works. I can’t seem to figure out what the real difference is… If it takes me too long I suppose I will post the code.


I can’t reproduce that bug. So I suppose it can be a problem with specific equipment or a seed.
Please, write to team@codecombat.com , so we can look at your session.

Do you use “Run” or “Submit”?


I now think it is a small bug in the code combat “engine”.

Is it ok if I post a complete solution to show what I mean?


Please, don’t post solutions here.

Could you explain it more careful?

Is it a problem to write to official codecombat email?


There is a difference between code like this


and this

var adaptingCoins = true;

even when codeX is the same in both cases and does not change the variable adaptingCoins.


Ok, must seem very “construed”/convoluted, but I really did run into the behaviour when trying a solution that is similar to the intended solution. The following code is obviously not an attempt to solve the level, but it is an attempt to show you that we can run into the situation that goldAmount === 0 and that the behaviour can depend on whether we have a constant boolean that is always true in the while loop, or the actual value true.

Note that when using the following code in the level, the hero will say “goldAmount is 0”. When you comment out adaptingCoins and instead write true to get while(true){...}, the hero no longer says this. Can you confirm this behaviour?

// You need exactly 104 gold. 
// Calculate how much gold is on the field, and say the phrases to increase or decrease the amount.

var less = "Nimis";
var more = "Non satis";
var requiredGold = 104;

// This function calculates the sum of coin values. 
function sumCoinValues(coins) {
    var i = 0;
    var total = 0;
    while (i < coins.length) {
        total += coins[i].value;
    return total;

function flip(x){
    if(x === 0){
        return 1;
    } else{
        return 0;

var adaptingCoins = true;
var debugCount = 0;

var parity = 0;
while (
    var items = hero.findItems();
    var goldAmount = sumCoinValues(items);
    if(items.length !== 0) {
        if(goldAmount%2 === parity ){
            hero.say("Non satis");
            hero.say("bad parity!");
            parity = flip(parity);
        if(debugCount > 100){
            hero.say("goldAmount is  "+ goldAmount);
            debugCount = 0;


Yes. while (true) is processed differently than while expr. So if you don’t have blocking action, the system thinks you get the infinity loop.

But in the first post you mentioned another problem:


I looked your session and didn’t see it. Could you explain the first one.

One more question - why you decided to change the sample code while? For that level you just need to call summary function and check results.