|
Cute Chess
0.1
|
Time controls of a chess game. More...
#include <timecontrol.h>
Public Member Functions | |
| int | activeTimeLeft () const |
| bool | expired () const |
| int | expiryMargin () const |
| void | initialize () |
| bool | isInfinite () const |
| bool | isValid () const |
| int | lastMoveTime () const |
| int | movesLeft () const |
| int | movesPerTc () const |
| qint64 | nodeLimit () const |
| bool | operator== (const TimeControl &other) const |
| int | plyLimit () const |
| void | readSettings (QSettings *settings) |
| void | setExpiryMargin (int expiryMargin) |
| void | setInfinity (bool enabled=true) |
| void | setMovesLeft (int movesLeft) |
| void | setMovesPerTc (int movesPerTc) |
| void | setNodeLimit (qint64 nodes) |
| void | setPlyLimit (int plies) |
| void | setTimeIncrement (int increment) |
| void | setTimeLeft (int timeLeft) |
| void | setTimePerMove (int timePerMove) |
| void | setTimePerTc (int timePerTc) |
| void | startTimer () |
| TimeControl () | |
| TimeControl (const QString &str) | |
| int | timeIncrement () const |
| int | timeLeft () const |
| int | timePerMove () const |
| int | timePerTc () const |
| QString | toString () const |
| QString | toVerboseString () const |
| void | update (bool applyIncrement=true) |
| void | writeSettings (QSettings *settings) |
Time controls of a chess game.
TimeControl is used for telling the chess players how much time they can spend thinking of their moves.
| TimeControl::TimeControl | ( | ) |
Creates a new time control with invalid default settings.
| TimeControl::TimeControl | ( | const QString & | str | ) |
Creates a new time control from a string.
str must either be "inf" for infinite time, or it can use the format: movesPerTc/timePerTc+timeIncrement
Example 1 (40 moves in 120 seconds): TimeControl("40/120");
Example 2 (same as example 1, 40 moves in 2 minutes): TimeControl("40/2:0");
Example 3 (whole game in 2.5 minutes plus 5 sec increment): TimeControl("2:30+5");
Example 4 (infinite thinking time): TimeControl("inf");
| int TimeControl::activeTimeLeft | ( | ) | const |
Returns the time left in an active clock.
The TimeControl object doesn't know whether the clock is active or not. It's recommended to check the player's state first to verify that it's in the thinking state.
| bool TimeControl::expired | ( | ) | const |
Returns true if the allotted time has expired.
| int TimeControl::expiryMargin | ( | ) | const |
Returns the expiry margin.
Expiry margin is the amount of time a player can go over the time limit without losing on time. The default value is 0.
| void TimeControl::initialize | ( | ) |
Initializes the time control ready for a new game.
| bool TimeControl::isInfinite | ( | ) | const |
Returns true if the time control is infinite.
| bool TimeControl::isValid | ( | ) | const |
Returns true if the time control is valid.
| int TimeControl::lastMoveTime | ( | ) | const |
Returns the last elapsed move time.
| int TimeControl::movesLeft | ( | ) | const |
Returns the number of full moves left in the time control, or 0 if the number of moves is not specified.
| int TimeControl::movesPerTc | ( | ) | const |
Returns the number of moves per time control, or 0 if the whole game is played in timePerTc() time.
| qint64 TimeControl::nodeLimit | ( | ) | const |
Returns the node limit for each move.
| bool TimeControl::operator== | ( | const TimeControl & | other | ) | const |
Returns true if other is the same as this time control.
The state of a game (eg. time left, used time, the expiry flag) and the expiry margin are ignored.
| int TimeControl::plyLimit | ( | ) | const |
Returns the maximum search depth in plies.
| void TimeControl::readSettings | ( | QSettings * | settings | ) |
Reads time control settings from settings.
| void TimeControl::setExpiryMargin | ( | int | expiryMargin | ) |
Sets the expiry margin.
| void TimeControl::setInfinity | ( | bool | enabled = true | ) |
If enabled is true, infinite time control is enabled; otherwise it is disabled.
| void TimeControl::setMovesLeft | ( | int | movesLeft | ) |
Sets the number of full moves left in the time control.
| void TimeControl::setMovesPerTc | ( | int | movesPerTc | ) |
Sets the number of moves per time control.
| void TimeControl::setNodeLimit | ( | qint64 | nodes | ) |
Sets the node limit.
| void TimeControl::setPlyLimit | ( | int | plies | ) |
Sets the maximum search depth in plies.
| void TimeControl::setTimeIncrement | ( | int | increment | ) |
Sets the time increment per move.
| void TimeControl::setTimeLeft | ( | int | timeLeft | ) |
Sets the time left in the time control.
| void TimeControl::setTimePerMove | ( | int | timePerMove | ) |
Sets the time per move.
| void TimeControl::setTimePerTc | ( | int | timePerTc | ) |
Sets the time per time control.
| void TimeControl::startTimer | ( | ) |
Start the timer.
| int TimeControl::timeIncrement | ( | ) | const |
Returns the time increment per move.
| int TimeControl::timeLeft | ( | ) | const |
Returns the time left in the time control.
| int TimeControl::timePerMove | ( | ) | const |
Returns the time per move.
The player will think of each move this long at most. Returns 0 if there's no specified total time.
| int TimeControl::timePerTc | ( | ) | const |
Returns the time per time control, or 0 if there's no specified total time.
| QString TimeControl::toString | ( | ) | const |
Returns the time control string in PGN format.
| QString TimeControl::toVerboseString | ( | ) | const |
Returns a verbose description of the time control.
| void TimeControl::update | ( | bool | applyIncrement = true | ) |
Update the time control with the elapsed time. A move time increment will only be applied if applyIncrement is true. This is the default. Set this value to false if no increment is necessary for the current move, e.g. for a book move.
| void TimeControl::writeSettings | ( | QSettings * | settings | ) |
Writes this time control to settings.
1.8.11