nth-eye / c4

Connect4 game environment in C++ which uses bitboards

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

c4

Minimalistic Connect4 C++20 game environment which uses as little resources as possible with the help of bitboards. By rewriting input() and print() functions in Interface, the engine can be integrated in any specific environment and device.

Board representation

        +-------------------+
        | 0 0 0 0 0 0 0 0 1 | <-- 63 bit
row 5	| 1 1 1 1 1 1 1 0 0 |
row 4	| 1 1 1 1 1 1 1 0 0 |
row 3	| 1 1 1 1 1 1 1 0 0 |
row 2	| 1 1 1 1 1 1 1 0 0 |
row 1	| 1 1 1 1 1 1 1 0 0 |
row 0	| 1 1 1 1 1 1 1 0 0 | <-- 56 bit
        +-------------------+
          |           |
          0 bit       42 bit

Last bit represents current player. 0x0 is X and 0x8000000000000000 is O.

How to use

#include "c4/interface.h"
...
c4::Interface{}.play();

About

Connect4 game environment in C++ which uses bitboards

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:C++ 92.7%Language:CMake 7.3%