示例#1
0
        public Match(Game game, PGNGame pgn, IDebugMessageLog messageLog, TimerFactory timerFactory)
        {
            Game             = game;
            StartDelay       = 0;
            IsFinished       = false;
            m_gameInProgress = false;
            m_paused         = false;
            PGN            = pgn;
            Moves          = new List <Movement>();
            m_timerFactory = new TimerFactory();
            m_startTimer   = timerFactory.NewTimer();
            m_timeControl  = new TimeControl[2];
            m_messageLog   = messageLog;
            Adjudicator    = new GameAdjudicator();

            m_player    = new Player[2];
            m_adaptor   = new EngineGameAdaptor[2];
            m_book      = new OpeningBook[2];
            m_bookDepth = new int[2];
            for (int i = 0; i < 2; i++)
            {
                m_player[i]    = null;
                m_book[i]      = null;
                m_bookDepth[i] = 0;
            }

            HumanEnabled = delegate { };
            Started      = delegate { };
            FENChanged   = delegate { };
            MoveMade     = delegate { };
            Finished     = delegate { };
        }
示例#2
0
        public void SetMoves(PGNGame pgn)
        {
            //Q_ASSERT(pgn.variant() == m_board->variant());

            StartingFen = pgn.StartingFEN;
            resetBoard();
            Moves.Clear();

            foreach (PGNGame.MoveData md in pgn.Moves)
            {
                Movement move = md.Move;
                //Q_ASSERT(m_board->isLegalMove(move));

                Game.MakeMove(move, true);
                if (!Game.Result.IsNone)
                {
                    return;
                }

                Moves.Add(move);
            }
        }