Skip to content
This repository has been archived by the owner on Jan 7, 2022. It is now read-only.

Connect Four in Elixir with bitboards and Monte Carlo Tree Search AI

License

Notifications You must be signed in to change notification settings

rjdellecese/connect_four_umbrella

Repository files navigation

Connect Four w/ MCTS AI CircleCI Coverage Status

This is an implementation of John Tromp's very efficient Connect Four board logic code (read more about it here), coupled with a Monte Carlo Tree Search (MCTS) "AI" and a CLI for playing against it in the terminal.

The Monte Carlo Tree Search uses the UCT algorithm in the selection phase, and uniformly random moves in the simulation phase. It rebuilds the whole tree on each move, and doesn't employ any parallelization strategies while searching. Even so, it plays very well!

Play against it

Gitpod ready-to-code

To play against it in your browser, right now, you can use Gitpod to launch a temporary dev environment containing a terminal with the CLI running by clicking on the badge above.

Setting up the project

  1. Make sure you have Elixir and Erlang installed (you can find the required versions in the .tool-versions file)

  2. Clone the repo

    git clone https://github.com/rjdellecese/connect_four.git
    cd connect_four
  3. From the root of the project, download the dependencies

    mix deps.get

Tests

Run the tests with

mix test

CLI

To play against the MCTS AI, cd into the CLI app, build the escript executable, and then run it

cd apps/cli
mix escript.build
./cli

Questions?

If you have any questions about how any of this works, please feel free to open an issue and I'll be happy to respond!

About

Connect Four in Elixir with bitboards and Monte Carlo Tree Search AI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published