I might be missing something but I think I managed to softlock myself, I spent all money in the shop so I couldn't reset then in the next fight I ended up with only a bishop and all the enemy units were on squares it couldn't get to.
This is the issue of the game right now, there isn't a clear game over condition. When you cannot beat a fight, you should lose. I didn't find an elegant solution for this, apart from trying to solve the board by code ?
Some other solutions would be to have a hard 20 turn limit, or try to detect a stalemate, but both of these solution implies the player to deliberately do the actions for that.
Some other other solutions would be to lose if you get under a certain piece threshold.
I take suggestions on this if anyone has a cool way to do it !
You could probably implement the three/fivefold repetition rule (https://en.wikipedia.org/wiki/Threefold_repetition#Fivefold_repetition) fairly easily, you just need to record the boardstate at the end of each turn and then end the game if it repeats 3/5 times.