Example #1
0
        static void Main(string[] args)
        {
            var mask = new Mask(5, 5);
            mask[0, 0] = false;
            mask[2, 2] = false;
            mask[4, 4] = false;

            IGrid grid = new MaskedGrid(mask);
            new RecursiveBacktracker().Run(ref grid);

            Console.WriteLine(grid.ToString(false));
            Console.ReadKey();
        }
Example #2
0
        public static Mask ReadFromTextFile(string file)
        {
            string[] lines = File.ReadAllLines(file);
            var rows = lines.Length;
            var columns = lines.First().Length;
            var mask = new Mask(rows, columns);

            for(int i=0; i<rows; i++)
            {
                for(int j=0; j<columns; j++)
                {
                    var line = lines[i].ToCharArray();
                    mask[i, j] = (line[j] == 'X')
                               ? false
                               : true; 
                }
            }

            return mask;
        }
Example #3
0
 public MaskedGrid(Mask _mask) : base(_mask.Rows, _mask.Columns, false)
 {
     this.mask = _mask;
     this.Initialize(_mask.Rows, mask.Columns);
 }
Example #4
0
 public MaskedGrid(Mask _mask) : base(_mask.Rows, _mask.Columns, false)
 {
     this.mask = _mask;
     this.Initialize(_mask.Rows, mask.Columns);
 }