This is an improved version of my previous Sudoko solver submission.
The simple 3 roles are expandable to 5 or 6 using common sense, I found them through manually solving lots of Sudokos, they are included in this version.
Still the algorithm does not guess, I'm not a fan of arbitrary guessing as I believe there are some statistical analysis that would lead to an optimized guess (this is to be discovered later), so it only solves the Sudoko based on logic, if there won't be enough info it won't stop (use Ctrl + C to stop it).
Instruction (included in a read me file as well)
First, make a 9x9 variable manually and name it 'in' this is going to be the initial sudoko table, insert the numbers manually, and zero for empty blocks.
>> in=zeros(9,9); % open it and fill it with the known numbers
then double click on 'in' from the workspace and then complete the initial table. Next, run 'table_reader.m' this creates a 9x9x9 variable named 'table'.
Finally, you can run 'Runner_V2.m' and it will solve the sudoko in a second. If it goes beyond a sec then simply use CTRL+C to break the program, this happens when you don't provide enough digits in the initial declaration of 'in', run it again and when you succeed, you'll find a variable named 'finall', double click and see the result.
Some Sudoko samples are provided in .Mat format, based on what variable name they are saved with you may need to run 'table_reader.m' first or directly running 'Runner_v2.m'
Salaheddin Hosseinzadeh (2022). Sudoko Solver (https://www.mathworks.com/matlabcentral/fileexchange/45844-sudoko-solver), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!