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(); }
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; }
public MaskedGrid(Mask _mask) : base(_mask.Rows, _mask.Columns, false) { this.mask = _mask; this.Initialize(_mask.Rows, mask.Columns); }
public MaskedGrid(Mask _mask) : base(_mask.Rows, _mask.Columns, false) { this.mask = _mask; this.Initialize(_mask.Rows, mask.Columns); }