Tarrasch Chess GUI / src / GameLifecycle.h

/****************************************************************************
 * Manage game life cycle - i.e. detect end of game, so new game can start
 *  Author:  Bill Forster
 *  Licence: See licencing information in ChessPosition.cpp
 *  Copyright 2010, Triple Happy Ltd.  All rights reserved.
 ****************************************************************************/
#ifndef GAMELIFECYCLE_H
#define GAMELIFECYCLE_H
#include "ChessRules.h"
#include "wx/wx.h"

enum GAME_RESULT
{
    RESULT_NONE = 0,
    RESULT_WHITE_CHECKMATED,
    RESULT_BLACK_CHECKMATED,
    RESULT_WHITE_RESIGNS,
    RESULT_BLACK_RESIGNS,
    RESULT_WHITE_LOSE_TIME,
    RESULT_BLACK_LOSE_TIME,
    RESULT_DRAW_WHITE_STALEMATED,
    RESULT_DRAW_BLACK_STALEMATED,
    RESULT_DRAW_AGREED,
    RESULT_DRAW_50MOVE,
    RESULT_DRAW_INSUFFICIENT,
    RESULT_DRAW_REPITITION
};

class GameLifecycle
{
public:
    GameLifecycle()                     {this->result = RESULT_NONE; this->human_is_white = true;}
    void Begin( bool human_is_white )   {this->result = RESULT_NONE; this->human_is_white = human_is_white;}
    void Swap()                   {this->human_is_white = !this->human_is_white;}
    void Set( GAME_RESULT result )      {this->result = result;}
    GAME_RESULT Get()             { return this->result;}
    bool CanHumanClaimDraw( GAME_RESULT &result );
    bool TestResult( wxString &txt );    // returns true if game is over
    bool human_is_white;
    GAME_RESULT result;
};

#endif // GAMELIFECYCLE
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.