Esempio n. 1
0
        public void StartAiMove()
        {
            Debug.Assert(AiState == ChessAiState.WaitingToStart);
            AiState = ChessAiState.WaitingForWorker;

            // todo: execute ai work on a separate thread
            var key = new ChessAiAsyncTurnKey();

            AiFuture = new ChessAiMoveResult();
            AsyncMoveAiSimple(key, AiFuture);
        }
Esempio n. 2
0
        public void AsyncMoveAiSimple(ChessAiAsyncTurnKey key, ChessAiMoveResult result)
        {
            Debug.Assert(AiState == ChessAiState.WaitingForWorker);
            AiState = ChessAiState.InProgress;

            ChessPieceCoord from = null, to = null;
            var             moveResult = Logic.AsyncCalculateAiSimpleMove(key, ref from, ref to);

            result.SetResult(moveResult, from, to);

            AiState = ChessAiState.WaitingForFinish;
        }
Esempio n. 3
0
        public void AsyncMoveAiComplex(ChessAiAsyncTurnKey key, ChessAiMoveResult result)
        {
            Debug.Assert(AiState == ChessAiState.WaitingForWorker);
            AiState = ChessAiState.InProgress;

            ChessPieceCoord from = null, to = null;
            uint            counter    = 0;
            var             moveResult = Logic.AsyncCalculateAiComplexMove(key, ref from, ref to, ref counter);

            result.SetResult(moveResult, from, to);
            result.ProfilingCounter = counter;

            AiState = ChessAiState.WaitingForFinish;
        }