clubgamma / Sudoku

Participate in Club Gamma Hacktoberfest by contributing to any Club Gamma Project
https://clubgamma.vercel.app/
1 stars 6 forks source link

Add Puzzle Difficulty Classification #10

Closed soni-shashan closed 3 weeks ago

soni-shashan commented 3 weeks ago

Implement a feature to classify puzzles by difficulty (easy, medium, hard) based on the number of clues or other heuristics.

The classifyDifficulty function takes two integer parameters: clueCount and backtrackingSteps, which represent the number of clues in a Sudoku puzzle and the number of backtracking steps taken during the solving process, respectively. It initializes a variable score to zero and calculates the score by subtracting clueCount from 40 and adding the integer division of backtrackingSteps by 10. The function then classifies the puzzle's difficulty based on the calculated score: it returns "Easy" if the score is less than 10, "Medium" if the score is between 10 and 19, "Hard" if the score is between 20 and 29, and "Expert" if the score is 30 or higher.