Inspiration

I had always been interested in making AI's that can analyze the game and make a calculated decision that it thinks will be most successful. I think it's amazing that you can create an AI that's better than you at a game of strategy and thinking. I also have always wanted to create a mobile app and while I had no experience with Android Studio, I thought of this as a great opportunity to become more familiar with it.

What it does

The app gives the user the option of playing Checkers against an AI opponent or playing multiplayer on the same screen. For the multiplayer option it is just a regular Checkers game. With the AI opponent selected the computer then utilizes the AI class to make a move based on the standing of the board. It gets every single possible move it can get and for each of those predicts the best move the opponent can make. To determine if a move is good or bad, it looks at the board post-move and calculates the board's "score" according to number of friendly and enemy pieces on the board with special weights for kings. After getting the best opponent move the AI the gets all possible moves it can make for each opponent move and finally get the board values and chooses the move that produces the highest board value. In basic terms, the AI looks three moves ahead in order to choose its next move.

How I built it

  • I first built the Checkers game solely with multiplayer in mind. After that I began work on the AI. I was hoping to spends more time perfecting it and making it a stronger opponent but I had to move on to creating the GUI because I knew I needed ample time to deal with android as I have never made an app before. Regardless, the AI was turned out surprisingly strong, so strong in fact that I had only been able to beat it once.

Challenges I ran into

  • One of the most time-consuming challenges I faced was returning all moves for each piece, specifically jump moves as you can jump multiple times with the same piece. I finally wrote a recursive function that I am very proud of that was able to get all jump moves for.
  • A second challenge was acquiring user input as I needed to convert (x, y) coordinates that measured pixels and turn them into integers between zero and 7 corresponding to each square on the checkerboard.
  • A third challenge was learning Android-specific coding that I had never worked with before, and making a GUI as well as getting input.

Accomplishments that I'm proud of

  • My AI able to look ahead three turns(and more in the future)
  • My recursive algorithm able to list all possible combinations of jump moves for any given piece

What I learned

  • I learned a lot about Android Studio and what goes into developing a mobile app
  • Solidified my knowledge on properly and effectively using recursion

What's next for Android Checkers game w/ AI

  • making the AI stronger by allowing it to look more than three steps ahead
  • revising and improving the appearance of the GUI

Built With

Share this project:

Updates