diff --git a/package.json b/package.json index c0748d6..9e4c525 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sudoku-core", - "version": "2.0.3", + "version": "2.0.4", "description": "A typescript Sudoku package for generating, solving (step-by-step or all), and analyzing Sudoku boards with ease. Perfect for building Sudoku games and integrating Sudoku functionality into your applications.", "main": "dist/cjs/index.js", "module": "dist/esm/index.js", diff --git a/src/utils.ts b/src/utils.ts index 62792ee..5adb94b 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -179,7 +179,7 @@ export const calculateBoardDifficulty = ( : DIFFICULTY_HARD; if (totalScore > 750) difficulty = DIFFICULTY_EXPERT; - if (totalScore > 1200) difficulty = DIFFICULTY_MASTER; + if (totalScore > 2000) difficulty = DIFFICULTY_MASTER; return { difficulty, diff --git a/tests/__snapshots__/sudoku.test.ts.snap b/tests/__snapshots__/sudoku.test.ts.snap index 1f4bd36..ff343bf 100644 --- a/tests/__snapshots__/sudoku.test.ts.snap +++ b/tests/__snapshots__/sudoku.test.ts.snap @@ -2127,409 +2127,467 @@ exports[`sudoku-core solve method should solve the hard board 2`] = ` exports[`sudoku-core solve method should solve the master board 1`] = ` [ - 4, 9, - 2, 7, - 1, - 5, - 8, 6, - 3, - 5, 8, - 3, - 2, - 6, 4, - 7, - 1, - 9, - 7, - 6, 1, - 9, - 3, - 8, 5, 2, - 4, 3, - 5, + 3, 4, - 6, 8, - 7, 2, + 5, 9, + 6, + 7, 1, 1, 2, + 5, + 7, 6, 3, - 5, - 9, 4, - 8, - 7, - 8, - 7, 9, + 8, + 2, 1, + 3, 4, - 2, + 9, 6, - 3, + 7, + 8, 5, + 6, 9, - 4, 7, + 3, 8, + 5, 2, 1, - 3, + 4, 5, - 6, + 8, + 4, + 1, 2, + 7, + 9, + 3, + 6, + 7, 3, + 9, + 6, + 1, + 4, + 8, 5, + 2, 4, + 5, + 2, 9, - 6, + 3, + 8, 1, + 6, 7, 8, 6, 1, - 8, 5, 7, + 2, 3, - 9, 4, - 2, + 9, ] `; exports[`sudoku-core solve method should solve the master board 2`] = ` [ { - "strategy": "Visual Elimination Strategy", + "strategy": "Single Candidate Strategy", "type": "value", "updates": [ { - "filledValue": 6, - "index": 7, + "filledValue": 2, + "index": 62, }, ], }, { - "strategy": "Visual Elimination Strategy", + "strategy": "Single Candidate Strategy", "type": "value", "updates": [ { - "filledValue": 9, - "index": 1, + "filledValue": 3, + "index": 78, }, ], }, { - "strategy": "Visual Elimination Strategy", + "strategy": "Single Candidate Strategy", "type": "value", "updates": [ { - "filledValue": 8, - "index": 10, + "filledValue": 4, + "index": 79, }, ], }, { - "strategy": "Visual Elimination Strategy", + "strategy": "Single Candidate Strategy", "type": "value", "updates": [ { - "filledValue": 5, - "index": 9, + "filledValue": 6, + "index": 73, }, ], }, { - "strategy": "Visual Elimination Strategy", - "type": "value", + "strategy": "Pointing Elimination Strategy", + "type": "elimination", "updates": [ { - "filledValue": 2, - "index": 12, + "eliminatedCandidate": 6, + "index": 6, }, - ], - }, - { - "strategy": "Visual Elimination Strategy", - "type": "value", - "updates": [ { - "filledValue": 4, - "index": 14, + "eliminatedCandidate": 6, + "index": 7, }, - ], - }, - { - "strategy": "Open Singles Strategy", - "type": "value", - "updates": [ { - "filledValue": 1, - "index": 16, + "eliminatedCandidate": 6, + "index": 17, }, - ], - }, - { - "strategy": "Visual Elimination Strategy", - "type": "value", - "updates": [ { - "filledValue": 6, - "index": 19, + "eliminatedCandidate": 6, + "index": 24, }, - ], - }, - { - "strategy": "Open Singles Strategy", - "type": "value", - "updates": [ { - "filledValue": 7, - "index": 18, + "eliminatedCandidate": 6, + "index": 25, }, - ], - }, - { - "strategy": "Visual Elimination Strategy", - "type": "value", - "updates": [ { - "filledValue": 7, - "index": 44, + "eliminatedCandidate": 6, + "index": 26, }, ], }, { - "strategy": "Visual Elimination Strategy", - "type": "value", + "strategy": "Pointing Elimination Strategy", + "type": "elimination", "updates": [ { - "filledValue": 1, - "index": 35, + "eliminatedCandidate": 6, + "index": 6, }, - ], - }, - { - "strategy": "Visual Elimination Strategy", - "type": "value", - "updates": [ { - "filledValue": 5, - "index": 53, + "eliminatedCandidate": 6, + "index": 7, + }, + { + "eliminatedCandidate": 6, + "index": 24, + }, + { + "eliminatedCandidate": 6, + "index": 25, + }, + { + "eliminatedCandidate": 6, + "index": 26, }, ], }, { - "strategy": "Visual Elimination Strategy", - "type": "value", + "strategy": "Pointing Elimination Strategy", + "type": "elimination", "updates": [ { - "filledValue": 3, - "index": 8, + "eliminatedCandidate": 6, + "index": 6, + }, + { + "eliminatedCandidate": 6, + "index": 7, }, ], }, { - "strategy": "Visual Elimination Strategy", - "type": "value", + "strategy": "Pointing Elimination Strategy", + "type": "elimination", "updates": [ { - "filledValue": 4, + "eliminatedCandidate": 7, + "index": 6, + }, + { + "eliminatedCandidate": 7, + "index": 7, + }, + { + "eliminatedCandidate": 7, + "index": 15, + }, + { + "eliminatedCandidate": 7, + "index": 24, + }, + { + "eliminatedCandidate": 7, + "index": 25, + }, + { + "eliminatedCandidate": 7, "index": 26, }, ], }, { - "strategy": "Open Singles Strategy", - "type": "value", + "strategy": "Pointing Elimination Strategy", + "type": "elimination", "updates": [ { - "filledValue": 6, - "index": 62, + "eliminatedCandidate": 7, + "index": 15, }, ], }, { - "strategy": "Visual Elimination Strategy", - "type": "value", + "strategy": "Pointing Elimination Strategy", + "type": "elimination", "updates": [ { - "filledValue": 2, - "index": 25, + "eliminatedCandidate": 8, + "index": 42, }, - ], - }, - { - "strategy": "Open Singles Strategy", - "type": "value", - "updates": [ { - "filledValue": 5, - "index": 24, + "eliminatedCandidate": 8, + "index": 43, + }, + { + "eliminatedCandidate": 8, + "index": 44, + }, + { + "eliminatedCandidate": 8, + "index": 52, }, ], }, { - "strategy": "Single Candidate Strategy", - "type": "value", + "strategy": "Pointing Elimination Strategy", + "type": "elimination", "updates": [ { - "filledValue": 2, - "index": 33, + "eliminatedCandidate": 8, + "index": 42, + }, + { + "eliminatedCandidate": 8, + "index": 43, + }, + { + "eliminatedCandidate": 8, + "index": 44, + }, + { + "eliminatedCandidate": 8, + "index": 52, }, ], }, { - "strategy": "Single Candidate Strategy", - "type": "value", + "strategy": "Pointing Elimination Strategy", + "type": "elimination", "updates": [ { - "filledValue": 4, - "index": 79, + "eliminatedCandidate": 8, + "index": 42, + }, + { + "eliminatedCandidate": 8, + "index": 43, + }, + { + "eliminatedCandidate": 8, + "index": 44, + }, + { + "eliminatedCandidate": 8, + "index": 52, }, ], }, { - "strategy": "Visual Elimination Strategy", - "type": "value", + "strategy": "Pointing Elimination Strategy", + "type": "elimination", "updates": [ { - "filledValue": 1, - "index": 73, + "eliminatedCandidate": 8, + "index": 42, + }, + { + "eliminatedCandidate": 8, + "index": 43, + }, + { + "eliminatedCandidate": 8, + "index": 44, + }, + { + "eliminatedCandidate": 8, + "index": 52, }, ], }, { - "strategy": "Visual Elimination Strategy", - "type": "value", + "strategy": "Pointing Elimination Strategy", + "type": "elimination", "updates": [ { - "filledValue": 9, - "index": 78, + "eliminatedCandidate": 8, + "index": 43, + }, + { + "eliminatedCandidate": 8, + "index": 44, + }, + { + "eliminatedCandidate": 8, + "index": 52, }, ], }, { - "strategy": "Visual Elimination Strategy", - "type": "value", + "strategy": "Pointing Elimination Strategy", + "type": "elimination", "updates": [ { - "filledValue": 7, - "index": 70, + "eliminatedCandidate": 8, + "index": 43, }, ], }, { - "strategy": "Single Candidate Strategy", - "type": "value", + "strategy": "Pointing Elimination Strategy", + "type": "elimination", "updates": [ { - "filledValue": 4, - "index": 55, + "eliminatedCandidate": 1, + "index": 34, + }, + { + "eliminatedCandidate": 1, + "index": 35, + }, + { + "eliminatedCandidate": 1, + "index": 52, }, ], }, { - "strategy": "Single Candidate Strategy", - "type": "value", + "strategy": "Pointing Elimination Strategy", + "type": "elimination", "updates": [ { - "filledValue": 3, - "index": 60, + "eliminatedCandidate": 4, + "index": 41, + }, + { + "eliminatedCandidate": 4, + "index": 48, + }, + { + "eliminatedCandidate": 4, + "index": 49, + }, + { + "eliminatedCandidate": 4, + "index": 50, }, ], }, { - "strategy": "Open Singles Strategy", + "strategy": "Single Candidate Strategy", "type": "value", "updates": [ { - "filledValue": 1, - "index": 69, + "filledValue": 7, + "index": 50, }, ], }, { - "strategy": "Naked Pair Strategy", + "strategy": "Pointing Elimination Strategy", "type": "elimination", "updates": [ - { - "eliminatedCandidate": 5, - "index": 21, - }, { "eliminatedCandidate": 7, - "index": 21, - }, - { - "eliminatedCandidate": 5, - "index": 22, + "index": 27, }, { "eliminatedCandidate": 7, - "index": 22, + "index": 29, }, { - "eliminatedCandidate": 5, - "index": 23, + "eliminatedCandidate": 7, + "index": 37, }, { "eliminatedCandidate": 7, - "index": 23, + "index": 45, }, ], }, { - "strategy": "Naked Pair Strategy", + "strategy": "Pointing Elimination Strategy", "type": "elimination", "updates": [ { "eliminatedCandidate": 7, - "index": 21, + "index": 27, }, { "eliminatedCandidate": 7, - "index": 22, + "index": 29, }, { - "eliminatedCandidate": 5, - "index": 23, + "eliminatedCandidate": 7, + "index": 37, }, { "eliminatedCandidate": 7, - "index": 23, + "index": 45, }, ], }, { - "strategy": "Naked Pair Strategy", + "strategy": "Pointing Elimination Strategy", "type": "elimination", "updates": [ { "eliminatedCandidate": 7, - "index": 21, + "index": 29, }, { "eliminatedCandidate": 7, - "index": 22, + "index": 37, }, { "eliminatedCandidate": 7, - "index": 23, + "index": 45, }, ], }, @@ -2538,12 +2596,16 @@ exports[`sudoku-core solve method should solve the master board 2`] = ` "type": "elimination", "updates": [ { - "eliminatedCandidate": 3, - "index": 3, + "eliminatedCandidate": 7, + "index": 29, }, { - "eliminatedCandidate": 3, - "index": 5, + "eliminatedCandidate": 7, + "index": 37, + }, + { + "eliminatedCandidate": 7, + "index": 45, }, ], }, @@ -2552,134 +2614,196 @@ exports[`sudoku-core solve method should solve the master board 2`] = ` "type": "elimination", "updates": [ { - "eliminatedCandidate": 8, - "index": 3, + "eliminatedCandidate": 1, + "index": 30, }, { - "eliminatedCandidate": 8, - "index": 5, + "eliminatedCandidate": 1, + "index": 31, + }, + { + "eliminatedCandidate": 1, + "index": 32, + }, + { + "eliminatedCandidate": 1, + "index": 41, }, ], }, { - "strategy": "Pointing Elimination Strategy", - "type": "elimination", + "strategy": "Single Candidate Strategy", + "type": "value", "updates": [ { - "eliminatedCandidate": 8, - "index": 3, + "filledValue": 2, + "index": 27, }, + ], + }, + { + "strategy": "Single Candidate Strategy", + "type": "value", + "updates": [ { - "eliminatedCandidate": 8, - "index": 5, + "filledValue": 6, + "index": 32, }, ], }, { - "strategy": "Pointing Elimination Strategy", - "type": "elimination", + "strategy": "Single Candidate Strategy", + "type": "value", "updates": [ { - "eliminatedCandidate": 8, - "index": 3, + "filledValue": 6, + "index": 36, }, + ], + }, + { + "strategy": "Single Candidate Strategy", + "type": "value", + "updates": [ { - "eliminatedCandidate": 8, - "index": 5, + "filledValue": 7, + "index": 38, }, ], }, { - "strategy": "Pointing Elimination Strategy", - "type": "elimination", + "strategy": "Single Candidate Strategy", + "type": "value", "updates": [ { - "eliminatedCandidate": 8, - "index": 3, + "filledValue": 7, + "index": 76, }, + ], + }, + { + "strategy": "Single Candidate Strategy", + "type": "value", + "updates": [ { - "eliminatedCandidate": 8, - "index": 5, + "filledValue": 7, + "index": 54, }, ], }, { - "strategy": "Pointing Elimination Strategy", + "strategy": "Naked Pair Strategy", "type": "elimination", "updates": [ { - "eliminatedCandidate": 8, - "index": 3, + "eliminatedCandidate": 9, + "index": 42, }, { - "eliminatedCandidate": 8, - "index": 5, + "eliminatedCandidate": 9, + "index": 43, + }, + { + "eliminatedCandidate": 9, + "index": 44, }, ], }, { - "strategy": "Pointing Elimination Strategy", + "strategy": "Naked Pair Strategy", "type": "elimination", "updates": [ + { + "eliminatedCandidate": 5, + "index": 10, + }, { "eliminatedCandidate": 9, - "index": 3, + "index": 10, + }, + { + "eliminatedCandidate": 5, + "index": 19, }, { "eliminatedCandidate": 9, - "index": 5, + "index": 19, + }, + { + "eliminatedCandidate": 5, + "index": 55, + }, + { + "eliminatedCandidate": 9, + "index": 55, }, ], }, { - "strategy": "Pointing Elimination Strategy", + "strategy": "Naked Pair Strategy", "type": "elimination", "updates": [ { - "eliminatedCandidate": 7, - "index": 39, - }, - { - "eliminatedCandidate": 7, - "index": 41, + "eliminatedCandidate": 9, + "index": 10, }, { - "eliminatedCandidate": 7, - "index": 48, + "eliminatedCandidate": 9, + "index": 19, }, { - "eliminatedCandidate": 7, - "index": 49, + "eliminatedCandidate": 5, + "index": 55, }, { - "eliminatedCandidate": 7, - "index": 50, + "eliminatedCandidate": 9, + "index": 55, }, ], }, { - "strategy": "Pointing Elimination Strategy", + "strategy": "Naked Pair Strategy", "type": "elimination", "updates": [ { - "eliminatedCandidate": 7, - "index": 39, + "eliminatedCandidate": 9, + "index": 10, }, { - "eliminatedCandidate": 7, - "index": 41, + "eliminatedCandidate": 9, + "index": 19, }, { - "eliminatedCandidate": 7, - "index": 48, + "eliminatedCandidate": 9, + "index": 55, }, + ], + }, + { + "strategy": "Naked Pair Strategy", + "type": "elimination", + "updates": [ { - "eliminatedCandidate": 7, - "index": 49, + "eliminatedCandidate": 9, + "index": 10, }, { - "eliminatedCandidate": 7, - "index": 50, + "eliminatedCandidate": 9, + "index": 19, + }, + { + "eliminatedCandidate": 9, + "index": 55, + }, + ], + }, + { + "strategy": "Naked Pair Strategy", + "type": "elimination", + "updates": [ + { + "eliminatedCandidate": 9, + "index": 55, }, ], }, @@ -2688,84 +2812,138 @@ exports[`sudoku-core solve method should solve the master board 2`] = ` "type": "elimination", "updates": [ { - "eliminatedCandidate": 7, - "index": 39, + "eliminatedCandidate": 4, + "index": 41, }, + ], + }, + { + "strategy": "Visual Elimination Strategy", + "type": "value", + "updates": [ { - "eliminatedCandidate": 7, + "filledValue": 5, "index": 41, }, + ], + }, + { + "strategy": "Visual Elimination Strategy", + "type": "value", + "updates": [ { - "eliminatedCandidate": 7, - "index": 48, + "filledValue": 9, + "index": 37, }, + ], + }, + { + "strategy": "Visual Elimination Strategy", + "type": "value", + "updates": [ { - "eliminatedCandidate": 7, - "index": 49, + "filledValue": 3, + "index": 55, }, + ], + }, + { + "strategy": "Visual Elimination Strategy", + "type": "value", + "updates": [ { - "eliminatedCandidate": 7, - "index": 50, + "filledValue": 5, + "index": 64, }, ], }, { - "strategy": "Pointing Elimination Strategy", - "type": "elimination", + "strategy": "Visual Elimination Strategy", + "type": "value", "updates": [ { - "eliminatedCandidate": 7, - "index": 48, + "filledValue": 1, + "index": 74, }, ], }, { - "strategy": "Pointing Elimination Strategy", - "type": "elimination", + "strategy": "Open Singles Strategy", + "type": "value", "updates": [ { - "eliminatedCandidate": 1, - "index": 30, + "filledValue": 5, + "index": 75, }, + ], + }, + { + "strategy": "Open Singles Strategy", + "type": "value", + "updates": [ { - "eliminatedCandidate": 1, - "index": 31, + "filledValue": 9, + "index": 56, }, + ], + }, + { + "strategy": "Visual Elimination Strategy", + "type": "value", + "updates": [ { - "eliminatedCandidate": 1, - "index": 32, + "filledValue": 4, + "index": 59, }, + ], + }, + { + "strategy": "Open Singles Strategy", + "type": "value", + "updates": [ { - "eliminatedCandidate": 1, - "index": 39, + "filledValue": 1, + "index": 58, }, + ], + }, + { + "strategy": "Visual Elimination Strategy", + "type": "value", + "updates": [ { - "eliminatedCandidate": 1, - "index": 41, + "filledValue": 2, + "index": 49, }, + ], + }, + { + "strategy": "Visual Elimination Strategy", + "type": "value", + "updates": [ { - "eliminatedCandidate": 1, - "index": 49, + "filledValue": 1, + "index": 48, }, ], }, { - "strategy": "Single Candidate Strategy", + "strategy": "Visual Elimination Strategy", "type": "value", "updates": [ { "filledValue": 3, - "index": 27, + "index": 52, }, ], }, { - "strategy": "Visual Elimination Strategy", + "strategy": "Open Singles Strategy", "type": "value", "updates": [ { - "filledValue": 2, - "index": 37, + "filledValue": 5, + "index": 45, }, ], }, @@ -2775,7 +2953,7 @@ exports[`sudoku-core solve method should solve the master board 2`] = ` "updates": [ { "filledValue": 3, - "index": 64, + "index": 29, }, ], }, @@ -2784,8 +2962,8 @@ exports[`sudoku-core solve method should solve the master board 2`] = ` "type": "value", "updates": [ { - "filledValue": 8, - "index": 45, + "filledValue": 9, + "index": 0, }, ], }, @@ -2794,18 +2972,18 @@ exports[`sudoku-core solve method should solve the master board 2`] = ` "type": "value", "updates": [ { - "filledValue": 6, - "index": 72, + "filledValue": 8, + "index": 34, }, ], }, { - "strategy": "Open Singles Strategy", + "strategy": "Visual Elimination Strategy", "type": "value", "updates": [ { "filledValue": 2, - "index": 63, + "index": 7, }, ], }, @@ -2815,7 +2993,7 @@ exports[`sudoku-core solve method should solve the master board 2`] = ` "updates": [ { "filledValue": 5, - "index": 65, + "index": 35, }, ], }, @@ -2824,18 +3002,18 @@ exports[`sudoku-core solve method should solve the master board 2`] = ` "type": "value", "updates": [ { - "filledValue": 9, - "index": 67, + "filledValue": 1, + "index": 43, }, ], }, { - "strategy": "Open Singles Strategy", + "strategy": "Visual Elimination Strategy", "type": "value", "updates": [ { - "filledValue": 6, - "index": 68, + "filledValue": 9, + "index": 25, }, ], }, @@ -2845,37 +3023,37 @@ exports[`sudoku-core solve method should solve the master board 2`] = ` "updates": [ { "filledValue": 4, - "index": 49, + "index": 44, }, ], }, { - "strategy": "Visual Elimination Strategy", + "strategy": "Open Singles Strategy", "type": "value", "updates": [ { - "filledValue": 9, - "index": 47, + "filledValue": 2, + "index": 42, }, ], }, { - "strategy": "Visual Elimination Strategy", + "strategy": "Single Candidate Strategy", "type": "value", "updates": [ { - "filledValue": 6, - "index": 38, + "filledValue": 8, + "index": 3, }, ], }, { - "strategy": "Open Singles Strategy", + "strategy": "Visual Elimination Strategy", "type": "value", "updates": [ { - "filledValue": 4, - "index": 29, + "filledValue": 3, + "index": 23, }, ], }, @@ -2884,8 +3062,8 @@ exports[`sudoku-core solve method should solve the master board 2`] = ` "type": "value", "updates": [ { - "filledValue": 1, - "index": 48, + "filledValue": 9, + "index": 14, }, ], }, @@ -2894,48 +3072,48 @@ exports[`sudoku-core solve method should solve the master board 2`] = ` "type": "value", "updates": [ { - "filledValue": 2, - "index": 50, + "filledValue": 8, + "index": 68, }, ], }, { - "strategy": "Single Candidate Strategy", + "strategy": "Open Singles Strategy", "type": "value", "updates": [ { - "filledValue": 6, - "index": 30, + "filledValue": 9, + "index": 66, }, ], }, { - "strategy": "Single Candidate Strategy", + "strategy": "Visual Elimination Strategy", "type": "value", "updates": [ { "filledValue": 1, - "index": 59, + "index": 18, }, ], }, { - "strategy": "Single Candidate Strategy", + "strategy": "Open Singles Strategy", "type": "value", "updates": [ { - "filledValue": 2, - "index": 58, + "filledValue": 3, + "index": 9, }, ], }, { - "strategy": "Single Candidate Strategy", + "strategy": "Visual Elimination Strategy", "type": "value", "updates": [ { - "filledValue": 5, - "index": 75, + "filledValue": 8, + "index": 26, }, ], }, @@ -2944,8 +3122,8 @@ exports[`sudoku-core solve method should solve the master board 2`] = ` "type": "value", "updates": [ { - "filledValue": 7, - "index": 3, + "filledValue": 5, + "index": 20, }, ], }, @@ -2954,8 +3132,8 @@ exports[`sudoku-core solve method should solve the master board 2`] = ` "type": "value", "updates": [ { - "filledValue": 5, - "index": 5, + "filledValue": 8, + "index": 11, }, ], }, @@ -2964,8 +3142,8 @@ exports[`sudoku-core solve method should solve the master board 2`] = ` "type": "value", "updates": [ { - "filledValue": 8, - "index": 57, + "filledValue": 4, + "index": 24, }, ], }, @@ -2974,8 +3152,8 @@ exports[`sudoku-core solve method should solve the master board 2`] = ` "type": "value", "updates": [ { - "filledValue": 7, - "index": 56, + "filledValue": 2, + "index": 19, }, ], }, @@ -2984,8 +3162,18 @@ exports[`sudoku-core solve method should solve the master board 2`] = ` "type": "value", "updates": [ { - "filledValue": 8, - "index": 74, + "filledValue": 4, + "index": 10, + }, + ], + }, + { + "strategy": "Visual Elimination Strategy", + "type": "value", + "updates": [ + { + "filledValue": 5, + "index": 6, }, ], }, @@ -2994,8 +3182,8 @@ exports[`sudoku-core solve method should solve the master board 2`] = ` "type": "value", "updates": [ { - "filledValue": 7, - "index": 76, + "filledValue": 4, + "index": 4, }, ], }, @@ -3004,8 +3192,8 @@ exports[`sudoku-core solve method should solve the master board 2`] = ` "type": "value", "updates": [ { - "filledValue": 8, - "index": 31, + "filledValue": 2, + "index": 12, }, ], }, @@ -3014,18 +3202,18 @@ exports[`sudoku-core solve method should solve the master board 2`] = ` "type": "value", "updates": [ { - "filledValue": 3, - "index": 22, + "filledValue": 4, + "index": 30, }, ], }, { - "strategy": "Visual Elimination Strategy", + "strategy": "Open Singles Strategy", "type": "value", "updates": [ { "filledValue": 9, - "index": 21, + "index": 31, }, ], }, @@ -3034,8 +3222,28 @@ exports[`sudoku-core solve method should solve the master board 2`] = ` "type": "value", "updates": [ { - "filledValue": 8, - "index": 23, + "filledValue": 5, + "index": 13, + }, + ], + }, + { + "strategy": "Pointing Elimination Strategy", + "type": "elimination", + "updates": [ + { + "eliminatedCandidate": 1, + "index": 16, + }, + ], + }, + { + "strategy": "Visual Elimination Strategy", + "type": "value", + "updates": [ + { + "filledValue": 7, + "index": 16, }, ], }, @@ -3044,8 +3252,8 @@ exports[`sudoku-core solve method should solve the master board 2`] = ` "type": "value", "updates": [ { - "filledValue": 3, - "index": 39, + "filledValue": 6, + "index": 70, }, ], }, @@ -3054,8 +3262,8 @@ exports[`sudoku-core solve method should solve the master board 2`] = ` "type": "value", "updates": [ { - "filledValue": 9, - "index": 34, + "filledValue": 1, + "index": 17, }, ], }, @@ -3064,8 +3272,8 @@ exports[`sudoku-core solve method should solve the master board 2`] = ` "type": "value", "updates": [ { - "filledValue": 7, - "index": 32, + "filledValue": 6, + "index": 15, }, ], }, @@ -3074,8 +3282,8 @@ exports[`sudoku-core solve method should solve the master board 2`] = ` "type": "value", "updates": [ { - "filledValue": 9, - "index": 41, + "filledValue": 1, + "index": 69, }, ], }, @@ -3084,8 +3292,8 @@ exports[`sudoku-core solve method should solve the master board 2`] = ` "type": "value", "updates": [ { - "filledValue": 8, - "index": 43, + "filledValue": 7, + "index": 71, }, ], }, diff --git a/tests/constants.ts b/tests/constants.ts index b247df6..092f7c5 100644 --- a/tests/constants.ts +++ b/tests/constants.ts @@ -335,73 +335,74 @@ export const EXPERT_SUDOKU_BOARD_FOR_TEST = [ ]; export const MASTER_SUDOKU_BOARD_FOR_TEST = [ - 4, null, - 2, + 7, + 6, + null, null, 1, null, - 8, null, + 3, null, null, null, - 3, null, - 6, null, - 7, null, - 9, null, null, - 1, null, null, null, null, + 7, + 6, null, null, null, - 5, null, null, + 1, null, null, null, null, + 7, null, - 1, null, null, null, - 5, null, - 4, + 3, + 8, null, null, null, - 7, null, null, + 8, + 4, null, null, - 6, - 3, null, 9, null, + 6, null, null, null, + 6, null, null, + 8, 5, null, + 4, null, + 2, null, - null, - 4, + 3, null, null, null, @@ -411,9 +412,8 @@ export const MASTER_SUDOKU_BOARD_FOR_TEST = [ null, null, null, - null, - 3, + 2, null, null, - 2, + 9, ];