I am beginner programmer and I am trying to create my own Sudoku Generator using existing code that i found here http://ostermiller.org/qqwing/QQWing.java.html I put it in separate file in my package.
I don't know exactly how to do this. I tried to fill my board with proper Sudoku numbers, but it only fills in zeros. Here is my code:
QQWing wing = new QQWing();
try {
wing.generatePuzzle();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// Create the layout
TableLayout table = new TableLayout(this);
TableLayout.LayoutParams lp = new TableLayout.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT);
table.setLayoutParams(lp); // This line has no effect! WHYYYY?!
table.setStretchAllColumns(true);
EditText editText[][] = new EditText[9][9];
for (int i = 0; i < 9; ++i)
{
TableRow row = new TableRow(this);
for (int j = 0; j < 9; ++j)
{
editText[i][j] = new EditText(this);
editText[i][j].setText(String.valueOf(wing.puzzle[i*9+j]));
editText[i][j].setWidth(50);
row.addView(editText[i][j]);
}
table.addView(row);
}