# Sudoku Construction Question

I'm one of a group of people building a big puzzle hunt. I have what I think is a pretty good idea for a puzzle, but I'm having trouble constructing it. Basically, what I need to do is make a sudoku but it needs to fit the following criteria:

1) It needs to be challenging, but not fiendishly so (about 7 out of 10 for difficulty would be perfect).

2) It needs to have a unique solution.

3) All the clue numbers need to either be connected to the edge of the puzzle, or need to be connected either horizontally or vertically to a number connected to the edge of the puzzle.

That third criteria is pretty hard to explain so here's a couple of examples which might help.

This grid fits the 3rd criterion because, moving horizontally or vertically, you can trace a direct line from any number to the edge of the grid.

This grid, on the other hand, breaks the 3rd rule in several places. None of the squares in the second box on the top row connect directly to the border. The 4, the 9, and the 3 in the left box on the middle row don't work. In the centre square, the numbers 9, 5, 2, 3, and 8 don't work but the 6 and the 4 do, because the 6 and the 4 can be linked to the edge of the puzzle in a straight line by the 5, 3, and 2 in the box underneath.

I hope this makes the 3rd rule a bit clearer.

The trouble I'm having is I'm finding it really hard to create a grid which fits rule 3 AND has a unique solution. I've been working on it for a couple of days now and I'm starting to think it's not possible. Would any of the sudoku experts here know if such a puzzle is possible? If it is, is there a formula for making them that's more effective than trial and error?

Many thanks.

## 2 Answers

Not necessarily a definitive answer (in fact there's almost certainly a better way) and certainly ignores your final question ("is there a formula for making them?"), but I've made a few rule-restricted sudoku-esque puzzles and can at least offer a view on how I approached them.

1. Spin up a decent sudoku solver, and start with an empty clue grid
2. Untick any solving strategies you don't expect your audience to use (i.e. eliminate strategies that would be considered too hard for your target difficulty - I'd suggest at least turning off "Trial and Error" and "Extreme Strategies", but probably "Diabolical Strategies" too)
3. Start filling in some random clues in the left grid that fit your specific rules - keep going until you have at least 17, but probably more like ~20:
4. Test your draft via the "Solution Count" button
1. If it has exactly one solution, you're done (unlikely the first time)
2. If it has none, go back to the prior step and pay a bit more attention this time :P
3. If it has lots (likely), then continue on...
5. Save the current grid state (see notes below)
6. Click "Take Step" repetitively and watch your draft get solved
1. Not really relevant to your particular rule set, but at this stage you can "prevent" the solver from taking certain paths that may not be allowed for your particular rule set (i.e. where the user has extra external information that can be applied, such as the kings being in check from my first link, above) by removing the candidates on the right hand grid
7. When the solver gets stuck, pay attention to the now limited set of candidates for squares in the right hand grid and choose one or two to convert into clues
1. You should use some logic here rather than just picking things at random because you probably want to provide as few clues as possible to ensure the difficulty doesn't slip into the too easy basket, so try to find squares that fit your required rules that will provide the most new information
8. Revert to your prior version and add (and/or remove/change) your new clue(s):
1. You can do a quick sniff test of your new clue(s) by checking the Solution Count, which lets you play around with alternatives quickly short-circuiting the loop a little, as some clues will have little effect on the count, but others will reduce it drastically
2. You can use the solution list provided in the Solution Count to determine which clues to give (i.e. you need to give clues which differ between alternative solutions to ensure you reduce the count)
3. You can also test just adding new clues without reverting and continuing to solve from that state if you want to quickly test how much additional information is provided by a given clue (though be careful not to loose track of your updated initial state)
9. Repeat steps 4-8 until you're happy with your clue set and your grid is solvable:
1. Double check that the solution is unique by reloading your planned clues and checking the Solution Count
2. You can use the Grader to determine the level of difficulty of your grid

Notes:

1. You probably want to regularly save your progress, so that you can revert to a prior state
1. With the particular solver I linked, you can maintain a single state as a cookie using the Save/Reload buttons, but you can also save more states by hitting Email This Board and copy the number part of the URL (i.e. the string of digits after ?bd=) and restoring using Import a Sudoku and pasting back in your previously saved number states
2. As you loop through step 6, pay attention to which strategies are being applied to get a guide for difficulty as you go - this will allow you to revert and switch clues if you're trying to mix things up as you go rather than trying to alter difficulty after you've already got a finished grid
3. Warning: some of the strategies (e.g. Unique Rectangles) make the assumption that your starting clues provide exactly one solution (which won't necessarily be the case as you're building it up), which means clicking Take Step repeatedly can resolve to a solution even though there are actually many possible solutions - you always need to do get a Solution Count of 1 to guarantee the given grid is uniquely solvable (I edited this note in because it actually affected my initial example)

With luck, someone more expert on grid construction will chime in, but if not, hopefully the above is of some help at least.

I am by no means a sudoku expert, but I think your puzzle idea should work.

First, there has to be a grid which fits rule 3 and has a unique solution, because a completely solved grid (with all 81 numbers filled in) has a unique solution (it's already there!) and fits rule 3.

I'd suggest that you start with a solved sudoku grid, then delete given digits one at a time until you reach a point where the puzzle is no longer uniquely solvable. Some existing sudoku solvers, like the one on Sudoku Wiki, tell you how many solutions a puzzle has, so you can determine the exact step in the digit-deletion process where you move from a single solution to many solutions. (See the "Solution Count" button in the top right of the Sudoku wiki page.)

Now, I can't guarantee that the resulting puzzle will rate about a 7/10 for difficulty. A solved grid is, of course, really easy, and just removing numbers at random (while following rule 3) will probably leave a pretty easy puzzle. However, at the very least you can find out what the difficulty is, because some sudoku solvers also give you the (approximate) difficulty of a sudoku! (There's a "Grader" button on the Sudoku wiki one.) Maybe there will be a point in your digit deletion at which the solution stays unique, but the difficulty spikes from "doable" to "ridiculous." Stay with the doable version, and you'll have a good puzzle.

You could also try the opposite approach -- start from a blank grid, and add given digits in accordance with Rule 3 until you get a uniquely solvable puzzle. This method would probably get you a higher-difficulty puzzle, but it might be harder for you to generate that puzzle.

I just tried a mix of both strategies: I

• started with a blank grid,
• filled in numbers basically at random while following rule 3 until I had a puzzle with exactly one solution, then
• deleted numbers until the "grader" said my difficulty was "Moderate" instead of "Gentle"

That process left me with this puzzle:

Now, that puzzle isn't much to look at, but it is a uniquely solvable sudoku! I'm sure if you take some time with it, you'll find something you're happy with.