Cute Chess  0.1
Classes | Public Types | Public Member Functions | List of all members
Sprt Class Reference

A Sequential Probability Ratio Test. More...

#include <sprt.h>

Classes

struct  Status
 

Public Types

enum  GameResult { NoResult, Win, Loss, Draw }
 
enum  Result { Continue, AcceptH0, AcceptH1 }
 

Public Member Functions

void addGameResult (GameResult result)
 
void initialize (double elo0, double elo1, double alpha, double beta)
 
bool isNull () const
 
 Sprt ()
 
Status status () const
 

Detailed Description

A Sequential Probability Ratio Test.

The Sprt class implements a Sequential Probability Ratio Test (SPRT) that can be used as a termination criterion for stopping a match between two players when the Elo difference is known to be outside of the specified interval.

See also
http://en.wikipedia.org/wiki/Sequential_probability_ratio_test

Member Enumeration Documentation

◆ GameResult

The result of a chess game.

Enumerator
NoResult 

Game ended with no result.

Win 

First player won.

Loss 

First player lost.

Draw 

Game was drawn.

◆ Result

The result of the test.

Enumerator
Continue 

Continue monitoring.

AcceptH0 

Accept null hypothesis H0.

AcceptH1 

Accept alternative hypothesis H1.

Constructor & Destructor Documentation

◆ Sprt()

Sprt::Sprt ( )

Creates a new uninitialized Sprt object.

Member Function Documentation

◆ addGameResult()

void Sprt::addGameResult ( GameResult  result)

Updates the test with result.

After calling this function, status() should be called to check if H0 or H1 can be accepted.

◆ initialize()

void Sprt::initialize ( double  elo0,
double  elo1,
double  alpha,
double  beta 
)

Initializes the SPRT.

elo0 is the Elo difference between player A and player B for H0 and elo1 for H1.

alpha is the maximum probability for a type I error and beta for a type II error outside interval [elo0, elo1].

◆ isNull()

bool Sprt::isNull ( ) const

Returns true if the SPRT is uninitialized; otherwise returns false.

◆ status()

Sprt::Status Sprt::status ( ) const

Returns the current status of the test.


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