package at.priv.graf.georg.sudokusolv;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

public class SudokuConvert {
    public static void main(String[] args) throws IOException {
        Box[][] box = new Box[9][9];
        Box tmpBox;
        Properties infile = new Properties();
        infile.load(new FileInputStream(args[0]));
        String wo, val;
        int wert;
        for (int i = 0; i < 9; i++) {
            for (int j = 0; j < 9; j++) {
                wo = String.format("%c%s", i + 97, j + 1);
                val = infile.getProperty(wo, "");
                if (val.equals("")) {
                    box[i][j] = new Box();
                } else {
                    wert = Integer.parseInt(val);
                    box[i][j] = new Box(wert);
                }
            }
        }
        for (int i = 0; i < 9; i++) {
            for (int j = 0; j < 9; j++) {
                tmpBox = box[i][j];
                if (tmpBox.isFix()) System.out.print(tmpBox.getValue());
                else System.out.print(".");
                System.out.print(" ");
            }
            System.out.println();
        }
    }
}
