public void StartGame(GameConfig config, IInterfaceService interfaceService) { var outputService = new OutputService(interfaceService, config); var solution = EntryGenerator.Generate(config.NumbersInSolution, config.MaxNumber); _board = new Board(solution); outputService.WriteNewGame(); for (var guessNumber = 1; guessNumber <= config.NumberOfGuesses; guessNumber++) { outputService.WriteGuessNumber(guessNumber); var userGuesses = outputService.GetGuesses(); if (EndgameChecker.UserHasWon(userGuesses, solution)) { outputService.WriteUserWins(); return; } var response = userGuesses.Select((guess, i) => _board.GetResultForGuess(guess, i)); outputService.WriteResponse(response); } outputService.WriteUserLoses(); outputService.WriteSolution(solution); }
public InterfaceController(IInterfaceService interfaceService, IMapper mapper, IConfiguration configuration) { _interfaceService = interfaceService; _mapper = mapper; _configuration = configuration; _token = _configuration.GetValue <string>("Token"); }
public ChangeUserCommand(IReaderService readerService, IWriterService writerService, IInterfaceService interfaceService, IUserService userService) { this.readerService = readerService; this.writerService = writerService; this.interfaceService = interfaceService; this.userService = userService; }
public UserService(IInterfaceService interfaceService, IReaderService reader, IWriterService writer, IUserSessionService userSessionService, IPlayerRepository playerRepository) { this.interfaceService = interfaceService; this.reader = reader; this.writer = writer; this.userSessionService = userSessionService; this.playerRepository = playerRepository; }
public ExitGameCommand(IUserSessionService userSessionService, IInterfaceService interfaceService, IWriterService writerService, IReaderService readerService, IUserService userService) { this.userSessionService = userSessionService; this.interfaceService = interfaceService; this.writerService = writerService; this.readerService = readerService; this.userService = userService; }
public ConsoleMenuPagination(IReaderService reader, IWriterService writer, IInterfaceService interfaceService, IMenuNavigation menuNavigation, IMenuNavigationStrategyFactory menuNavigationStrategyFactory) { this.reader = reader; this.writer = writer; this.interfaceService = interfaceService; this.menuNavigation = menuNavigation; this.menuNavigationStrategyFactory = menuNavigationStrategyFactory; }
public CheckGameCommand(IUserSessionService userSessionService, ISudokuGridSolver sudokuGridSolver, IUserService userService, IWriterService writerService, IInterfaceService interfaceService, IReaderService readerService) { this.userSessionService = userSessionService; this.sudokuGridSolver = sudokuGridSolver; this.userService = userService; this.writerService = writerService; this.interfaceService = interfaceService; this.readerService = readerService; }
public Engine(IUnityContainer unityContainer, IInterfaceService interfaceService, IUserService userService, IMenuService menuService, IUserSessionService userSessionService, ICommandFactory commandFactory) { this.unityContainer = unityContainer; this.interfaceService = interfaceService; this.userService = userService; this.menuService = menuService; this.userSessionService = userSessionService; this.commandFactory = commandFactory; }
public SolutionGameCommand(IUserSessionService userSessionService, ISudokuGridSolver sudokuGridSolver, IInterfaceService interfaceService, IReaderService readerService, IWriterService writerService, IUserService userService, IGameSetUpFasade gameSetUpFasade) { this.userSessionService = userSessionService; this.sudokuGridSolver = sudokuGridSolver; this.interfaceService = interfaceService; this.readerService = readerService; this.writerService = writerService; this.userService = userService; this.gameSetUpFasade = gameSetUpFasade; }
public GameSetUpFasade(IUserService userService, IUserSessionService userSessionService, IGameFactory gameFactory, IInterfaceService interfaceService, IWriterService writerService, IAsciiFactoriesFactory asciiFactoriesFactory, IFieldFactory fieldFactory, IButtonFactory buttonFactory) { this.userSessionService = userSessionService; this.userService = userService; this.gameFactory = gameFactory; this.interfaceService = interfaceService; this.writerService = writerService; this.asciiFactoriesFactory = asciiFactoriesFactory; this.fieldFactory = fieldFactory; this.buttonFactory = buttonFactory; }
public GamePlayFasade(IReaderService readerService, IWriterService writerService, IInterfaceService interfaceService, IUserSessionService userSessionService, INavigationService navigationService, IGameNavigationStrategyFactory gameNavigationStrategyFactory, IAsciiFactoriesFactory asciiFactoriesFactory, IInGameValueStrategyFactory gameValueStrategyFactory, IInGameCommandFactory inGameCommandFactory) { this.readerService = readerService; this.writerService = writerService; this.interfaceService = interfaceService; this.userSessionService = userSessionService; this.navigationService = navigationService; this.gameNavigationStrategyFactory = gameNavigationStrategyFactory; this.asciiFactoriesFactory = asciiFactoriesFactory; this.gameValueStrategyFactory = gameValueStrategyFactory; this.inGameCommandFactory = inGameCommandFactory; }
public void Setup() { answerToGuess = "ABC"; settings = Substitute.For <IGameSettings>(); mastermindGame = Substitute.For <IMastermindGame>(); mastermindGame.Settings.Returns(settings); gameInterface = Substitute.For <IInterfaceService>(); _serviceUnderTests = new MastermindGameplayService(gameInterface); wrongAnswerCheck.IsCorrect.Returns(false); correctAnswerCheck.IsCorrect.Returns(true); mastermindGame.PlayRound(wrongAnswer).Returns(wrongAnswerCheck); mastermindGame.PlayRound(answerToGuess).Returns(correctAnswerCheck); }
public OutputService(IInterfaceService interfaceService, GameConfig config) { _interfaceService = interfaceService; _config = config; }
public ExitCommand(IReaderService readerService, IWriterService writerService, IInterfaceService interfaceService) { this.readerService = readerService; this.writerService = writerService; this.interfaceService = interfaceService; }
public MastermindGameplayService(IInterfaceService gameInterface) { _interface = gameInterface; }