Skip to content

♟️ evolutionary algorithm to help learn how to play chess better

License

Notifications You must be signed in to change notification settings

itsjoekent-archive/chess-evolutionary-algo

Repository files navigation

chess-evolutionary-algo

♟️ An evolutionary algorithm to help me learn how to play chess better.

Abstract

Neural networks are the most popular method for developing modern chess bots. Stockfish and AlphaZero, some of the strongest chess bots currently known, rely on neural networks and the Monte Carlo search tree. The problem with this approach is I can't reverse engineer why the computer made a particular move. These AI systems are a "black box".

By contrast, evolutionary algorithms can generate an output we can more easily reverse engineer or visualize. In the case of this specific project, I'm evolving a mathematical equation which evaluates what chess move to make.

While evolutionary algorithms are different from neural networks in a number of important aspects, evolutionary algorithms still rely on the concept of "training" the computer to search a problem space for an optimal solution.

Local Development

Install Node Version Manager.

$ nvm install && nvm use
$ npm ci

# Run engine tests
$ npm test -w @chess-evolutionary-algo/pattern-engine

If you need to debug chess boards with fen syntax, use the lichess chess editor. You can import a pgn here.

Running In The Cloud

I've included a Terraform file that will deploy this project to Digital Ocean.

First, install Terraform CLI,

$ brew tap hashicorp/tap
$ brew install hashicorp/tap/terraform

Copy the example .env file and fill out the values. See the inline comments on how to fill out the different values.

$ cp .env.example .env

Finally, create the infrastructure,

$ cd terraform
$ terraform init

# If you want to preview what is being created
$ terraform plan

$ terraform apply

By default, this will create three s-4vcpu-8gb vm's in the nyc3 region, which are $0.07143/hour (~$48/month). If you want to change these defaults, you can supply the following arguments when running terraform,

$ terraform apply -var machine_count="3" -var machine_count="s-4vcpu-8gb"

To get a list of possible droplet sizes, run the following command,

$ doctl compute size list

When you're done experimenting, run the following the delete your infrastructure resources,

$ terraform destroy

Contributing

I am not actively seeking contributions to this repository, but feel free to fork it and make your own changes.

This project is MIT Licensed.

About

♟️ evolutionary algorithm to help learn how to play chess better

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published