BenjaminChambers / SudokuSharp

A C# library for working with Sudoku puzzles
MIT License
3 stars 3 forks source link

Board class should really be immutable #18

Closed BenjaminChambers closed 7 years ago

BenjaminChambers commented 7 years ago

It just makes things easier.

BenjaminChambers commented 7 years ago

Several of the functions need to make changes to a board and then return the new board. It's not practical to make multiple different constructors that can perform all the operations I need, so I'm not really going for true immutability here.

Instead, I removed the Set method of the accessor. Member functions may still directly access the private data structure, but I will be limiting their functionality to ensure that any modifications are made on a copy of the original which gets returned, while the original instance remains unchanged.

BenjaminChambers commented 7 years ago

Fixed by #19