BitBully 0.0.78
A fast, perfect-play Connect-4 engine in modern C++
Loading...
Searching...
No Matches
BitBully::MoveList Class Reference

Fixed-capacity priority queue tailored for Connect-4 move ordering. More...

#include <MoveList.h>

Public Types

using TBitBoard = uint64_t
 64-bit bitboard type (mirrors the alias defined in Board.h).

Public Member Functions

void insert (const TBitBoard move, const int score)
 Insert a (move, score) pair while keeping the queue sorted.
TBitBoard pop ()
 Remove and return the highest-priority move.
unsigned int getSize () const
 Number of moves currently stored.
void reset ()
 Empty the queue without freeing any memory.
 MoveList ()
 Construct an empty move list.

Static Public Attributes

static constexpr int N_COLUMNS = 7
 Maximum number of moves the queue can hold.

Detailed Description

Fixed-capacity priority queue tailored for Connect-4 move ordering.

The queue holds at most N_COLUMNS entries (one per column) using a stack-allocated array. insert() performs an insertion sort by ascending score so that pop() can return the highest-scoring entry in O(1). When two entries share the same score the FIFO order of insertion is preserved.

Definition at line 24 of file MoveList.h.

Member Typedef Documentation

◆ TBitBoard

64-bit bitboard type (mirrors the alias defined in Board.h).

Definition at line 28 of file MoveList.h.

Constructor & Destructor Documentation

◆ MoveList()

BitBully::MoveList::MoveList ( )
inline

Construct an empty move list.

Definition at line 62 of file MoveList.h.

Member Function Documentation

◆ getSize()

unsigned int BitBully::MoveList::getSize ( ) const
inline

Number of moves currently stored.

Definition at line 56 of file MoveList.h.

◆ insert()

void BitBully::MoveList::insert ( const TBitBoard move,
const int score )
inline

Insert a (move, score) pair while keeping the queue sorted.

Parameters
moveBitboard with exactly one bit representing the move.
scorePriority score; higher values are popped first.

Definition at line 39 of file MoveList.h.

Here is the caller graph for this function:

◆ pop()

TBitBoard BitBully::MoveList::pop ( )
inline

Remove and return the highest-priority move.

Returns
The bitboard mask of the move, or 0 if the queue is empty.

Definition at line 51 of file MoveList.h.

Here is the caller graph for this function:

◆ reset()

void BitBully::MoveList::reset ( )
inline

Empty the queue without freeing any memory.

Definition at line 59 of file MoveList.h.

Member Data Documentation

◆ move

TBitBoard BitBully::MoveList::move

Single-bit move mask.

Definition at line 75 of file MoveList.h.

◆ N_COLUMNS

int BitBully::MoveList::N_COLUMNS = 7
staticconstexpr

Maximum number of moves the queue can hold.

Definition at line 32 of file MoveList.h.

◆ score

int BitBully::MoveList::score

Priority score.

Definition at line 76 of file MoveList.h.


The documentation for this class was generated from the following file: