Scavenging behavior flaw
paulkent-um opened this issue · 1 comments
There's one particular flaw I'm aware of with the new item pickup behavior, and it's kinda fundamental, unfortunately.
I have arranged for the agent to use the pickup command to look at piles of multiple items, as opposed to using the pop-up that appears when stepping on the tile with the pile, or using the near-look command. Compared to the other options, pickup has major advantages:
- Unlike near-look, pickup gives you the information without making you spend a turn, even when you're blind.
- Unlike either of the other options, pickup indicates what keys to press to select what items, so when it's time to actually pick things up, the agent already knows what sequence of commands to queue up.
- At this time, I don't really consider "use the automatic pop-up" to be viable. Pop-ups are hard enough to read even when you're expecting one particular type at one particular time. Trying to check whether a specific pop-up is on-screen, just from the ttychars, is nearly impossible. The "stuff that's here" popup in particular can appear on different areas of the screen depending on the length of text and whatnot. No thank you.
But, there is one downside to using pickup as our near-look... and that would be the situation where exactly 1 item stack is underfoot. Pressing pickup in that situation... just... picks it up, without giving us a chance to cancel the command (which is what we do for the case of multiple stacks underfoot). That's bad for multiple reasons – not only could we end up picking up something harmful like a cockatrice corpse or loadstone, but picking anything up by mistake causes a turn to pass in the middle of the "observe what's going on" process, which violates the agent's preconditions all over the place.
For now, the best I can do is to just try to keep track of whether there's exactly one item underfoot, and not use pickup as near-look when that is the case. I fully expect there to be loads of instances down the road where this "keeping track" process fails, and the agent will pick up something undesirable and/or panic from desyncing with the environment. Oh well...
Partly, though not completely, fixed by adding nearlook to the check underfoot routine. Near look helps us confirm that there is not exactly 1 item underfoot, though we still use pickup to check what the items actually are.