コード例 #1
0
 public void Initialize(IGameInitializationStrategy gameInitializationStrategy)
 {
     this._players = this._inputProvider.GetPlayers(gameInitializationStrategy.NumberOfPlayers);
     gameInitializationStrategy.Initialize(this._players, this._board);
     this._renderer.RenderBoard(this._board);
     this.SetFirstPlayerIndex();
 }
コード例 #2
0
 public void Initialize(IGameInitializationStrategy gameInitializationStrategy)
 {
     this.players = this.input.GetPlayers(2);
     gameInitializationStrategy.Initialize(players, this.board);
     this.renderer.RenderBoard(this.board);
     this.SetFirstPlayerIndex();
 }
コード例 #3
0
        public void Initialize(IGameInitializationStrategy gameInitializationStrategy)
        {
            this.players = this.input.GetPlayers(GlobalConstants.StandardGameNumberOfPlayers);

            this.SetFirstPlayerIndex();
            gameInitializationStrategy.Initialize(this.players, this.board);
            this.renderer.RenderBoard(this.board);
        }
コード例 #4
0
 //For testing : Difference is there is not rendering of the board.
 public void TestInitialize(IGameInitializationStrategy gameInitializationStrategy)
 {
     this.players = new List <IPlayer>
     {
         new Player("Gosho", ChessColor.Black),
         new Player("Pesho", ChessColor.White)
     };
     this.SetFirstPlayerIndex();
     gameInitializationStrategy.Initialize(this.players, this.board);
 }
コード例 #5
0
ファイル: Engine.cs プロジェクト: svetlai/Battleships
 public Engine(IRenderer renderer, IInterface userInterface, IGameInitializationStrategy gameInitializationStrategy)
 {
     this.renderer = renderer;
     this.userInterface = userInterface;
     this.gameInitializationStrategy = gameInitializationStrategy;
     this.ships = new List<IShip>();
     this.hiddenGrid = new Grid();
     this.visibleGrid = new Grid();
     this.totalAttempts = 0;
     this.gameStatus = GameStatus.Play;
 }
コード例 #6
0
 public Engine(IRenderer renderer, IInterface userInterface, IGameInitializationStrategy gameInitializationStrategy)
 {
     this.renderer      = renderer;
     this.userInterface = userInterface;
     this.gameInitializationStrategy = gameInitializationStrategy;
     this.ships         = new List <IShip>();
     this.hiddenGrid    = new Grid();
     this.visibleGrid   = new Grid();
     this.totalAttempts = 0;
     this.gameStatus    = GameStatus.Play;
 }
コード例 #7
0
        public override void Initialize(IGameInitializationStrategy gameInitializationStrategy)
        {
            this.Players = new List<IPlayer>
                               {
                                   new Player("[Black]Gosho", ChessColor.Black),
                                   new Player("[White]Pesho", ChessColor.White),
                               };

            this.SetFirstPlayerIndex();

            gameInitializationStrategy.Initialize(this.Players, this.Board);
        }
        public void Initialize(IGameInitializationStrategy gameInitializationStrategy)
        {
            //TODO Remove and use inputProvider
            var players = new List <IPlayer>
            {
                new Player("Qnko", ChessColor.Black),
                new Player("Goshko", ChessColor.White)
            };

            //this.inputProvider.GetPlayers(GlobalConstants.STANDARTGAMENUMBEROFPLAYERS);
            gameInitializationStrategy.Initialize(players, this.board);
            this.renderer.RenderBoard(board);
        }
コード例 #9
0
        public void Initialize(IGameInitializationStrategy gameInitializationStrategy)
        {
            //TODO: BUG - if players are changed- board is reversed
            this._players = new List <IPlayer>
            {
                new Player("Black", ChessColor.Black),
                new Player("White", ChessColor.White)
            }; //this._input.GetPlayers(GlobalConstants.StandartGameNumberOfPlayers);

            this.SetFirstPlayerIndex();
            gameInitializationStrategy.Initialize(this._players, this._board);
            this._renderer.RenderBoard(this._board);
        }
コード例 #10
0
        public void Initialize(IGameInitializationStrategy gameInitializationStrategy)
        {
            //TODO remove using MyChessProject.Players;
            this.players = new List <IPlayer>
            {
                new Player("Pesho", ChessColor.Black),
                new Player("Gosho", ChessColor.White)
            };//input.GetPlayers(GlobalConstants.StandartGameNumberOfPlayers);

            this.SetFirstPlayerIndex();
            gameInitializationStrategy.Initialize(this.players, this.board);
            this.renderer.RenderBoard(this.board);
        }
コード例 #11
0
        public void Initialize(IGameInitializationStrategy gameInitializationStrategy)
        {
            // TODO: remove using JustChess.Players and use the input for players
            // TODO: BUG: if players are changed - board is reversed
            this.players = new List <IPlayer>
            {
                new Player("Gosho", ChessColor.Black),
                new Player("Pesho", ChessColor.White)
            }; // this.input.GetPlayers(GlobalConstants.StandardGameNumberOfPlayers);

            this.SetFirstPlayerIndex();
            gameInitializationStrategy.Initialize(this.players, this.board);
            this.renderer.RenderBoard(this.board);
        }
