public Game(int gridSize, IMineFactory mineFactory, int numberOfLives, int numberOfMines) { _gridSize = gridSize; _mineFactory = mineFactory; _livesRemaining = numberOfLives; _numberOfMines = numberOfMines; }
/// <summary> /// Prevents a default instance of the <see cref="Engine" /> class from being created. /// </summary> private Engine() { this.consoleDrawer = new ConsoleRenderer(); this.consoleReader = new ConsoleInput(); this.inputHandler = new InputHandler(this.consoleDrawer, this.consoleReader); this.mineFactory = new MineCreator(); this.highscore = new HighScore(); this.finalScore = InitialScore; }
/// <summary> /// Initializes a new instance of the <see cref="GameField" /> class. /// </summary> /// <param name="random">Random generator.</param> /// <param name="mineFactory">Mine factory.</param> /// <param name="size">Size of the game field.</param> /// <param name="isExplosionChained">True if there is explosions chaining.</param> public GameField(IRandomGenerator random, IMineFactory mineFactory, int size, bool isExplosionChained = false) { this.random = random; this.mineFactory = mineFactory; this.field = new Cell[size, size]; this.MinesCount = this.CalculateInitialMineCount(); this.FillFieldWithEmptyCells(); this.FillFieldMines(); this.isExplosionChained = isExplosionChained; }
/// <summary> /// Initializes a new instance of the <see cref="GameField" /> class. /// </summary> /// <param name="mineFactory">Mine factory.</param> /// <param name="size">Size of the game field.</param> public GameField(IMineFactory mineFactory, int size) : this(RandomGenerator.Instance, mineFactory, size) { }