예제 #1
0
 public static NonogramSolver getInstance()
 {
     if (nonogramSolver == null || nonogramSolver.getNonogram().Length == 0)
     {
         nonogramSolver = new NonogramSolver();
     }
     return(nonogramSolver);
 }
예제 #2
0
 void Update()
 {
     if (Animate.GetComponent <Toggle>().isOn)
     {
         int squarePeerFrame = (int)(solver.steps.Count * 0.10);
         if (squarePeerFrame < 100)
         {
             squarePeerFrame = 1;
         }
         else if (squarePeerFrame > 500)
         {
             squarePeerFrame = 50;
         }
         int index = 0;
         while (index < squarePeerFrame)
         {
             int[] step;
             solver.steps.TryDequeue(out step);
             if (step[2] == 1)
             {
                 grid[step[0], step[1]].GetComponent <Image>().sprite = fill;
             }
             else
             {
                 grid[step[0], step[1]].GetComponent <Image>().sprite = empty;
             }
             index++;
         }
     }
     else if (solver.getIsSolution() && !Animate.GetComponent <Toggle>().isOn)
     {
         bool[][] game = solver.getNonogram();
         for (int row = 0; row < rows; row++)
         {
             for (int column = 0; column < columns; column++)
             {
                 if (game[row][column])
                 {
                     grid[row, column].GetComponent <Image>().sprite = fill;
                 }
                 else
                 {
                     grid[row, column].GetComponent <Image>().sprite = empty;
                 }
             }
         }
     }
 }