3 ms·
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] =
by silvester23 5y ago
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.
- levmiseri 5y agoThanks! I'll update the tutorial.
- tantalor 5y agoWhat was your fix?
- alipang 5y agoif (!memory[s1.id]) { memory[s1.id] = 'harvest' } ought to do it.
- schemescape 5y agoTypo fix: 'harvesting'