Brutalal has created a spreadsheet that plots the optimal path (in terms of number of steps needed to run through a field). It details exactly when you will encounter a random battle and allows many configurable options on how to avoid them.
The problem is there are many ways of getting away from a battle:
1. Accept the battle and instant escape (685 frames)
This also reduces the danger counter to 0 (you get more battles as the danger counter rises)
2. Menu glitch (83 frames)
This glitch avoids a battle but the danger counter remains (eg, if you do 20 menu glitches in a row, you'll be getting a battle every few steps)
3. Stutter Walk (x frames)
This is clearly the fastest way to avoid a battle. The danger counter remains. The spreadsheet calculates how much stuttering is needed. You lose time for every stutter, but it is a tiny amount.
So we know that the battles are entirely deterministic and we even have a spreadsheet which shows the field lengths and when the battle will occur.
This is a segment in the game. The X axis are the steps and the Y axis is the danger counter. The white lines are the battles. You get a battle when the red line hits a white line.
What we need help with is in calculating the fastest way to avoid battles. In other words, should I menu glitch, stutter (sometimes not possible, easy to see when it is or not possible) or accept+escape a battle.
So, I want to know the fastest way through the segment I just posted above. Ideally we will need to optimise the data not just for one segment but for the entire game.
Anyone that can give ideas on how to accomplish this?