示例#1
0
文件: FillPuzzle.cs 项目: Tilps/Stash
 internal static FillPuzzle Load(string fileName)
 {
     string[] lines = File.ReadAllLines(fileName);
     string[] bits = lines[0].Split('x');
     int width = int.Parse(bits[0]);
     int height = int.Parse(bits[1]);
     FillPuzzle res = new FillPuzzle(width, height);
     for (int i = 0; i < height; i++)
     {
         for (int j = 0; j < width; j++)
         {
             if (lines[i + 1][j] != ' ')
             {
                 res.Clues[j, i] = int.Parse(""+lines[i + 1][j]);
             }
         }
     }
     return res;
 }
示例#2
0
文件: FillPuzzle.cs 项目: Tilps/Stash
 public object Clone()
 {
     FillPuzzle newPuzzle = new FillPuzzle(width, height);
     for (int i = 0; i < width; i++)
     {
         for (int j = 0; j < height; j++)
         {
             newPuzzle.Clues[i, j] = this.Clues[i, j];
         }
     }
     return newPuzzle;
 }