|
Cute Chess
0.1
|
A suite of chess openings. More...
#include <openingsuite.h>
Public Types | |
| enum | Format { EpdFormat, PgnFormat } |
| enum | Order { SequentialOrder, RandomOrder } |
Public Member Functions | |
| Format | format () const |
| bool | initialize () |
| bool | isNull () const |
| PgnGame | nextGame (int maxPlies) |
| OpeningSuite (const QString &fen) | |
| OpeningSuite (const QString &fileName, Format format, Order order=SequentialOrder, int startIndex=0) | |
| Order | order () const |
| ~OpeningSuite () | |
A suite of chess openings.
This class acts as an abstract interface for accessing a suite of chess openings in EPD or PGN format. An OpeningSuite object reads positions and games from a text stream (eg. a text file) and returns the opening as a PgnGame object.
| enum OpeningSuite::Format |
| enum OpeningSuite::Order |
| OpeningSuite::OpeningSuite | ( | const QString & | fen | ) |
Creates a new opening suite that starts every game at fen.
| OpeningSuite::OpeningSuite | ( | const QString & | fileName, |
| Format | format, | ||
| Order | order = SequentialOrder, |
||
| int | startIndex = 0 |
||
| ) |
Creates a new opening suite that reads the openings from fileName in format format.
Openings will be picked according to order.
If order is SequentialOrder, startIndex will be the index of the first opening. If order is RandomOrder, then setting a start index does nothing.
| OpeningSuite::~OpeningSuite | ( | ) |
Destroys the opening suite.
| OpeningSuite::Format OpeningSuite::format | ( | ) | const |
Returns the format of the source data.
| bool OpeningSuite::initialize | ( | ) |
Initializes the opening suite.
If order is SequentialOrder, this function just opens the opening suite file and gets ready to read data. If order is RandomOrder, the file positions of all the openings are parsed from the file, which could take some time if the file is large.
Returns true if successful; otherwise returns false.
| bool OpeningSuite::isNull | ( | ) | const |
Returns true if the suite contains no data; otherwise returns false.
| PgnGame OpeningSuite::nextGame | ( | int | maxPlies | ) |
Reads a new opening from the suite and returns it. A maximum of maxPlies plies (halfmoves) are read.
| OpeningSuite::Order OpeningSuite::order | ( | ) | const |
Returns the order in which openings are picked.
1.8.11