BenLubar / df-ai

Dwarf Fortress + Artificial Intelligence
https://benlubar.github.io/df-ai/
zlib License
245 stars 26 forks source link

Make trader always leave in profit #81

Open mrseeker opened 3 years ago

mrseeker commented 3 years ago

Describe the bug When the dwarves have only 10 dwarfbucks to spend and the merchant is not willing to trade a single item, the AI will get stuck.

What happened The AI got stuck on the trading screen, trying to do an impossible trade. (trade 10 dwarfbucks for 1 item costing 10 dwarfbucks, and the trader did not want to trade).

Expected behavior When it's clear that there is only 1 item that can be traded, and the merchant does not accept it, don't try to keep trading. The trader must always end up in profit.

Visual reference If applicable, paste in a screenshot or a Twitch clip.

ai version:

Dwarf Fortress 0.47.05
  Windows 64-bit
df-ai 0.47.05-r1-0-gd7302b4a
  code d7302b4a8ca9417b9d47337cf2009c0940c8f6e3
DFHack 0.47.05-r1-0-g032cd64c
  library 032cd64c10bf38fcb9d955c75a8ade4e857cc579
  structures 11c379ffd31255f2a1415d98106114a46245e1c3

Additional context Anything else you'd like to add?

If you have a df-ai-debug.log file, drag or paste the file into this issue.