Being a native Python coder, I felt very crippled by the inability to use slices to interpret the coded orders. Would it be possible to be able to incorporate slices into the code for the game? Or at least solve the vague error message that occurs when attempting to use slices (“tmp26[tmp27] is not a function”, with an arrow pointing to the end of the code)? It’s a small complaint that probably doesn’t affect most users, but I figured it was worth pointing out.
Hmm, I’m very annoyed at the bonus goal messing things up; basically if the paladin and artillery move to their target positions before the rest of the units do, the level exits immediately and the first goal is left incomplete.
Also, I think my level session is messed up; for some reason the initial hero code was my Binary Deployment code, then on the leaderboard it says I completed the level 7 days ago with an impossible time of 2.9 seconds. I also don’t see/get the achievements unless if I use Codecombat Direct.
The documentation could be better. I mean, I solved the puzzle (minus the world ending too early issue) pretty quickly, but I don’t think there was much instruction on what ways to decode a string. (maybe in JavaScript mention that String::slice(a, b) can be used to return a string from index a up to but not including index b; parseInt(num, 10) can be used to convert a String into a decimal Number; maybe even introduce regular expressions?, etc). Book V’s massive amount of documentation might be overwhelming…
Thanks for the feedback. I don’t have Boss Star IV, so I wasn’t able to test the timing for finishing the bonus goal. I’ll fix that.
As for python slices, I agree. Really hope this gets fixed soon.
trotod, I don’t know how to decode in javascript and didn’t put much in for python as I knew it was broken. It should be added, but I forgot about it when working on my next level… I’ll try to alieviate your concerns with the python documentation, leaving space for it to be translated to javascript…
I found this level interesting because I don’t think I’ve played any other levels that involve getting bits of a string.
The documentation explained what each part meant but not much else so I had to do some experimenting.
First I found that each character in the string could be accessed like an element in an array - that solved how to read through the message
Then I got stuck for a bit before realising that characters such as '9' could not be used as numbers. I also accidentally discovered that strings would concatenate just by plusing them.
Searching through the string section of the programmicon, I figured that String.charCodeAt() would work. And that was the key to passing the level.
I didn’t use any slices though.
Overall, there should be more levels involving strings.
as this was the first time I had to do a type conversion in the game, you might want to include a hint about it for:
those who are used to untyped or dynamically typed languages
those learning who have never had to do type conversion
Coming from perl, it took me a bit to realize self.command was erroring out with Target an {x: number, y: number} position. because I needed to do a type conversion. If this was my first programming language it probably would have been a lot harder to suss out.
My guess is that it works if you were to send 8 peasants all to a peasant spot. I think the checking is just looking to see if dude is in right spot and counting how many there are.
count = 0
for dude in minions:
if dude’s position is correct:
count += 1
if count == 8:
YOU WIN!
Unfortunately life is pretty crazy at school right now, might be able to look at it in a couple of weeks, but not right now.
I tried to find out why by having my hero say the message then say the X and Y coords to make sure they were coming out as a number and not a string. I looked at the message then looked at where my units ended up and they went right to the position in the message. Is this by any chance wrong?
Sorry for reviving this topic, but I recently noticed that I had a code that worked, but I think the x and y coordinates weren’t put right in the message string.
(Side note: I did this level in Javascript.)
const sign = hero.findByType("sign")[0];
const message = sign.message;
function n (i) {
return message.charAt(i);
}
for (let i = 0; i < message.length; i++) {
var unit = null;
switch (n(i)) {
case "a":
unit = "archer";
break;
case "s":
unit = "soldier";
break;
case "p":
unit = "peasant";
break;
case "g":
unit = "griffin-rider";
break;
}
if (unit) {
hero.summon(unit);
let toCommand = hero.findNearest(hero.findByType(unit));
hero.command(toCommand, "move", {x: parseInt(n(i + 1) + n(i + 2)), y: parseInt(n(i + 3) + n(i + 4))});
}
}