Inspiration

We were inspired to make a chess AI after learning about the relevant concepts in an intro to AI class. We also really like chess, so making a chess AI seemed pretty fun.

What it does

It allows the user to play against a chess bot, which looks ahead a few moves and calculates the most optimal move given what the player moves.

How we built it

The front end is made with HTML/CSS and Javascript. The backend, or the AI part, is made through Node.js, and the server is hosted on an EC2 instance on AWS. The core algorithm of the AI is a minmax search, and it uses alpha beta pruning and an optimal evaluation function to reduce the number of nodes searched.

Challenges we ran into

Figuring out what needed to be communicated between the front end and back end. Finding a good library for chess move generation and validation. Creating an efficient AI that searches deep enough in a feasible amount of time (this was solved with alpha beta pruning, tweaking the evaluation function, and keeping track of past board states). Facilitating the user input in the front end to keep track of which pieces are moved. Hosting the backend on an EC2 instance and utilizing an SSL certified .tech domain to be able to make requests to it.

Accomplishments that we're proud of

Just getting the AI to work and be able to play a full game with the player is something we are very proud of. Not only that, but this AI works fairly well, as I have a negative record against it. We are also proud of figuring out the hosting part of it, as we learned how to deploy a full stack app through hosting the backend on a AWS EC2 instance, which we've never done before. This means that anyone can play against our bot as long as they have the website url.

What we learned

As aforementioned, we learned how to deploy a full stack app through AWS. We also learned how to improve the efficiency of a minmax search, where we learned to take into consideration of many factors to increase the speed of the algorithm.

What's next for Cagnus Marlsen (Chessbot AI)

Improving the AI by allowing it to search deeper moves and in a short amount of time. Add multiplayer functionality. Make it so that the backend doesn't slow down when multiple people are playing the bot at the same time.

Share this project:

Updates