Closed KittyKittyKitKat closed 3 years ago
Forgive the accidental closure
Looks good to me. We don't have a release pipeline, so this may not go out for a while.
I appreciate the bug fix but I have a problem with the implementation. MC4DSwing is the highest level code, so lower level code such as PuzzleManager shouldn't know about it or make calls into it. What's the easiest way to reproduce the problem?
For me, the problem was easily reproduced after a fresh download, and making a facecolors.txt file. Upon program start the facecolors.txt file is not recognized. I was able to force recognition by loading in a log file.
I understand your issue with the implementation, and to be perfectly honest I took the route of least resistance and didn't really consider the program architecture and hierarchy. I'm sure there's a method to resolve this while keeping the integrity of the code.
Yeah, the fastest path often requires the most work by adding technical debt. I fixed this by moving the color file reading code from MC4DSwing into ColorUtils.
Very sound decision on your part. I looked at the commit and it all looks great. Glad I could be of some help to this very cool project!
I very much appreciate your effort!
This solves the issue of the
facecolors.txt
file not being detected and loaded in unless the puzzle is changed or a log file is loaded. (Referenced by Issues #95 and #129) This problem was caused by the code for loading in the colours, namely thefindColors(schlafi, len)
method, which was only called in thePuzzleListener
of thePuzzleManager
object created. This directly caused the issue described above. To remedy this, I've simply transferred this call tofindColors
, as well as some additional logic handling the result, to a more appropriate location. The location I chose was theinitPuzzle
method of thePuzzleManager
class. I also adapted the logic slightly to fall back on the preexisting default call ofgenerateVisuallyDistinctColors
in the case thefacecolors.txt
file did not yield appropriate or correct colours. To facilitate this, I changed the scope of thefindColors
method fromprivate
topublic
,