コード例 #1
0
        public static Minefield CreateMinefield(string inputField)
        {
            var minefield = new Minefield();

            foreach (var(i, row) in SplitLines(inputField).Enumerate())
            {
                var skipped = 0;
                foreach (var(j, column) in row.Enumerate())
                {
                    var field = ParseCharacter(column, new Coordinate(j - skipped, i));

                    if (field != null)
                    {
                        minefield.Add(field);
                    }
                    else
                    {
                        ++skipped;
                    }
                }
            }
            return(minefield);
        }