--- ./apps/plugins/sudoku.c.old 2005-09-22 22:00:03.000000000 +0100 +++ ./apps/plugins/sudoku.c 2005-09-25 14:57:43.597116800 +0100 @@ -615,7 +615,10 @@ /* A wrapper function between the Sudoku plugin and the above solver code */ -void sudoku_solve(struct sudoku_state_t* state) { +void sudoku_solve(struct sudoku_state_t* state, const bool solve_current) { +/* Multiplex: + * added 'solve_current' parameter + */ bool ret; Stats stats; Options options; @@ -632,8 +635,17 @@ /* Convert Rockbox format into format for solver */ for (r=0;r<9;r++) { for (c=0;c<9;c++) { - if (state->startboard[r][c]!='0') { - sudoku_set(&sud, c, r, state->startboard[r][c]-'0', true); + if (solve_current==true) { +/* Multiplex: + * added code to handle solving the current board as well as the start board + */ + if (state->currentboard[r][c]!='0') { + sudoku_set(&sud, c, r, state->currentboard[r][c]-'0', true); + } + } else { + if (state->startboard[r][c]!='0') { + sudoku_set(&sud, c, r, state->startboard[r][c]-'0', true); + } } } } @@ -1000,8 +1012,12 @@ { "Save", NULL }, { "Reload", NULL }, { "Clear", NULL }, - { "Solve", NULL }, + { "Solve Loaded", NULL }, + { "Solve Current", NULL }, }; +/* Multiplex: + * Modified third option and added Fourth for solving the current grid + */ m = rb->menu_init(items, sizeof(items) / sizeof(*items), sudoku_menu_cb, NULL, NULL, NULL); @@ -1021,9 +1037,16 @@ clear_board(state); break; - case 3: /* Solve */ - sudoku_solve(state); + case 3: /* Solve the loaded grid*/ + sudoku_solve(state, false); + break; + + case 4: /* Solve the current grid*/ + sudoku_solve(state, true); break; +/* Multiplex: + * Modified third option and added Fourth for solving the current grid + */ default: break;