Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Very nice so far.

I noticed a small problem in the tutorial. On step 3 or 4, when the suggested code is

if (s1.energy == s1.energy_capacity){

memory[s1.id] = "charging";

} else if (s1.energy == 0){

memory[s1.id] = "harvesting";

}

if (memory[s1.id] == "charging"){

s1.move(base.position);

s1.energize(base);

} else if (memory[s1.id] == "harvesting"){

s1.move(star_zxq.position);

s1.energize(s1);

}

My spirit had already transferred a bit of energy to the base, so it entered neither of the states. It was a pretty easy fix to make, but strictly following along the instructions, I would have been stuck there.



Thanks! I'll update the tutorial.


What was your fix?


if (!memory[s1.id]) { memory[s1.id] = 'harvest' }

ought to do it.


Typo fix: 'harvesting'




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: