# Gas Attack - Adventurer Feedback

The mass needed is not as precise as implied by the instructions. I was able to use a mass quite a bit lower than the actual sum.

``````M = minimum health of all enemies
S = sum health of all enemies

return S-M
``````

This still wins.

Of course doing this requires more work than just adding up their healths, but it might make room for someone that doesn’t code, but just guesses a number and gets lucky with the random seed.

2 Likes

Another nice and simple level. Great!

The only thing I didn’t understand is that if the `findFriends()` method returns the peasants, then why the `findEnemies()` doesn’t return the ogres? Although you can still solve it with a one-liner, it’s just uglier

1 Like

Sorry, but what is “minimum health of all enemies”?

I checked that level with `return S - 1` and at least one ogre remains alive in this case. Could you post your tricky code here or send it me in Slack?

Although you can still solve it with a one-liner, it’s just uglier

With the full python functionality you can solve almost all levels with one-liners Yeah, I love code golf puzzles too.

Do you mean the hero’s method? It’s weird, I will check, but maybe the hero can see friends through walls.

1 Like

I think he meant the health of the enemy with the least health.
The problem in the ref code was that it would subtract the last victim’s entire health even when poisonMass was less than health (resulting in negative poisonMass at the end).

I submitted a patch for this and a few other things:

1. Fixed poisonAttack calculation
2. set hero.seeThroughWalls = false (makes it harder to use attacks like chain-lightning, which can kill any remaining ogres)
3. set ignoreItemGold to true (no income from boss stars => no summoning, although it might not make much of a difference)
4. replaced munchkins with scouts (for a larger health range and so that health does not need to go above their natural maxHealth)
5. changed a few words in the sample code (but this could mess with translations)

edit: noticed a typo in the comments: “require mass” should be “required mass”. (was not changed in the above commit)

1 Like

Thanks @zuf !!

Yeah, it was the wrong calculation for the last enemy.

It’s course level and if high level players want to “cheat” - it’s ok.

Thx. will fix.