Post subject: Designing an AI program to battle with random pokemon
Joined: 5/30/2005
Posts: 98
I always liked playing challenge cup battles in netbattle so I thought it might be interesting to design an AI that can play them as well. Since I don't have much programming experience I am not actually going to make this program. I am just laying the framework so if I ever learn more about programing or someone else wants to help me they can make this AI more easily. The first thing to look at when you start a battle is your options per turn. You can either choose 1 of 4 moves or switch to 1 of 5 pokemon. This gives you 9 moves total. As your pokemon faint the number of moves you have decrease since you can't switch to a fainted pokemon. When choosing a move the most obvious choice is to choose the move that does the most damage. Sometimes that isn't always the best option though. The AI would need some way to recognize when it is the best option and when it isn't but I am not sure how it would do this. When deciding to switch the AI would have to carefully analyze the enemy pokemon. It would have to look at all of the moves the pokemon had and figure out what the probability of it having each one is. In challenge cup a pokemon is more likely to have moves that do damage compared to moves that don't do damage since each challenge cup pokemon is required to have at least one of these types of moves. Then based on this information it would calculate the percent chance it would recieve 1 percent damage, 2 percent, 3 percent, etc. If the percent chance it would recieve over 33 percent damage was very high the pokemon would probably be better off switching. Then it would switch to a pokemon who would most likely recieve a low amount of damage. For example say the AI had a water type out and the opponent switched to an electric type. Since the opponent switched to an electric type it probably also has an electric move and there are a bunch of electric moves in its move pool. Because of this the AI would switch to a ground type. I don't really think I can come up with much more and the amount of information I have came up with so far isn't anywhere near enough to build a good AI. I think the difficulty of making this AI will fall somewhere between the difficulty of designing a checkers AI and the difficulty designing a chess AI. The most difficult part is probably going to be figuring out when it switch.
Joined: 6/26/2007
Posts: 147
As a CS person, lemme assure you that this is much easier than a checkers AI. The predicted next outcome can be evaluated without thinking ahead more than one move. There's actually a more difficult problem in choosing the team to use.
Joined: 3/7/2006
Posts: 720
Location: UK
It's a bit more complicated than that. Many experienced trainers will try and predict switches; if you switched to your ground pokemon vs. the electric, you would probably quickly find out it also has Aerial Ace or something equally annoying. Just about every pokemon can learn moves which are offtype and still do significant damage with them, and the most versatile (Hidden Power) can be any element you want. I agree, switching is going to be the most difficult part. To be effective, the AI will have to calculate roughly what the opponent's pokemon is. Educated guessing can get 50% or more of the moveset and item (and further observation improves), while guessing EVs is a bit more difficult. You'd have to reverse-calculate its Speed from whether it goes before you, its Attack from how much damage it hits you for, etc. At first this will be a range of values, but you can probably narrow it down to within 2 or 3 stat-points. This will help developing a strategy against it immensely. As for 'what move do I pick', the AI would first have to work out what its own moveset is meant to do. You could pre-define this, but it would be better if it could work it out itself. Once that's done, check for simple cases like "opponent has 1 pokemon left and I can kill it" or "opponent is trapped, badly poisoned and I have Detect". Most of that time that will fall through and you'll go to the next step, "is my opponent going to switch? what will he switch to? what do I do then?" Difficult question - especially the second part if you don't know their party beforehand. Next would be "how do I execute my moveset's strategy?" This part is relatively simple. :) I wish you luck! I did a bit of analysis on this myself, but didn't get to the programming stage.
Voted NO for NO reason
Mitjitsu
He/Him
Banned User
Joined: 4/24/2006
Posts: 2997
Theoretically, the AI could just wait for the player to make a move and then use the best tactic based on the oponents choice. Although you usually know at least two moves of what the other pokemon will have and you can make certain stat based decisions on knowing what the max stats are for each pokemon so crucial descisions based on who attacks first can be deciphered.
Joined: 5/30/2005
Posts: 98
Well its good to know this AI would be less complicated than checkers especially since checkers has been solved recently. Is there any game that has been studied extensively that you could compare pokemons complexity to. LagDotCom what your describing is a very complicated type of switching strategy. I want to start with the simplest strategies first and then move on to the more complex ones. Also alot of the other stuff you described applies more to human created teams than randomly generated ones. AKA thats an interesting idea. If I wanted to simplify this AI I could just wait for the opponent to make a move first and then give that information to the AI. The problem with this is it kind of feels like the AI is cheating since when humans are battling they don't get access to this type of information. Also if the AI decided to battle itself as soon as the match started the AI would endlessly wait for the other AI to make a move since they are both programed to go second.