コード例 #1
0
ファイル: Grid.java プロジェクト: cdevoto/cdevoto-projects
  public static void main(String[] args) throws IOException {
    /*
    grid.setValues(0, new int [] {0, 0, 0,  0, 0, 0,  0, 0, 0});
    grid.setValues(1, new int [] {0, 0, 0,  0, 0, 0,  0, 0, 0});
    grid.setValues(2, new int [] {0, 0, 0,  0, 0, 0,  0, 0, 0});

    grid.setValues(3, new int [] {0, 0, 0,  0, 0, 0,  0, 0, 0});
    grid.setValues(4, new int [] {0, 0, 0,  0, 0, 0,  0, 0, 0});
    grid.setValues(5, new int [] {0, 0, 0,  0, 0, 0,  0, 0, 0});

    grid.setValues(6, new int [] {0, 0, 0,  0, 0, 0,  0, 0, 0});
    grid.setValues(7, new int [] {0, 0, 0,  0, 0, 0,  0, 0, 0});
    grid.setValues(8, new int [] {0, 0, 0,  0, 0, 0,  0, 0, 0});
    */

    final StringBuilder buf = new StringBuilder();
    FileUtil.readFile(
        "puzzle.txt",
        new LineVisitor() {

          @Override
          public void processLine(String line) throws IOException {
            buf.append(line + "\n");
          }
        });

    Grid grid = new Grid(buf.toString());

    printGrid(grid);
    // grid.printCandidateMoves();
    // System.out.println();
    // Grid clone = new Grid(grid);
    // printGrid(clone);
    printGrid(grid.solve());
  }