public ICustomGameObject GetProblem(string problem, IConsoleMethods consoleMethods)
        {
            ICustomGameObject customGameObject;

            if (problem == "problem1")
            {
                customGameObject = new AGoldenCrown();
            }
            else if (problem == "problem2")
            {
                customGameObject = new BreakerOfChains(consoleMethods);
            }
            else
            {
                throw new ArgumentException($"{problem} is not a valid Problem to execute.", nameof(problem));
            }

            return(customGameObject);
        }
Beispiel #2
0
        public GameEngine(IConsoleMethods consoleMethods)
        {
            // Using consoleMethos instead of directly using System.Console
            this.console = consoleMethods;

            // Initialise dictionary with all available kingdoms
            AllKingdoms = new Dictionary <Kingdoms, Kingdom>();
            foreach (Kingdoms kingdom in Enum.GetValues(typeof(Kingdoms)))
            {
                try
                {
                    AllKingdoms.Add(kingdom, new Kingdom(kingdom, Emblems[kingdom]));
                }
                catch (KeyNotFoundException keyNotFoundException)
                {
                    throw new KeyNotFoundException($"Emblem not defined for {kingdom}", keyNotFoundException);
                }
            }

            // Initialise CustomInputValidator
            CustomInputValidator = (string anything) => { return(false); };
        }
 public BreakerOfChains(IConsoleMethods consoleMethods)
 {
     this.console = consoleMethods;
 }
Beispiel #4
0
 public InputHelper(IConsoleMethods console, IValidation gateKeeper)
 {
     _console    = console;
     _gateKeeper = gateKeeper;
 }
 public MyData(IConsoleMethods consoleMethods)
 {
     this.console = consoleMethods;
 }
 public PyramidHelper(IConsoleMethods console)
 {
     _console = console;
 }
 public ProductOperations(IConsoleMethods consoleMethods)
 {
     this.console = consoleMethods;
 }