Ejemplo n.º 1
0
 public GamesController(IBullsAndCowsData data, IUserIdentityProvider userIdentityProvider,
                        IRandomChanceProvider randomChanceProvider, IGameLogicProvider gameLogicProvider)
     : base(data, userIdentityProvider)
 {
     this.randomChanceProvider = randomChanceProvider;
     this.gameLogicProvider    = gameLogicProvider;
 }
Ejemplo n.º 2
0
 public PopBalloonCommand(IGameModel gameModel, IGameLogicProvider gameLogicProvider, int row, int col)
     : base(gameModel)
 {
     this.gameLogicProvider = gameLogicProvider;
     this.row = row;
     this.col = col;
 }
Ejemplo n.º 3
0
 public PopBalloonCommand(IGameModel gameModel, IGameLogicProvider gameLogicProvider, int row, int col)
     : base(gameModel)
 {
     this.gameLogicProvider = gameLogicProvider;
     this.row = row;
     this.col = col;
 }
Ejemplo n.º 4
0
 public Engine(IUserInterface ui, IUserInputValidator validator, ICommandFactory commandFactory, IGameModel gameModel, IGameLogicProvider gameLogicProvider)
 {
     this.userInterface = ui;
     this.validator = validator;
     this.create = commandFactory;
     this.game = gameModel;
     this.gameLogicProvider = gameLogicProvider;
     this.highScoreChart = new string[2, 5];
 }
Ejemplo n.º 5
0
 public Engine(IUserInterface ui, IUserInputValidator validator, ICommandFactory commandFactory, IGameModel gameModel, IGameLogicProvider gameLogicProvider)
 {
     this.userInterface     = ui;
     this.validator         = validator;
     this.create            = commandFactory;
     this.game              = gameModel;
     this.gameLogicProvider = gameLogicProvider;
     this.highScoreChart    = new string[2, 5];
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Starts a new console game.
        /// </summary>
        internal void Start()
        {
            this.balloonsGame = new Game(this.field);
            this.gameLogic = new GameLogicProvider(this.balloonsGame);
            this.data = new BalloonsData(this.players, this.games);
            this.topScoreController = new TopScoreController(this.data.Players);
            this.gamesController = new GamesController(this.data.Games);
            this.engine = new GameEngine(this.gameLogic, this.printer, this.reader, this.data, this.topScoreController, this.gamesController);

            this.engine.StartGame();
        }
 public GameEngineTests()
 {
     this.field = new GameField(GlobalConstants.DefaultLevelRows, GlobalConstants.DefaultLevelCols);
     this.game = new Game(this.field);
     this.gameLogic = new GameLogicProvider(this.game);
     this.mockPrinter = new MockIPrinter().MockPrinter.Object;
     this.topScoreController = new MockITopScoreController().MockTopScoreController.Object;
     this.gamesController = new MockIGamesController().MockGamesController.Object;
     this.gamesRepo = new MockIGenericRepository<Game>(this.GenerateFakeCollectionOfGames());
     this.playersRepo = new MockIGenericRepository<Player>(this.GenerateFakeCollectionOfPlayers());
     this.db = new BalloonsData(this.playersRepo.MockedRepo.Object, this.gamesRepo.MockedRepo.Object);
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GameEngine"/> class.
        /// </summary>
        /// <param name="gameLogic">The logic of the game.</param>
        /// <param name="printer">The printer of the game.</param>
        /// <param name="reader">The reader of the input of the game.</param>
        /// <param name="db">The database of the game.</param>
        /// <param name="topScoreController">The controller of the top scores.</param>
        /// <param name="gamesController">The controller of the game.</param>
        public GameEngine(IGameLogicProvider gameLogic, IGamePrinter printer, IReader reader, IBalloonsData db, ITopScoreController topScoreController, IGamesController gamesController)
        {
            this.GameLogic = gameLogic;
            this.Printer = printer;
            this.Reader = reader;
            this.DataBase = db;
            this.TopScoreController = topScoreController;
            this.GamesController = gamesController;

            this.Context = new Context(this.DataBase, this.GameLogic, this.Printer, this.Reader, this.TopScoreController, this.GamesController);
            this.Factory = new CommandFactory();
            this.CommandValidator = new CommandValidator<CommandType>();
        }
        public MockIContext()
        {
            this.field = new GameField(GlobalConstants.DefaultLevelRows, GlobalConstants.DefaultLevelCols);
            this.game = new Game(this.field);
            this.gameLogic = new GameLogicProvider(this.game);
            this.mockPrinter = new MockIPrinter().MockPrinter.Object;
            this.mockReader = new MockIReader("default").MockReader.Object;
            this.topScoreController = new MockITopScoreController().MockTopScoreController.Object;
            this.gamesController = new MockIGamesController().MockGamesController.Object;
            this.gamesRepo = new MockIGenericRepository<Game>(this.GenerateFakeCollectionOfGames());
            this.playersRepo = new MockIGenericRepository<Player>(this.GenerateFakeCollectionOfPlayers());
            this.db = new BalloonsData(this.playersRepo.MockedRepo.Object, this.gamesRepo.MockedRepo.Object);

            this.MockContext = new Mock<IContext>();
            this.MockContext.SetupGet(x => x.DataBase).Returns(this.db);
            this.MockContext.SetupGet(x => x.GameLogic).Returns(this.gameLogic);
            this.MockContext.SetupGet(x => x.GamesController).Returns(this.gamesController);
            this.MockContext.SetupGet(x => x.TopScoreController).Returns(this.topScoreController);
            this.MockContext.SetupGet(x => x.Memory).Returns(new GameStateMemory());
            this.MockContext.SetupGet(x => x.Printer).Returns(this.mockPrinter);
            this.MockContext.SetupGet(x => x.Reader).Returns(this.mockReader);
        }
Ejemplo n.º 10
0
 public GraphicEngine(IEventBasedUserInterface ui, IUserInputValidator validator, ICommandFactory commandFactory, IGameModel gameModel, IGameLogicProvider gameLogicProvider)
     : base(ui, validator, commandFactory, gameModel, gameLogicProvider)
 {
     ui.Raise += new EventHandler(this.HandleUserInput);
 }
Ejemplo n.º 11
0
 public GuessesController(IBullsAndCowsData data, IUserIdentityProvider userIdentityProvider,
                          IGameLogicProvider gameLogicProvider)
     : base(data, userIdentityProvider)
 {
     this.gameLogicProvider = gameLogicProvider;
 }
Ejemplo n.º 12
0
 public ICommand PopBalloonCommand(IGameModel gameModel, IGameLogicProvider gameLogicProvider, int row, int col)
 {
     return new PopBalloonCommand(gameModel, gameLogicProvider, row, col);
 }
Ejemplo n.º 13
0
 public void TestInit()
 {
     this.memento = new Saver<IGameModel>();
     this.logic  = new LogicProvider(new MatrixValidator(), new RandomNumberGenerator());
 }
Ejemplo n.º 14
0
 public ICommand PopBalloonCommand(IGameModel gameModel, IGameLogicProvider gameLogicProvider, int row, int col)
 {
     return(new PopBalloonCommand(gameModel, gameLogicProvider, row, col));
 }
Ejemplo n.º 15
0
 public GraphicEngine(IEventBasedUserInterface ui, IUserInputValidator validator, ICommandFactory commandFactory, IGameModel gameModel, IGameLogicProvider gameLogicProvider)
     : base(ui, validator, commandFactory, gameModel, gameLogicProvider)
 {
     ui.Raise += new EventHandler(this.HandleUserInput);
 }