예제 #1
0
        //	Creates a new XboardEngine
        public XBoardEngine(IDebugMessageLog messageLog, TimerFactory factory, Process process) :
            base(messageLog, factory, process)
        {
            SupportedFeatures = new List <string>();
            forceMode         = false;
            drawOnNextMove    = false;
            ftName            = false;
            ftPing            = false;
            ftSetboard        = false;
            ftTime            = true;
            ftUsermove        = false;
            ftReuse           = true;
            ftNps             = false;
            gotResult         = false;
            lastPing          = 0;
            notation          = MoveNotation.XBoard;

            //	set up the init timer
            initTimer          = factory.NewTimer();
            initTimer.Interval = 8000;
            initTimer.Tick    += initialize;          // connect(m_initTimer, SIGNAL(timeout()), this, SLOT(initialize()));
            initTimer.Tick    += onSingleShotTimerTick;

            //	set up the finish game timer
            finishGameTimer          = factory.NewTimer();
            finishGameTimer.Interval = 200;
            finishGameTimer.Tick    += pong;
            finishGameTimer.Tick    += onSingleShotTimerTick;

            addVariant("normal");
            Name = "XboardEngine";
        }
예제 #2
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 { };
        }
예제 #3
0
 public InternalEngine(IDebugMessageLog messageLog, TimerFactory timerFactory) :
     base(messageLog, timerFactory)
 {
     Name                    = "ChessV";
     State                   = PlayerState.Idle;
     moveDelayTimer          = timerFactory.NewTimer();
     moveDelayTimer.Interval = 50;
     moveDelayTimer.Tick    += onTimerTick;
 }
예제 #4
0
        public Engine(IDebugMessageLog messageLog, TimerFactory timerFactory, Process process) :
            base(messageLog, timerFactory)
        {
            id           = s_count++;
            pingState    = PlayerState.NotStarted;
            isPinging    = false;
            WhiteEvalPov = false;
            Restart      = EngineConfiguration.RestartMode.Auto;
            writeBuffer  = new List <string>();
            options      = new List <EngineOption>();
            optionBuffer = new Dictionary <string, object>();
            Variants     = new List <string>();
            this.process = process;
            readBuffer   = new List <string>();

            //	set up ping timer
            pingTimer          = timerFactory.NewTimer();
            pingTimer.Interval = 10000;
            pingTimer.Tick    += onPingTimeout;
            pingTimer.Tick    += onSingleShotTimerTick;

            //	set up quit timer
            quitTimer          = timerFactory.NewTimer();
            quitTimer.Interval = 2000;
            quitTimer.Tick    += onQuitTimeout;
            quitTimer.Tick    += onSingleShotTimerTick;

            //	set up idle timer
            idleTimer          = timerFactory.NewTimer();
            idleTimer.Interval = 10000;
            idleTimer.Tick    += onIdleTimeout;
            idleTimer.Tick    += onSingleShotTimerTick;

            //	set up read timer
            readTimer          = timerFactory.NewTimer();
            readTimer.Interval = 55;
            readTimer.Tick    += onReadTimer;
        }
예제 #5
0
        // *** CONSTRUCTION *** //

        public Player(IDebugMessageLog messageLog, TimerFactory timerFactory)
        {
            State           = PlayerState.NotStarted;
            this.timer      = timerFactory.NewTimer();
            claimedResult   = false;
            ClaimsValidated = true;
            Game            = null;
            Opponent        = null;
            Evaluation      = new MoveEvaluation();
            MessageLog      = messageLog;
            DebugMessage   += onDebugMessage;

            StartedThinking += delegate { };
            StoppedThinking += delegate { };
            MoveMade        += delegate { };
        }