예제 #1
0
 public static ChessGame CustomChessGame(IBoardSetup <ChessPieceEntity> setup, Colours toPlay = Colours.White)
 => new ChessGame(
     ChessBoardEngineProvider(),
     CheckDetectionService(),
     setup,
     toPlay
     );
예제 #2
0
 public BoardEngine <ChessPieceEntity> Provide(IBoardSetup <ChessPieceEntity> boardSetup, int currentPlayer)
 {
     return(new BoardEngine <ChessPieceEntity>(boardSetup,
                                               _chessPathsValidator,
                                               _boardMoveService,
                                               _refreshAllPaths,
                                               currentPlayer));
 }
예제 #3
0
        public BoardEngine(IBoardSetup <TEntity> boardSetup,
                           IPathsValidator <TEntity> pathsValidator,
                           IBoardMoveService <TEntity> boardMoveService
                           )

            : this(boardSetup, pathsValidator, boardMoveService, new DefaultRefreshAllPaths(), 0)
        {
        }
예제 #4
0
파일: Game.cs 프로젝트: HQC2015/Labyrinth-3
 public Game(IRenderer renderer, IInputHandler inputHandler, IBoardSetup boardSetupRules)
 {
     this.renderer = renderer;
     this.inputHandler = inputHandler;
     this.boardSetupRules = boardSetupRules;
     this.player = new Player();
     this.commandController = new CommandController(this.player);
 }
예제 #5
0
 public ChessGameTrigger(
     IBoardEngineProvider <ChessPieceEntity> boardEngineProvider,
     IBoardSetup <ChessPieceEntity> boardSetup,
     ICheckDetectionService checkDetectionService
     )
 {
     _boardSetup            = boardSetup;
     _boardEngineProvider   = boardEngineProvider;
     _checkDetectionService = checkDetectionService;
 }
예제 #6
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);
        }
예제 #7
0
        public BoardEngine(IBoardSetup <TEntity> boardSetup,
                           IPathsValidator <TEntity> pathsValidator,
                           IBoardMoveService <TEntity> boardMoveService,
                           IRefreshAllPaths <TEntity> refreshAllPaths,
                           int currentPlayer)
        {
            CurrentPlayer     = currentPlayer;
            _boardMoveService = boardMoveService;

            BoardState = new BoardState <TEntity>(pathsValidator);

            _boardSetup = boardSetup;
            _boardSetup.SetupPieces(this);

            _refreshAllPaths = refreshAllPaths;
            _refreshAllPaths.RefreshAllPaths(BoardState, CurrentPlayer);
        }
예제 #8
0
        public void Run()
        {
            this.renderer.RenderMessage(Messages.TypeOfGameMessage);
            string userGameType;
            do
            {
                userGameType = this.inputHandler.GetInput();
            }
            while (userGameType != "standart" && userGameType != "unique");
            switch (userGameType)
            {
                case "standart":
                    this.boardSetupRules = new StandartBoardSetup();
                    break;
                case "unique":
                    // different boardSetupRules
                    break;
                default:
                    break;
            }

            var game = new Game(this.renderer, this.inputHandler, this.boardSetupRules);
            game.Start();
        }