Closed FireDrunk closed 3 years ago
Hey @FireDrunk
glad to hear that you like it!
Regarding your question: All generated matrices are instances of a GameMatrixImpl (most are subclasses/interfaces). The Solver class takes a GameMatrix in the constructor and does not insist to have a Riddle instance.
The one hint that you're probably needing:
The line above is the value for internal mapping of "unset" / free values in riddles. The code doesn't care too much for Riddle or GameMatrix as far as I remember. Riddles are just matrices with a certain amount of "unset" cells. Riddle just distinguishes whether a cell was settable by the user.
Feel free to give this a try. If you still feel you'd prefer some more explicit code, feel free to give me some hints and/or post a pull request. Let me know if you find a solution that suits your needs!
Since I didn't hear anything anymore, I presume my explanation above solved the problem. Please reopen if you still feel that there's a need for new functions.
Hi @sfuhrm ,
I've been trying to use your library to build my own webbased game as a personal learning project, and I'm impressed by your library! Very cool!
One thing I'm struggeling with, is saving and loading riddles to resume later. I can save a Riddle to a file and load it with the sample code you have built in the sudoku client: https://github.com/sfuhrm/sudoku/blob/master/sudoku-client/src/main/java/de/sfuhrm/sudoku/client/Client.java#L160
But this will always solve the riddle, and not provide me with a reuseable Riddle. A GameMatrix instantiated with the data will always give the same solution, but not always the same Riddle if we use: https://github.com/sfuhrm/sudoku/blob/master/sudoku/src/main/java/de/sfuhrm/sudoku/Creator.java#L297
TL;DR; Is there a way to instantiate a Riddle with given data?