Beispiel #1
0
        public ChessGame(
            IBoardEngineProvider <ChessPieceEntity> boardEngineProvider,
            ICheckDetectionService checkDetectionService,
            IBoardSetup <ChessPieceEntity> setup,
            Colours whoseTurn = Colours.White)
        {
            _engine = boardEngineProvider.Provide(setup, (int)whoseTurn);

            _checkDetectionService = checkDetectionService;
            _engine.CurrentPlayer  = (int)whoseTurn;
            CheckState             = _checkDetectionService.Check(BoardState);
        }
Beispiel #2
0
        private string PlayValidMove(BoardMove move)
        {
            ClearPawnTwoStepState();

            var preMove = _engine.BoardState.ToTextBoard();

            _engine.Move(move);

            if (preMove == _engine.BoardState.ToTextBoard())
            {
                Debugger.Break();
            }

            _engine.CurrentPlayer = (int)NextPlayer();
            CheckState            = _checkDetectionService.Check(BoardState);

            return(CheckState != GameCheckState.None
                ? CheckState.ToString()
                : "");
        }