Exemple #1
0
        public TwoDimNode <T>[,] ReadTwoDimMaze <T, T2>(Func <string, T2> f, Action <T2, TwoDimNode <T> > f2, int x, int y, TwoDimNode <T>[,] squares = null, char seperator = ' ')
        {
            var ret = squares ?? new TwoDimNode <T> [x, y];

            for (int j = 0; j < x; j++)
            {
                var line = Console.ReadLine();
                if (line == null)
                {
                    throw new Exception("No list found");
                }
                var split = line.Split(new char[] { seperator });
                for (int i = 0; i < split.Length; i++)
                {
                    if (ret[j, i] == null)
                    {
                        ret[j, i] = new TwoDimNode <T>(ret);
                    }
                    f2(f(split[i]), ret[j, i]);
                }
            }
            return(ret);
        }
Exemple #2
0
 public TwoDimNode(TwoDimNode <T>[,] twoDims)
 {
     this.Squares = twoDims;
 }