Excuse my double post but; I have been working on something like this for the past few days. The game I chose to (partially) brute force is Lufia II (the Catfish fight) since I'm very familiar with it's AI and such.
The first thing I did was building a simulator, which turned out to be able to simulate ~500000 battle rounds per second. However, now I was trying to make a program to actually test all possible actions using nested for loops, but somehow the different variables got mixed up :(.
I suppose I could post the code here if I add some more comments to it, but I was wondering if someone could give me some generic advice on actually building such a program.
PS: I worked in Java since that's the only language I'm (somewhat) familiar with.
Edit: Here is the bruteforce method I constructed. state[] is an array containing the entire statespace for all rounds (maxim's health, catfish' health, RNG state etc). This statespace also contains the variable 'result' which contains the outcome of that particular round (0= no one died, 1= Maxim died, 2= Catfish died; no item drop, 3= Catfish died; Jewel dropped). The method state[round].action(i) perform action #i (0= defend, 1= attack, 2= dive, 3= boomerang, 4= potion) and stores the result in that same array.
Anyways, when executing this method all goes well untill the third round. When Maxim defends 3 times in a row he dies, so the next action for that partical round should be tried. However, when trying the other action in round 3, Maxim's health is still at 0 meaning the statespace was not reloaded.
Here's the method, but please keep in mind I'm a programming novice.
private void testallactions(int round){ // round=1 to start at round 1
for(int i=0;i<5;i++){ // loop through all possible actions
state[round]=state[round-1]; // load last round's state
state[round].action(i); // execute action #i
command[round]=i; // log the executed action
if(state[round].result==0 && round<maxround){ // no one died and max roundnumber is not reached
testallactions(round+1); // test all possible actions in the next round
}else{
for(int j=1;j<=round;j++){
System.out.print(command[j] + " "); // print all executed actions
}
if(state[round].result==1){ // maxim died
System.out.println("Maxim died.");
}else if(state[round].result==2){ // catfish died, no jewel
System.out.println("Catfish died - no jewel.");
}else if(state[round].result==3){ // catfish died, jewel dropped
System.out.println("Catfish died - jewel dropped.");
}
} // try next action
}
}