Exemple #1
0
        private Board()
        {
            _playingPieces = new Dictionary <Color, IList <Piece> >
            {
                { Color.Black, new List <Piece>() },
                { Color.White, new List <Piece>() }
            };

            _movesSet  = new MovesSet();
            _kingsDict = new Dictionary <Color, King>();

            NextMoveTurn            = Color.White;
            _infoAsker              = GetPieceAsker();
            _moveFactory            = new ValidMoveFactory(_infoAsker);
            _position               = CreatePosition();
            _timerManager           = InitTimeManager();
            _piecesInfluenceManager = new PiecesInfluenceManager(this);
        }
Exemple #2
0
        internal EndGameRules(Board board,
                              TimerManager timerManager,
                              MovesSet movesSet,
                              PiecesInfluenceManager piecesInfluenceManager)
        {
            Guard.ArgumentNotNull(board, nameof(board));
            _board = board;
            Guard.ArgumentNotNull(timerManager, nameof(timerManager));
            _timerManager = timerManager;
            Guard.ArgumentNotNull(movesSet, nameof(movesSet));
            _movesSet = movesSet;
            Guard.ArgumentNotNull(piecesInfluenceManager, nameof(piecesInfluenceManager));
            _piecesInfluenceManager = piecesInfluenceManager;

            _positionsToCheckForThreefoldRepetition = new List <ISet <ThreefoldRepetitionPositionUnit> >();
            _positionsToCheckForThreefoldRepetition.Add(GetPositionForThreefoldRepetition(_board.NextMoveTurn.OpponentColor));

            GameEndedEvent += OnGameEnded;

            InitTimeUpRule();
        }