Example #1
0
 public MowingMachine(Garden garden, IConsole console)
 {
     _garden   = garden;
     _console  = console;
     _commandQ = new Queue <Command>();
     _position = new Dictionary <string, int> {
         { "width", 0 }, { "length", 0 }
     };
     _heading = Heading.North;
 }
Example #2
0
        static void Main(string[] args)
        {
            int width, length;

            if (args.Length == 2 && int.TryParse(args[0], out width) &&
                int.TryParse(args[1], out length))
            {
                Console.WriteLine($"Dimensions of the garden set from arguments: [width, length] = ({width}, {length})");
            }
            else
            {
                Console.WriteLine($"Couldn't load dimensions from command line arguments. Please specify: ");
                width  = ParseValue("Width");
                length = ParseValue("Length");
            }

            ConsoleWrapper console = new ConsoleWrapper();

            var garden = new Garden(width, length, console);

            garden.Run();
        }