Sunday, April 19, 2015

Defensive Switching

I have begun to work on developing the AI for playing Pokemon. The first step that I have taken is to try and familiarize my self with CoffeeScipt, as that is the language with which the simulator has been developed. To do so, I decided to create a few different AI that can be used within the simulator.

http://coffeescript.org/

The first AI I created one, dubbed "Strategy: 1", uses the AI of the first several games, namely use a random attack. This strategy was easy in concept, but proved more difficult to actually code, simply due to lack of familiarity with CoffeeScript. However, after a few initial issues the changes were successfully coded, and I moved on to a more advanced AI.

The second AI, would scan all possible attacks and select the best one to use against the current opponent. This includes taking in the opponent's type, health, and speed. It also implements the user's type, primary attack attribute, condition, and the move's power, accuracy, and extra effects. This AI was a little more difficult to create, but the simulator came with some methods built in that eased the coding. The left side of this image shows the result of a battle between two of these AI.


Afterwards, I set about making an AI that would switch out a pokemon that was in danger of being defeated for a more defensive pokemon. This proved to be much more difficult to do that the previous AIs, primarily because this began to predict what action would be taken by the opponent. This AI is reliant upon the the second, or at least a semi informed AI, that will be making attacks against the current pokemon in order to be effective. This AI is most similar to the AI within current pokemon games.

Below on the left section of code is how the AI's determine which AI method to use. The right side includes a bit of the code for the third AI's switching capabilities.


By the end of this next week I hope to finish developing a fourth AI which will be predicting the opponents moves. The following week I hope to create a human controlled component, with which I can directly test the fourth AI. This will allow me to test the AI against a real opponent, and tweak it for optimization.

No comments:

Post a Comment