private void PopulateArgParser(Dictionary <string, string> flagDict)
        {
            var widthSet  = false;
            var heightSet = false;

            foreach (var pair in flagDict)
            {
                switch (pair.Key)
                {
                case "-s":
                    if (pair.Value[0] == '#')
                    {
                        SourceType = InitialWorld.Raw;
                        Source     = pair.Value.Replace("#", string.Empty);
                    }
                    else
                    {
                        SourceType = InitialWorld.Sample;
                        Source     = pair.Value;
                    }
                    break;

                case "-w":
                    widthSet = true;
                    populateSize(pair, ref Width);
                    break;

                case "-h":
                    heightSet = true;
                    populateSize(pair, ref Height);
                    break;

                case "-f":
                    FixedSize = true;
                    break;

                default:
                    break;
                }
            }
            if (this.SourceType == InitialWorld.Random && (!widthSet || !heightSet))
            {
                throw new ArgumentException("Both width and height must be set if a random world is chosen");
            }

            //local functions:

            void populateSize(KeyValuePair <string, string> pair, ref int size)
            {
                if (int.TryParse(pair.Value, out int val) && val > 0)
                {
                    size = val;
                }
                else
                {
                    throw new ArgumentException($"{nameof(pair.Key)} must be an integer, greater or equal to zero");
                }
            }
        }
 public ArgsParser(string[] args)
 {
     SourceType = InitialWorld.Random;
     Width      = 1;
     Height     = 1;
     FixedSize  = false;
     Parse(args);
 }