Connect Four CircleCICoverage StatusHex.pmHex.pm

A fast, tiny Connect Four game engine.

Also provides a GenServer implementation, which could easily form the foundation of a Connect Four platform, or generally for any use requiring the ability to simulate multiple games simultaneously.

The ConnectFour.Game module provides the game logic, and the ConnectFour.GameServer module contains the GenServer implementation.

Read the documentation here.

Implementation

Connect Four games are stored as bitboards, with a tiny bit of metadata. This allows for move validation to be as fast as a few bitwise operations.

For a walkthrough of how it works, see this excellent guide. You can also view the original Java implementation that this is based on here.

Installation

Add to the dependencies in your mix.exs file.

def deps do
  [
    {:connect_four, "~> 1.0.0"}
  ]
end