#ifndef SUDOKU_H #define SUDOKU_H //This is a wrapper of a DLL so I can use it in VB #include #include #include #include //the dll HINSTANCE hDll; //the structs needed struct penCellType { int penMarks[9]; int length; }; struct hintInfoType { int hintCol; int hintRow; char hintText1[128]; char hintText2[128]; }; //all the DLL functions typedef int (*FPTR_Solve)(int, int, int, int, int*); typedef int (*FPTR_Generate)(int*, int, int, int, int, int); typedef int (*FPTR_GetNodesSearched)(); typedef int (*FPTR_GetFirstSolution)(int, int); typedef int (*FPTR_GetFirstSolDepth)(); typedef int (*FPTR_GetFirstSolNodes)(); typedef int (*FPTR_GetCountGenerate)(); typedef int (*FPTR_GetProcessingTime)(); typedef int (*FPTR_HintX)(penCellType*, hintInfoType, int*, int, int); typedef int (*FPTR_SetLevels)(int*); //declare the functions FPTR_Solve Solve; FPTR_Generate Generate; FPTR_GetNodesSearched GetNodesSearched; FPTR_GetFirstSolution GetFirstSolution; FPTR_GetFirstSolDepth GetFirstSolDepth; FPTR_GetFirstSolNodes GetFirstSolNodes; FPTR_GetCountGenerate GetCountGenerate; FPTR_GetProcessingTime GetProcessingTime; FPTR_HintX HintX; FPTR_SetLevels SetLevels; /*========================================================================================================= =========================================================================================================*/ //declare this dll's functions void __declspec(dllexport) init(); void __declspec(dllexport) destroy(); //###the variables we need### int mOrig[9][9]; int mPuzzle[9][9]; int mWholeBoard[9][9]; //###declare the functions### int __declspec(dllexport) InitSudokuDLL(); int __declspec(dllexport) DestroySudokuDLL(); //generates a sudoku puzzle int __declspec(dllexport) GeneratePuzzle(int diff, int diffMin, int diffMax, int diag, int symetric); //this is for solving user-defined puzzles. the user must set all the values be SetSquare //then this solves mPuzzle and stores the result in mWholeBoard, where the user can retrive it via GetRealVal int __declspec(dllexport) SolvePuzzle(int guessOnly, int noGuess, int diag, int diff); //sets one square of the board to a certain number int __declspec(dllexport) SetSquare(int row, int col, int val){ mPuzzle[row][col] = val; return val; } //returns the value of a certain square int __declspec(dllexport) GetSquare(int row, int col){ return mPuzzle[row][col]; } //reveals the value of a particular square int __declspec(dllexport) HintShowSquare(int row, int col) { return mWholeBoard[row][col]; } //reveals the value of a random square int __declspec(dllexport) HintShowRand(int* row, int* col, int* val); //fine-tunes the difficulty levels int __declspec(dllexport) SetDiffLevels(SAFEARRAY specs); //returns the time it took to solve the last-solved puzzle int __declspec(dllexport) GetSolveTime() { return GetProcessingTime(); } //gets the real value of a square int __declspec(dllexport) GetRealVal(int row, int col) { return mWholeBoard[row][col]; } #endif