Esempio n. 1
0
	public void parseBoard() {

		File file = new File("data.txt");

		try {
			Scanner scanner = new Scanner(file);
			Integer size = Integer.parseInt(scanner.nextLine());
			Integer rows = Integer.parseInt(scanner.nextLine());
			Integer columns = Integer.parseInt(scanner.nextLine());

			// Initialize all the squares based on column and row
			Square[][] squares = new Square[size][size];
			Integer[] boxCoords = {rows, columns};

			System.out.println("Size: "+size+" Rows: "+rows);

			int rowCount = 0;
			while (scanner.hasNextLine()) {
				String[] row = scanner.nextLine().split("");
				for (int i = 1; i < row.length; i++) {
					System.out.println(row[i]);
					squares[rowCount][i-1] = new Square(row[i]);
				}
				rowCount++;

			}

			System.out.println("Size: "+size+" Rows: "+rows+" Columns: "+squares);
			
			Board b = new Board(size, boxCoords, squares);

			b.solve();

		}
		catch(FileNotFoundException e) {

		}

	}