Esempio n. 1
0
        private void initializePgn()
        {
            PGN.Variant = Game.GameAttribute.GameName;
            string currentPlayer = Game.FEN["current player"];

            PGN.SetStartingFenString(currentPlayer == "w" ? 0 : 1, m_startingFen);
            PGN.Date = DateTime.Now.ToString("yyyy.MM.dd");
            PGN.SetPlayerName(0, m_player[0].Name);
            PGN.SetPlayerName(1, m_player[1].Name);
            PGN.Result = Result;

            if (m_timeControl[0] == m_timeControl[1])
            {
                PGN.SetTag("TimeControl", m_timeControl[0].ToString());
            }
            else
            {
                PGN.SetTag("WhiteTimeControl", m_timeControl[0].ToString());
                PGN.SetTag("BlackTimeControl", m_timeControl[1].ToString());
            }
        }
Esempio n. 2
0
        public void Stop()
        {
            if (IsFinished)
            {
                return;
            }

            //	Don't actually cancel the game if both players are either
            //	HumanPlayer or InternalEngine so that we can still take back
            //	moves and keep playing.
            if ((m_player[0] is HumanPlayer || m_player[0] is InternalEngine) &&
                (m_player[1] is HumanPlayer || m_player[1] is InternalEngine))
            {
                return;
            }

            IsFinished = true;
            //	raise HumanEnabled event
            HumanEnabled(false);
            if (!m_gameInProgress)
            {
                Result = new Result();
                finish();
                return;
            }

            m_gameInProgress = false;
            PGN.SetTag("PlyCount", PGN.Moves.Count.ToString());
            PGN.Result = Result;
            PGN.SetResultDescription(Result.Description);

            m_player[0].EndGame(Result);
            m_player[1].EndGame(Result);

            PlayersReady += finish;             // connect(this, SIGNAL(playersReady()), this, SLOT(finish()), Qt::QueuedConnection);
            syncPlayers();
        }