Exemplo n.º 1
0
        public MatchModelBase(string fen, List <BoardPosition> fromPositions, List <BoardPosition> toPositions, List <IPlayer> playerList, ChessGameType chessGameType_, IGameLoaderSaverService gameLoaderSaverService_)
        {
            if (fen == null)
            {
                throw new NullReferenceException("FEN String Was Not Set!");
            }
            if (playerList == null)
            {
                throw new NullReferenceException("Player List Was Not Set!");
            }

            bool isAnyPlayerNotImplemented = false;

            foreach (var player in playerList)
            {
                if (player == null)
                {
                    isAnyPlayerNotImplemented = true;
                    break;
                }
            }

            if (isAnyPlayerNotImplemented)
            {
                throw new NullReferenceException("One Or More Players In List Were Not Set!");
            }
            if (fromPositions == null)
            {
                throw new NullReferenceException("From-Positions Is Null!");
            }
            if (toPositions == null)
            {
                throw new NullReferenceException("To-Positions Is Null!");
            }
            if (gameLoaderSaverService_ == null)
            {
                throw new NullReferenceException("GameLoaderSaverService Not Set!");
            }

            Players                = playerList;
            chessGameType          = chessGameType_;
            gameLoaderSaverService = gameLoaderSaverService_;

            this.PreviousSelectedPosition = BoardPosition.None;
            this.CurrentSelectedPosition  = BoardPosition.None;

            CurrentPlayer  = playerList[0];
            PreviousPlayer = playerList.Last();

            foreach (var player in playerList)
            {
                player.InitInterfaces(this, this, this, this);
            }
        }
Exemplo n.º 2
0
        public ChaturangaMatchModel(string fen, List <BoardPosition> fromPositions, List <BoardPosition> toPositions, List <IPlayer> playerList, IGameLoaderSaverService gameLoaderSaverService) :
            base(fen, fromPositions, toPositions, playerList, ChessGameType.chaturanga, gameLoaderSaverService)
        {
            var fen_array = fen.Split(' ');
            var factory   = new ChessBoardKitFactory();

            this.BoardKit = factory.GetChaturangaChessBoardKit(fen_array[0]);

            SetBoardByPositionMoves(fromPositions, toPositions);
        }
Exemplo n.º 3
0
 public ServiceLocator(IChessUCIEngine chessUCIEngine, IGameLoaderSaverService gameLoaderSaverService)
 {
     Singleton              = this;
     ChessUCIEngine         = chessUCIEngine;
     GameLoaderSaverService = gameLoaderSaverService;
 }