+therealbountybob Posted January 30, 2014 Share Posted January 30, 2014 Rather than checking for a matching solution to one stored in RAM (assuming that's what you are doing?), could you instead calculate: HAVE all 9 numbers been used on each row and on each column and in each box THEN it must be a valid solution (I might have missed something obvious here!) Not sure about the hints but it's more important the game recognises a valid solution Quote Link to comment Share on other sites More sharing options...
idavis Posted February 10, 2014 Author Share Posted February 10, 2014 It's a little more complicated than that. I do have a routine and formula that does what you mention above. One of the problems is that with the limited horsepower, even using a pure ml routine, it still can take a while to come up with a valid full grid. From there you have to start making a puzzle and that's where the complications come in. If could write another routine to try and solve each puzzle. Then compare to see if there is more than one solution, which would mean you then discard a puzzle with more than one solution. Right now, I can't figure out how to do that with 1) the cpu available and 2) in 8 bit machine language. I am sure #2 can be overcome with a few long coding sessions, and a few gallons of soda. #1 is a little harder to overcome. Maybe later I can expand on this. I am trying to write this response inbetween meetings at work. Quote Link to comment Share on other sites More sharing options...
+therealbountybob Posted February 10, 2014 Share Posted February 10, 2014 I'll leave that with you I'm really getting into assember now but moving a ship around the screen is enough for me If all else fails perhaps hard code the puzzles and, if necessary, have several versions of the file/game each with a different set Good Luck Quote Link to comment Share on other sites More sharing options...
gozar Posted February 11, 2014 Share Posted February 11, 2014 I agree with therealbountybob. Write a puzzle creator and let it precompute the puzzles. You really want to have only one possible solution for a puzzle. As I've played computer generated Sudokus, I can tell when there are multiple solutions. Quote Link to comment Share on other sites More sharing options...
JD6502 Posted February 14, 2014 Share Posted February 14, 2014 Hi Idavis I checked this little program out on real hardware and I think you've done a good job. I like the blue background, I've always wished that hue was the default for Gr. 0. I prefer the default font, it looks good. Oddly, I stumbled over the multi-solution problem on my second puzzle. I can't say it bothered me much, it didn't change my score much and I'm more interested in just solving the puzzle. Unless somebody has a magic math algorithm for generating unique puzzles you may need to check for a solution's validity and accept it, given the limitations. As for pre-generating puzzles, the question is : how many can you stuff into 8k? Quote Link to comment Share on other sites More sharing options...
+Ripdubski Posted February 15, 2014 Share Posted February 15, 2014 Nice work, though Ive never takent he time to fully explore the game, maybe I will now! Quote Link to comment Share on other sites More sharing options...
devwebcl Posted February 17, 2014 Share Posted February 17, 2014 So, does it generate non-unique problems ? Quote Link to comment Share on other sites More sharing options...
+therealbountybob Posted February 18, 2014 Share Posted February 18, 2014 So, does it generate non-unique problems ? Yes! It's a little more complicated than that. I do have a routine and formula that does what you mention above. One of the problems is that with the limited horsepower, even using a pure ml routine, it still can take a while to come up with a valid full grid. From there you have to start making a puzzle and that's where the complications come in. If could write another routine to try and solve each puzzle. Then compare to see if there is more than one solution, which would mean you then discard a puzzle with more than one solution. Right now, I can't figure out how to do that with 1) the cpu available and 2) in 8 bit machine language. I am sure #2 can be overcome with a few long coding sessions, and a few gallons of soda. #1 is a little harder to overcome. Maybe later I can expand on this. I am trying to write this response inbetween meetings at work. Hi Issac, I'm still not sure if we are at cross-purposes: You already have valid full grids right? So do you have the formula like I detailed: Rather than checking for a matching solution to one stored in RAM (assuming that's what you are doing?), could you instead calculate: HAVE all 9 numbers been used on each row and on each column and in each box THEN it must be a valid solution (I might have missed something obvious here!) Not sure about the hints but it's more important the game recognises a valid solution ...If so can't this check whatever filled grid the player comes up with? Then it doesn't matter if there is a multiple solution. You might also consider posting your code here or on the programming forum and see if anyone can help optimise it Quote Link to comment Share on other sites More sharing options...
idavis Posted February 20, 2014 Author Share Posted February 20, 2014 (edited) Hi Issac, I'm still not sure if we are at cross-purposes: You already have valid full grids right? So do you have the formula like I detailed: ...If so can't this check whatever filled grid the player comes up with? Then it doesn't matter if there is a multiple solution. I looked and the formula you explained above is the first part of the process. You have to build a grid with a 1-9 in each row, column, and square and cannot have duplicates. After that step is done, which can take minutes for the limited cpu to check, and random spaces filled in. Once that is done, you then jump to the process of making a "game". I see your point about letting player continue on if they are filling in a real solution, but that still doesn't mean that it's a unique solution. Which is what this boils down to. As embarrassing as this is to say, it wasn't till well into this process that I found out that there could only be one solution for a valid puzzle. I was also wrongly applying the term puzzle to a filled in grid where all of the 1-9's were in place and valid. That's only half the battle, and just blanking out a random number of squares (like I am currently doing) doesn't ensure a valid "puzzle". To try and apply your last idea I would have to come up with a block of code that can solve a puzzle so that it can confirm your played numbers if you hit the Hint button. I am currently pretty busy at work with 50-60 hour weeks and really haven't had time to even bring the code up. I am mentally in the background running through a number of different schemes/formulas that may or may not work at turning a valid solution into a valid sudoku approved puzzle. I am even contemplating enlisting the help of someone at a university. There is the brute-force method, but I am not sure we have the horsepower to make that work. I also am not 100% sure that taking a valid puzzle and shuffling it wouldn't introduce more solutions. It's something I have to work out. I wish I had more time to devote at the moment, but I will get there slowly. I think it's been 8 years that I have been working on this. Not sure I want to put the code out there just yet. It might take me a year to put comments in so that I am not completely embarrassed or more embarrassed than already. I really do appreciate all of the comments and help over the years on this. I wish there was a quick solution I could just code up, and will keep working on this in the background at the moment. I don't want anyone to think I am not appreciative of the discussion and ideas. Edited February 20, 2014 by idavis 1 Quote Link to comment Share on other sites More sharing options...
+therealbountybob Posted February 20, 2014 Share Posted February 20, 2014 Thanks for the reply Rhetorical question - Does it matter if there are multiple solutions? Perhaps might make a puzzle hard to grade it's difficulty but apart from that. If you consider dropping the hints feature (you can always re-add this for a later release) and implementing the valid soution check code then you are away with a decent game Quote Link to comment Share on other sites More sharing options...
JD6502 Posted February 25, 2014 Share Posted February 25, 2014 I did a web search for creating sudoku puzzles, and found a guide that seems to use a much different approach at "www.sudokuonline.us/make_your_own_sudoku_puzzle.php" (Sorry, I don't know how to paste in a link). They start by selecting blanked and exposed cells then systematically filling in the numbers. I've only scanned the site quickly but their technique seems to guarantee a single solution puzzle. It's designed for making puzzles by hand but there's a lot of logic involved and is likely to need a boatload of cycles. Still... probably better than a brute force approach. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.