コード例 #12
0
        public void Initialize(IGameInitializationStrategy gameInitializationStrategy)
        {
            // TODO: remove using Just_Chess.Players; and use input
            this.players = new List <IPlayer>
            {
                new Player("GoshoBlack", ChessColor.Black),
                new Player("PeshoWhite", ChessColor.White)
            };

            this.GetFirstPlayerIndex();
            //this.input.GetPlayers(GlobalConstants.StandardGameNumberOfPlayers);
            gameInitializationStrategy.Initialize(this.players, this.board);
            this.renderer.RenderBoard(board);
        }
コード例 #13
0
        public void Initialize(IGameInitializationStrategy gameInitializationStrategy)
        {
            // TODO: REMOVE PLAYER USING
            var players = new List <IPlayer>
            {
                new Player("Pesho", ChessColor.Black),
                new Player("Gosho", ChessColor.White)
            };

            //this.input.GetPlayers(GlobalConstants.StandartGameNumberOfPlayers);

            gameInitializationStrategy.Initialize(players, this.board);
            this.renderer.RenderBoard(this.board);
        }
コード例 #14
0
        public void Initialize(IGameInitializationStrategy gameInitializationStrategy)
        {
            //TODO
            var players = new List <IPlayer>
            {
                new Player("pesho", LudoColor.Blue),
                new Player("gosho", LudoColor.Green),
                new Player("valio", LudoColor.Red),
                new Player("ivan", LudoColor.Yellow)
            };

            this.input.GetPlayers(GlobalConstants.NumberOfPLayer);
            gameInitializationStrategy.Initialize(players, this.board);
            this.renderer.RenderBoard(board);
        }
コード例 #15
0
        public void Init()
        {
            gameInitializationStrategy = new StandardStartGameInitializationStrategy();
            renderer = new MockConsoleRenderer();
            testing  = true;

            chessPiecesCorrectOrder = new List <Type>
            {
                typeof(Rook),
                typeof(Knight),
                typeof(Bishop),
                typeof(Queen),
                typeof(King),
                typeof(Bishop),
                typeof(Knight),
                typeof(Rook)
            };
        }
コード例 #16
0
 public Engine(IRender renderer, IInterface userInterface, IGameInitializationStrategy gameInitializationStrategy, IGridViewFactory gridFactory, IHelpers helper,
               IPlayerFactory playerFactory, IDataCreator dataCreator, IDataLoader dataLoader, IContext context)
 {
     this.renderer      = renderer;                                //Grid builder
     this.userInterface = userInterface;                           // user interface.
     this.gameInitializationStrategy = gameInitializationStrategy; //Types of ships
     this.ships         = new List <IShip>();
     this.gridFactory   = gridFactory;
     this.visibleGrid   = gridFactory.CreateNewGrid();
     this.hiddenGrid    = gridFactory.CreateNewGrid();
     this.totalAttempts = 0; //
     this.helper        = helper;
     this.playerFactory = playerFactory;
     this.dataCreator   = dataCreator;
     this.dataLoader    = dataLoader;
     this.playerData    = dataLoader.LoadData(playerFactory);
     this.context       = context;
     this.gameStatus    = GameStatus.Play;
 }
コード例 #17
0
 public void Initialize(IGameInitializationStrategy gameInitializationStrategy)
 {
     while (true)
     {
         if (this.Players.Count > 0)
         {
             break;
         }
         try
         {
             this.players       = this.inputProvider.GetPlayers(1);
             this.currentPlayer = players.First();
             gameInitializationStrategy.Initialize(this.players, this.snake);
             this.renderer.RenderGame(this.snake);
             this.renderer.RenderSnakeFood(this.RandomPosition);
         }
         catch (ArgumentException ex)
         {
             this.outputProvider.WriteLine(ex.Message);
             Thread.Sleep(2000);
         }
     }
 }
コード例 #18
0
 public void Initialize(IGameInitializationStrategy gameInitializationStrategy)
 {
     gameInitialization = gameInitializationStrategy;
     Initialize();
 }
コード例 #19
0
        public virtual void Initialize(IGameInitializationStrategy gameInitializationStrategy)
        {
            // TODO: Remove
            // using Chess.Players;
            // Added for development purposes only

            // TODO: If players are changed - board is reversed
            this.players = new List<IPlayer>
                               {
                                   new Player("[Black]", ChessColor.Black),
                                   new Player("[White]", ChessColor.White),
                               };

            this.SetFirstPlayerIndex();

            // Use this
            // var players = this.input.GetPlayers(GlobalConstants.StandartGameNumberOfPlayers);
            gameInitializationStrategy.Initialize(this.players, this.Board);
            this.Renderer.RenderBoard(this.Board);
        }
 public void Initialize(IGameInitializationStrategy initializationStrategy) =>
    initializationStrategy.Initialize(this.board);
コード例 #21
0
 public void Initialize(IGameInitializationStrategy strategy, string firstPlayerName, string secontPlayerName)
 {
     this.players = this.input.GetPlayers(firstPlayerName, secontPlayerName);
     strategy.Initialize(players, this.board);
 }