internal void Init(string gameFilePath, string gameStateFilePath, IGameIO gameIO) { try { _gameWorld = JsonConvert.DeserializeObject <World>(File.ReadAllText(gameFilePath)); if (string.IsNullOrEmpty(gameStateFilePath)) { _gameState = new GameState { CurrentRoom = _gameWorld.Defaults[StateKeys.EntryRoom], PastIntro = false, Inventory = new HashSet <string>(), UnlockedExits = new Dictionary <string, Dictionary <string, bool> >() }; } _actionMap = new Dictionary <string, Action> { { ReservedWords.Go, ProcessGo }, { ReservedWords.Look, ProcessLook }, { ReservedWords.Search, ProcessSearch }, { ReservedWords.Help, ProcessHelp } }; if (gameIO == null) { _gameIO = new ConsoleGameIO(); } } catch (Exception) { //TODO: LOG } }
private void Error(string error) { if (_gameIO == null) { _gameIO = new ConsoleGameIO(); } _gameIO.Error(error); }
public GameController(ICodeCreator builder, ICodeComparer comparer, IGuessTranslator trans, IGameIO consoleIO) { _guessTranslate = trans; _codeComparer = comparer; _builder = builder; _consoleIO = consoleIO; _guesses = new List <List <int> >(); _feedbacks = new List <string>(); }
public Game(IGameIO io, IRandom?random = null) { _io = io; _random = random ?? new NetStandardRandom(); }
public void Setup() { _cIO = new ConsoleIO(); }
public Game(IBoard board, IBoardAnalyzer analyzer, IGameIO io) { this.board = board; this.analyzer = analyzer; this.io = io; }