BitBully 0.0.39
Loading...
Searching...
No Matches
GameSolver::Connect4::MoveSorter Class Reference

#include <MoveSorter.hpp>

Public Member Functions

void add (const Position::position_t move, const int score)
 
Position::position_t getNext ()
 
void reset ()
 
 MoveSorter ()
 

Detailed Description

This class helps sorting the next moves

You have to add moves first with their score then you can get them back in decreasing score

This class implement an insertion sort that is in practice very efficient for small number of move to sort (max is Position::WIDTH) and also efficient if the move are pushed in approximatively increasing order which can be acheived by using a simpler column ordering heuristic.

Definition at line 38 of file MoveSorter.hpp.

Constructor & Destructor Documentation

◆ MoveSorter()

GameSolver::Connect4::MoveSorter::MoveSorter ( )
inline

Build an empty container

Definition at line 74 of file MoveSorter.hpp.

Member Function Documentation

◆ add()

void GameSolver::Connect4::MoveSorter::add ( const Position::position_t move,
const int score )
inline

Add a move in the container with its score. You cannot add more than Position::WIDTH moves

Definition at line 45 of file MoveSorter.hpp.

◆ getNext()

Position::position_t GameSolver::Connect4::MoveSorter::getNext ( )
inline

Get next move

Returns
next remaining move with max score and remove it from the container. If no more move is available return 0

Definition at line 57 of file MoveSorter.hpp.

◆ reset()

void GameSolver::Connect4::MoveSorter::reset ( )
inline

reset (empty) the container

Definition at line 67 of file MoveSorter.hpp.

Member Data Documentation

◆ move

Position::position_t GameSolver::Connect4::MoveSorter::move

Definition at line 83 of file MoveSorter.hpp.

◆ score

int GameSolver::Connect4::MoveSorter::score

Definition at line 84 of file MoveSorter.hpp.


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