Esempio n. 1
0
 /// <summary>
 /// Creates checksums from the state of a grid
 /// </summary>
 public void ChecksumFromDrawn()
 {
     Vertical.Clear();
     Horizontal.Clear();
     // create vertical checksum
     for (int i = 0; i < SizeX; i++)
     {
         int temp = 0;
         for (int j = 0; j < SizeY; j++)
         {
             if (this[i, j].State == CellState.filled)
             {
                 temp++;
             }
             else if (temp > 0)
             {
                 Vertical[i].Add(temp);
                 temp = 0;
             }
         }
         if (temp > 0)
         {
             Vertical[i].Add(temp);
         }
     }
     // create horizontal checksum
     for (int i = 0; i < SizeY; i++)
     {
         int temp = 0;
         for (int j = 0; j < SizeX; j++)
         {
             if (this[j, i].State == CellState.filled)
             {
                 temp++;
             }
             else if (temp > 0)
             {
                 Horizontal[i].Add(temp);
                 temp = 0;
             }
         }
         if (temp > 0)
         {
             Horizontal[i].Add(temp);
         }
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Erases the puzzle checksum
 /// </summary>
 public void ClearChecksum()
 {
     Vertical.Clear();
     Horizontal.Clear();
 }
Esempio n. 3
0
 public void Clear()
 {
     Horizontal.Clear();
     Vertical.Clear();
 }