/c4solver

A solver for the connect4 game, in OCaml & Rust

Primary LanguageOCamlGNU Affero General Public License v3.0AGPL-3.0

c4solver

CI Actions Status Deploy odoc Actions Status

This is a toy project implementing a solver for the connect4 game, written in OCaml and Rust, based on Pascal Pons' original work.

Acknowledgements and License

The work in this repository is a replication of (the excellent) Pascal Pons' tutorial, which is published online there:

The original cpp source code behind the tutorial is published under AGPL v3 Licence and is available here:

The code in this repository is based on the original cpp code, by direct code translation, and/or further modified. Some documentation comments were kept as-is from the original, some new comments were added.

Moreover, we do import some of the testing resources used in the original repository, verbatim. See resources/.

We have kept the original AGPL v3 License for this repo as well.

Motivations

  • Pedagogic: Learn about the concepts involved - minimax, alpha-beta pruning, transposition tables, iterative deepening, etc.
  • Benchmark: Reproduce and compare performance results. Experiment with various code changes and witness their impact on performances, compare OCaml with Rust, etc.

Code documentation

The tip of the main branch is compiled with odoc and published to github pages here.

Completion status and roadmap

I'm not very actively working on this project, so the project progresses slowly. Currently the project implements 8 out of the 12 steps outlined in the tutorial. I plan on trying to continue progressing toward the following goals:

  • Implement all of 12 steps in OCaml and Rust;
  • Stabilize the bench results - currently multiple run may create large variations in the results;
  • Clean up the code, look for simple performance enhancements;
  • Write a basic summary of findings of comparing OCaml, Rust and cpp.