public void Start() { FieldFactory minesweeperFactory = new MinesweeperFieldFactory(); IField minesweeperField = minesweeperFactory.CreateField(); FieldFactory playingFieldFactory = new PlayingFieldFactory(); IField playingField = playingFieldFactory.CreateField(); IRenderer consoleRenderer = new ConsoleRenderer(); IReadInput inputReader = new ConsoleReader(); IScoreBoard scoreboard = new ScoreBoard(); IEngine engine = new Engine(minesweeperField, playingField, consoleRenderer, inputReader, scoreboard); engine.Play(); }
/// <summary> /// When the user enter the "restart" command, this method should be called. /// </summary> private void RestartGame() { FieldFactory istanceOfMineFieldFactory = new MinesweeperFieldFactory(); this.mineField = istanceOfMineFieldFactory.CreateField(); FieldFactory instanceOfPlayingFieldFactory = new PlayingFieldFactory(); this.playingField = instanceOfPlayingFieldFactory.CreateField(); this.playing = true; Play(); }