2 * Sudokuki - essential sudoku game
3 * Copyright (C) 2007-2011 Sylvain Vedrenne
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "suexg/gene_suexg_v12.h"
22 #include "net_jankenpoi_sudokuki_generator_suexg_SuexgProxy.h"
25 * Class: net_jankenpoi_sudokuki_generator_suexg_SuexgProxy
26 * Method: generateSuexgGrid
27 * Signature: (III[I[I[I)I
29 JNIEXPORT jint JNICALL Java_net_jankenpoi_sudokuki_generator_suexg_SuexgProxy_generateSuexgGrid
30 (JNIEnv * env, jobject j_obj, jint seed, jint requestedRatingMin, jint requestedRatingMax, jintArray result_grid, jintArray result_rating, jintArray result_grid_and_clues)
32 //printf("\nBEGINNING OF PROXY NATIVE METHOD\n");
34 jint* grid = malloc(81 * sizeof(int));
35 jint* grid_and_clues = malloc(81 * sizeof(int));
37 //printf("grid before call to suexg code:\n");
40 //for (i=0; i<81; i++) {
41 // printf("%d", grid[i]);
47 grid_generate (seed, requestedRatingMin, requestedRatingMax, (int**)&grid, (int*)&rating, (int**)&grid_and_clues );
49 //printf("after call to grid_generate - rating:%d\n", rating);
53 //for (i=0; i<81; i++) {
54 // printf("%d", grid[i]);
59 //printf("returning grid:0x%x\n", grid);
61 (*env)->SetIntArrayRegion(env, result_grid, 0, 81, grid);
62 (*env)->SetIntArrayRegion(env, result_rating, 0, 1, &rating);
63 (*env)->SetIntArrayRegion(env, result_grid_and_clues, 0, 81, grid_and_clues);
65 //printf("END OF PROXY NATIVE METHOD\n");