Tuesday, 1 December 2009

Text problems now online

Text problems are now online. I have created a TextExercise-class, so textproblems now behave just like all other types of exercises.
Support for the previously mentioned TextProblemSets is not yet implemented.

Notes on Sudoku:
I create lists containing all the elements in a row, column or square, and then check if all numbers from one to nine occurs in all those lists. Selecting lines or columns in two for-loops are pretty straightforward, however squrares are more difficult. This is how to select a square given a sudoku-matrix, if i is square number from 0 to 8 and j goes from 0 to 8 you get:

int row = (i / 3) * 3 + j/3;
int col = j%3 + (i%3)*3;

No comments:

Post a Comment