sudoku-pro 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -2
- package/sudoku-pro.js +3 -1
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sudoku-pro",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "sudoku-pro humbly presents itself as your go-to toolkit for generating, solving, and printing Sudoku puzzles spanning different difficulty levels. Powered by the reliable backtracking algorithm, it aspires to offer enthusiasts and learners alike a simple yet effective platform to engage with Sudoku puzzles. With Sudoku-Pro, embark on a journey of brain-teasing challenges or delve into educational endeavors with ease. This humble interface aims to make Sudoku puzzle creation and enjoyment accessible to all, ensuring a delightful experience for users of varying skill levels. Join us in exploring the possibilities of Sudoku puzzles while we humbly accompany you on your puzzle-solving adventures.",
|
|
5
5
|
"changelog": {
|
|
6
6
|
"1.0.6": "generateSudoku, printSudoku, solveSudoku",
|
|
7
|
-
"1.0.7": "getHint function added"
|
|
7
|
+
"1.0.7": "getHint function added",
|
|
8
|
+
"1.0.7": "fixed the bug which cause issue while generating hard sudoku"
|
|
8
9
|
},
|
|
9
10
|
"main": "sudoku-pro.js",
|
|
10
11
|
"repository": {
|
package/sudoku-pro.js
CHANGED
|
@@ -37,7 +37,9 @@ function generateSudoku(difficulty) {
|
|
|
37
37
|
} else if (difficulty === "m") {
|
|
38
38
|
numToRemove = Math.floor(Math.random() * 25) + 40; // Medium difficulty
|
|
39
39
|
} else if (difficulty === "h") {
|
|
40
|
-
|
|
40
|
+
do {
|
|
41
|
+
numToRemove = Math.floor(Math.random() * 30) + 70; // Hard difficulty
|
|
42
|
+
} while (numToRemove > 81); // Keep recalculating until numToRemove <= 81
|
|
41
43
|
} else {
|
|
42
44
|
throw new Error(
|
|
43
45
|
'Invalid difficulty level. Please use "e" for easy, "m" for medium, or "h" for hard.'
|