Closed bnordli closed 7 years ago
this seems weird since any inversion in the tests was not meant to change the behaviour of the function. Could you point to the implied source code line?
https://github.com/bnordli/rftg/blob/d47f04451bc17aa1dff9fbc144054235ccc61310/src/engine.c#L3915
It was reasonable to negate prestige > 0
to prestige == 0
, but this breaks down when prestige goes negative..
Well, then it seems to me that the bug is then to allow for negative prestige. It does not have any sense in the context of the game, is it really necessary to accomodate for the possibility of having negative prestige?
I agree with you: This is a bug in the AI.
So this boils down to whether/when we want to change the AI behavior (possibly retraining all nets). If we do not change the AI for the next release, we unfortunately have to deal with negative prestige.
"It does not have any sense in the context of the game, is it really necessary to accomodate for the possibility of having negative prestige?"
I don't fully know what you guys are saying, but if the AI is considering impossible states and making decisions based on that, then yes you might have to accomodate for negative prestige. So that it plays more correctly.
On second thoughts, this only affects BoW, and is a fairly simple code change.
@Marsux, can you retrain the BoW nets if I make this change to the AI?
yes
Code is ready and pushed to master. @Marsux, will you start retraning the Brink of War nets?
Have all cases of this "Valid Payment" been accounted for? I'm still getting them even though it seems to be me that's causing these (as in the sole AI opponent doesn't have any dealings with Prestige). Details, and files available upon request.
Sadly, not everything has been solved yet. I haven't had time to investigate further, but I have a repro that I can work on. I'll let you know when I think a fix is ready.
Finally, I think I have fixed this. Can you see if the new code in master works better?
Tests are looking very good. Closing this for now.
In
predict_action
, the AI evaluates all possible actions of an opponent. This even includes Prestige actions when a player does not have any Prestige, or the Search action, even when the Prestige action is used.The AI should simply set
act_scores[i] = 0
for all illegal actions.Found in this save game
resulting in "Couldn't find valid payment", because a player actually goes to negative Prestige and the code can't handle that.
(Note that this specific failure is a regression in 0.9.5, since in
settle_legal
,p_ptr->prestige > 0
was inverted top_ptr->prestige == 0
.)