The AI

Work on the actual AI has begun now. But first we had to make a big decision on which approach to use. There are two main options:

  1. A purely reactionary AI, with all strategies hardcoded.
  2. A more advanced AI that can learn from its mistakes, invent new things on the fly etc.

Each option has its pros and cons:

  1. A reactional AI is easy to create – just put your own strategies into code. It basically looks like hundreds of if-statements about the position and velocity of the ball and the players. If something doesn’t work, you can pinpoint the exact line where it fails and correct it. On the other hand, if the opponent figures out a way to outsmart the AI, it will have no chance of winning since it doesn’t learn from its mistakes.
  2. This is very difficult to create. You have to come up with a system that can learn from it’s own mistakes and it has to be general enough to cover all situations in the game. It’s not at all obvious how to do this. A neural network could be an idea but the downfall of this, we think, is that an error in the code or simply a wrong approach to the whole thing would be difficult to find and correct. If we could get it to work however, it would have the potential to be much better than the reactional AI.

We decided to use option 1. Our reason is that option 2 is too risky. We could easily end up not having a working AI at all when our project is due. With option 1 we are sure that the AI can play, at least to some degree.

Also, by recording the number of successes and failures of different strategies – both the strategies that the AI and its opponent uses, a reactional AI can learn at least a little bit. Not much but perhaps enough to seem like an intelligence and not just a bunch of if-statements.

Leave a Reply