The game
What decides a floor of Magic Tower?
Magic Tower is a grid game. The hero has hit points (HP), attack (ATK) and defence (DEF), and every floor holds monsters, doors, keys, gems and potions. A monster blocks its tile until it is defeated; a door until a key of its colour is spent on it. Everything that is defeated, opened or collected is gone for good, and nothing in the game is random.
A fight is resolved in strikes, and the hero strikes first. The hero needs T = ⌈monster HP / (ATK − monster DEF)⌉ strikes, so the monster strikes T − 1 times, each for max(0, monster ATK − DEF). The product is the HP the fight costs. If the hero's ATK does not exceed the monster's DEF, the fight cannot be won at all.
Try it on the monsters of the simple floor, the running example of the thesis. The hero starts there with 470 HP, ATK 9 and DEF 4; four yellow doors, five keys, four red and four blue gems and six potions lie on the floor, and the boss waits at the bottom.
One more ATK point would make this fight cost 156, one more DEF point 168. A stat point applies to every later strike, so a gem picked up before a fight can save more HP than it seems to be worth.
Two consequences drive the game. Each point of ATK can remove a monster strike, and each point of DEF lowers every strike. So the order matters: a gem collected before a fight saves HP on that fight and every later one. Deciding the order of fights, doors and items is the whole problem.