Bitboard-based representation of a Connect-4 position. More...
#include <array>#include <cassert>#include <cstddef>#include <cstdint>#include <iostream>#include <map>#include <random>#include <sstream>#include <vector>#include "MoveList.h"Go to the source code of this file.
Classes | |
| class | BitBully::Board |
| Connect-4 position represented as a pair of 64-bit bitboards. More... | |
| struct | BitBully::Board::RawState |
| Plain-data snapshot of the board's internal state. More... | |
Namespaces | |
| namespace | BitBully |
| Top-level namespace for the BitBully Connect-4 engine. | |
Macros | |
| #define | uint64_t_popcnt popCountBoard |
| Portable fallback popcount when no compiler intrinsic is available. | |
Functions | |
| int | ctz_u64 (uint64_t x) |
| Count trailing zero bits of a 64-bit integer. | |
| std::vector< int > | bits_set (uint64_t x) |
| Decompose a bitboard into the indices of its set bits. | |
Variables | |
| constexpr int | BitBully::CHAR_BIT = 8 |
| Number of bits per byte (defined locally if not provided by the platform). | |
Bitboard-based representation of a Connect-4 position.
Defines the BitBully::Board class together with a handful of compile-time helpers (bit masks, popcount, count-trailing-zeros) used by the solver. The encoding follows the "split bitboard" scheme made popular by John Tromp's Fhourstones: a single 64-bit word holds all occupied cells of a 7×6 grid, plus an extra "sentinel" row that is never set during play but is used to detect overflowing column appends in constant time.
Definition in file Board.h.
| #define uint64_t_popcnt popCountBoard |
|
inline |
Decompose a bitboard into the indices of its set bits.
Walks the input from the least to the most significant bit, clearing one bit at a time using x &= x - 1. The result is sorted in ascending bit order.
| x | Bitboard whose set bits should be enumerated. |
x. Definition at line 93 of file Board.h.
|
inline |
Count trailing zero bits of a 64-bit integer.
Returns the bit index of the least significant set bit. The function uses the most efficient implementation available for the current toolchain (_BitScanForward64 on MSVC, __builtin_ctzll on GCC/Clang) and falls back to a portable loop otherwise.
| x | Non-zero 64-bit input. Calling with x == 0 is undefined for the intrinsic variants. |
Definition at line 66 of file Board.h.