Has anyone ever attempted to decompile the code for a Pokemon game and figure out how the battle AI works? e.g. How it decides which move to use, or use a Potion/even withdraw based on the current state of the game. I'm very interested in how it works because I would like to build my own battle AI as part of a research project.
There is a project to disassemble the Pokemon games at https://github.com/pret. As a reference in Pokemon red, You can find the file that defines the trainer AI here https://github.com/pret/pokered/blob/master/engine/battle/trainer_ai.asm
Unfortunately this is all in assembly and I don't believe there is a translation to C at this stage.