dclamage / SudokuSolver

GNU General Public License v3.0
50 stars 24 forks source link

Fix exception in Solver.GetConstraintsIndex on duplicated constraints #105

Closed yusitnikov closed 1 year ago

yusitnikov commented 1 year ago

The code called Dictionary.Add() without checking that the key is not already present in the dictionary, and it caused an exception when the puzzle has the same constraint twice. Changed it to TryAdd() and added a related unit test.