Ok. The algorithm appears to be generating correct numbers. A couple of bugs, all of them important.
I asked it to compute how to behave in a 1/1 vs. 2/2 battle. This is the smallest situation where one of the parties needs to make a choice: if the 1/1 player manages to make one hit on the 2/2 player, should that player take it off attack or off defence?
Output looks like this:
Calculate state for [A:1/1 vs. D:2/2 (6)] and [A:2/2 vs. D:1/1 (6)] Calculate state for [A:2/1 vs. D:1/1 (5)] and [A:1/1 vs. D:2/1 (5)] Calculate state for [A:1/1 vs. D:1/1 (4)] and [A:1/1 vs. D:1/1 (4)] [A:1/1 vs. D:1/1 (4)] D: winprob 36.8 [A:1/1 vs. D:2/1 (5)], 1 hits. Take 1 off attack, go to state [A:1/1 vs. D:1/1 (4)] invert for attack winprob: 63.1 [A:2/1 vs. D:1/1 (5)] D: winprob 5.1 [A:1/1 vs. D:2/1 (5)] D: winprob 81.6 Calculate state for [A:1/2 vs. D:1/1 (5)] and [A:1/1 vs. D:1/2 (5)] [A:1/1 vs. D:1/2 (5)], 1 hits. Take 1 off defence, go to state [A:1/1 vs. D:1/1 (4)] invert for attack winprob: 63.1 [A:1/2 vs. D:1/1 (5)] D: winprob 9.6 [A:1/1 vs. D:1/2 (5)] D: winprob 83.4 [A:1/1 vs. D:2/2 (6)], 1 hits. Take 1 off defence, go to state [A:1/1 vs. D:2/1 (5)] invert for attack winprob: 94.8 [A:1/1 vs. D:2/2 (6)], 2 hits. Take 1 off attack, 1 off defence, go to state [A:1/1 vs. D:1/1 (4)] invert for attack winprob: 63.1 [A:1/1 vs. D:2/2 (6)] D: winprob 98.3 [A:2/2 vs. D:1/1 (6)] D: winprob 0.4
The important line is this one: [A:1/1 vs. D:2/2 (6)], 1 hits. Take 1 off defence, go to state [A:1/1 vs. D:2/1 (5)] invert for attack winprob: 94.8.
If attacker is 1/1, and defender is 2/2, and the attacker scores 1 hit, then the defender should take it off defence. If they do, then they will be in the situation of being 2/1 vs 1/1, which has a 94.8% win probability. Looking at the output, if the defender were to take it of attack then next turn they be in 1/2 vs 1/1, which only has a 90.4% win probability.
Looking at this data, you might ejaculate “This is bullshit! The win probability for 1/1 vs 1/1 is 36.8%! It should be 50/50!” But you would be wrong. You see, that number is the win probability for the player currently defending. Certainly, their chance of losing is the same as the attackers chance of losing if no hits are scored, but there’s only at 21 in 36 chanceof that.
This applies to any situation and it brings us to our first useful result – it is a good idea to close and attack. In fact, it’s a very good idea. Even if you are weaker than your opponent, you are better off attacking and hoping that that first hit will knock them down some. If it does, great; and if it doesn’t, you are no worse off than you would be if they caught and hit you first.
So the ‘pre’ stage of the battle – moving your pieces around the board – matters, which means mobility matters. Absolutely you want to corner your opponent in such a way that you can get them on your next turn, but they cannot get you on their next turn. I am not sure if the shape of the board means there is a winning strategy for doing this, or if it’s always possible for the players to circle around each other, trying to get that first hit.
Another point of interest is that this strategy is the best strategy if the opponent also follows the best strategy. But what if they don’t? What if there’s a silly mistake that almost everyone makes when they play? Well, your best strategy is to take advantage of that quirk, which means that this strategy is not as good as that one. But I don’t think that your opponent tending to make a particular mistake is going to make this strategy worse than it is if they play perfectly.
But I could be wrong about that.
So now that I can generate the data, I can do some theorem testing on it. My first question is: if you take multiple hits, is your best strategy always the same as if you were to take these multiple hits one at a time? I think it’s likely that it is, but not certain. I this is the case, then I can make life much simpler by only being interested in the “you take one hit” set of strategies.
The main problem is presenting the algorithm. What I need is a simple set of rules saying what to do in any possible situation. That is: the thing that the rules tell you do do should be the same as what (according to this) you actually should do.