For most casual PVP players out there, we might not know how our current minigames strength stacks up against the general rest of the field. This script seeks to automatically solve that problem (to squeeze out that little extra swagger) so you don't have to.
The implementation is an epsilon-decreasing multi-armed bandit strategy (from 0.9 to 0.05 linearly over ~1000 pvp fights minis) which attempts to estimate your best minigame and plays that mini (1-epsilon)x100% of the time, and otherwise chooses to play the other minis uniformly at random. (Advanced users can probably code up a more complex strategy if so desired [e.g. Thompson sampling or UCB, although a big hurdle would be to get gaussian/beta distributions in the ASH script] - this was just a pretty simple implementation).
The default implementation is the Bernoulli Thompson bandit, but users who prefer other bandits may run
to use that instead.
This script has a hardcoded dependency on UberPVPOptimizer, but may otherwise be run out of the box (itcurrently accepts no arguments and will simply use all of your remaining pvp fights). It should reset the stats every time the season changes (unfortunately, this means that even if a mini is repeated in the future, we do not consider how it has performed historically in the previous PVP seasons), so unless there's a drastic change to the peevpee.php?place=fight page, there's pretty much no upkeep to be done on the script.
To install the script, simply type the following into the KoLMafia CLI
Edit: It currently also does not track the difference between HC and non-HC stats, and simply assumes that they are one and the same thing.
Edit 2: Updated to choose non-uniformly (or rather, uniformly across the [padded] win percentages so that minis with better win:loss ratios are more likely to be chosen - i.e. a mini with a 20% win percentage will be twice as likely to be chosen as compared to a mini with a 10% win percentage) when exploring (i.e. not playing the current statistically best minigame).
Edit 3: Updated to carry stats over into Post-Season since the minis haven't changed yet.
Edit 4: Fixed some errors in parsing pirate season minigame names. Arrrgh
Edit 5: Fixed a bug on line 139 - changed PVP_choice into pvp_choice
Edit 6: The script now tracks the winrate of each minigame encountered over the course of every single fite, which should give a more accurate estimate of the offensive strength of each minigame. (Previously, it tracked the winrate of the selected/guaranteed minigame for each fite, and recorded the overall win/loss of each fite instead of each minigame).
Edit 7: set PVP_MAB_reduced_verbosity=true to reduce the verbosity of the script.
Edit 8: It should now properly track your overall season's wins and losses, from the date you update to this newest version of the script (it does not parse your historical fights). Also added a pref PVP_MAB_use_meteoriteade to acquire and use meteorite-ades if they are available or acquireable for < 10k meat.
Edit 9: Reduced minimum epsilon to 0.05 since we get already get significant amounts of data about the other minis since the previous update (which tracks individual minis each fite). Also added some refactoring to print out the win rate for the day/session (across your multiple legs if you're looping).
Edit 10: Fixed bug trying to loot in HC. We will attack for fame instead.
Edit 11: Fixed error in tracking whether we won or lost a mini. (I would have liked to push the blame to the fact that there exists 2 different html results depending on whether the user enabled the "Use compact PvP mode" under the vanilla KoL Interface Options, but it turns out that the parsing was actually broken in both). Also, ties are now a thing.
Edit 12: You can now checkout the script from GitHub to keep it updated (whenever it does rarely get updated). The github script has been converted to TypeScript, so do delete the ASH script if you intend to switch over (which you should).
Edit 13: Deprecated arbitrary parameter-dependent epsilon-greedy algorithm in favour of parameter-free UCB1 and Gaussian Thompson Sampling algorithms. Also fixed bug regarding Drunken Season having more than 12 minis.
The default implementation is the Bernoulli Thompson bandit, but users who prefer other bandits may run
Code:
PVP_MAB strategy=UCB|epsilonGreedy|gaussianThompson|Exp3
This script has a hardcoded dependency on UberPVPOptimizer, but may otherwise be run out of the box (it
To install the script, simply type the following into the KoLMafia CLI
Code:
git checkout https://github.com/Pantocyclus/PVP_MAB.git release
Edit: It currently also does not track the difference between HC and non-HC stats, and simply assumes that they are one and the same thing.
Edit 2: Updated to choose non-uniformly (or rather, uniformly across the [padded] win percentages so that minis with better win:loss ratios are more likely to be chosen - i.e. a mini with a 20% win percentage will be twice as likely to be chosen as compared to a mini with a 10% win percentage) when exploring (i.e. not playing the current statistically best minigame).
Edit 3: Updated to carry stats over into Post-Season since the minis haven't changed yet.
Edit 4: Fixed some errors in parsing pirate season minigame names. Arrrgh
Edit 5: Fixed a bug on line 139 - changed PVP_choice into pvp_choice
Edit 6: The script now tracks the winrate of each minigame encountered over the course of every single fite, which should give a more accurate estimate of the offensive strength of each minigame. (Previously, it tracked the winrate of the selected/guaranteed minigame for each fite, and recorded the overall win/loss of each fite instead of each minigame).
Edit 7: set PVP_MAB_reduced_verbosity=true to reduce the verbosity of the script.
Edit 8: It should now properly track your overall season's wins and losses, from the date you update to this newest version of the script (it does not parse your historical fights). Also added a pref PVP_MAB_use_meteoriteade to acquire and use meteorite-ades if they are available or acquireable for < 10k meat.
Edit 9: Reduced minimum epsilon to 0.05 since we get already get significant amounts of data about the other minis since the previous update (which tracks individual minis each fite). Also added some refactoring to print out the win rate for the day/session (across your multiple legs if you're looping).
Edit 10: Fixed bug trying to loot in HC. We will attack for fame instead.
Edit 11: Fixed error in tracking whether we won or lost a mini. (I would have liked to push the blame to the fact that there exists 2 different html results depending on whether the user enabled the "Use compact PvP mode" under the vanilla KoL Interface Options, but it turns out that the parsing was actually broken in both). Also, ties are now a thing.
Edit 12: You can now checkout the script from GitHub to keep it updated (whenever it does rarely get updated). The github script has been converted to TypeScript, so do delete the ASH script if you intend to switch over (which you should).
Edit 13: Deprecated arbitrary parameter-dependent epsilon-greedy algorithm in favour of parameter-free UCB1 and Gaussian Thompson Sampling algorithms. Also fixed bug regarding Drunken Season having more than 12 minis.
Last edited: