sudoku techniques

Upload: ekluvya-ram

Post on 07-Apr-2018

252 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 Sudoku Techniques

    1/29

    Solving Sudoku : Technique 2 : Single Candidate

    This technique is very easy - especially if you're using pencilmarks to store what candidates are still possible within each cell. If you've managed to rule out all other possibilities for a particular cell (by examining the surrounding column, row and box), so there's only one number left that could possibly fit there - you can fill in that number.

    Here's an example;

    Look at some of the lines that are mostly full already, and then for the empty cells, look for areas which only have one possible value. Looking in the column 3, the only two missing numbers are 2 and 1. Because there's already a 1 in the middle box on that column (box 4), the only possible candidate in the highlighted cell is a 2, so you can fill in the 2!

  • 8/6/2019 Sudoku Techniques

    2/29

    Solving Sudoku : Technique 2 : Single Candidate

    In fact, filling in all of the possible pencilmarks (as many programs will do for you), you'll see the following grid, and you can easily spot several single candidates.

    Once you've filled these in, you'll soon see plenty more single candidates, and with this technique you may be able to go on to complete many of the simpler Sudoku puzzles!

    Tip: If you're using a computer program to assist you, then you'll probably do most of your placements with this method. If you're doing your pencilmarks by hand - double check that you've filled them in otherwise you might make a placement that isn't valid!

  • 8/6/2019 Sudoku Techniques

    3/29

    Solving Sudoku : Technique 3 : Candidate Line

    This is the first technique which doesn't actually tell you where to place a number, but instead helps you to determine places where you can't place a number! If you're using pencilmarks, then this will help you to remove candidates, and from there you should be able to make placements. If you look within a box, and find that all of the places where you can put a particular number lie along a single line, then you can be sure that wherever you put the number in that box, it has to be on the line. Even if you don't know exactly where to put the number yet, you can use this knowledge! You know that none of the other positions on that line (in the other two boxes) could contain that number, so you can remove those as candidates!

    Here's an example - take a look at the bottom right box (box number 9)

    There's only two places where the 4s can be - and they're in a line (a column).

    What this means is that the 4s on that line must be in that box - and can't be anywhere else on the line.

  • 8/6/2019 Sudoku Techniques

    4/29

  • 8/6/2019 Sudoku Techniques

    5/29

    Solving Sudoku : Technique 4 : Double Pair

    This technique relies on spotting two pairs of candidates for a value, and using these to rule out candidates from other boxes.

    Take a look at the places where 2 can be for the middle column of blocks

    Here they are highlighted:

    You can see that they only lie along two lines (columns 4 and 6).

  • 8/6/2019 Sudoku Techniques

    6/29

    Solving Sudoku : Technique 4 : Double Pair

    Because the 2s are limited to those positions in the top blocks, it means that columns 4 and 6 are taken. That means that any of the candidates for 2 in the bottom block can be removed from either of those two columns. (It has forced the 2s in the bottom block to be in the middle column.) You can remove these candidates

    This nicely leaves a single-candidate 7, which you can then fill in!

    This technique is reasonably easy to spot because you only need to see candidate pairs in two blocks.

  • 8/6/2019 Sudoku Techniques

    7/29

    Solving Sudoku : Technique 5 : Multi-Line

    This is very similar to the Double Pairs Test, but is a little harder to spot. It works in the same way, but the candidates that occupy the lines could be spread across two of the blocks, and there could be several candidates in each line.

    Look at these two 3x3 blocks, and see where the candidates for 5 are.

    We'll highlight those to make it easier to see - and you can see that the 5s are only in the first two columns.

    This means that columns 1 and 2 are already taken for candidates for 5, leaving the middle box with only column 3 for its 5s.

  • 8/6/2019 Sudoku Techniques

    8/29

    Solving Sudoku : Technique 5 : Multi-Line Side 2 af 2

    That doesn't allow us to place a value straight away, but at least we can remove the candidates for 5 from column 1 in the middle box.

    This will help us later on in the puzzle!

    This technique is a little bit harder to spot because there will be more than just two pairs, but will still help you make progress!

  • 8/6/2019 Sudoku Techniques

    9/29

    Solving Sudoku : Technique 6 : Naked Pairs/Triples

    This is one of the cleverer techniques - easier to use than to explain! It works by spotting sets of pairs (or triples, or even quads) within an area. The area could be a row, column, or a box, and the technique works just the same.

    Take a look at the bottom row on this puzzle, which has already been mostly completed.

    People might describe the contents of the area in terms of either a single value or a set of candidates, with each cell's contents in curly brackets { }. The bottom row would look like this: {1369} {15} {4} {369} {8} {7} {15} {16} {2} You don't have to worry about the cells which already have their value set, so you can look at just the ones with several candidates: {1369} {15} {369} {15} {16}

    In that bottom row, you should see the pair {15} in two places.

    You don't know which of those cells is the 1, and which is the 5, but you can be sure that between them, they only contain 1 and 5. This doesn't sound like much until you realise that if those cells contain 1 and 5, then none of the other cells in that area can contain them - so you can remove 1 and 5 as candidates from all of the other cells in the area!

  • 8/6/2019 Sudoku Techniques

    10/29

    Solving Sudoku : Technique 6 : Naked Pairs/Triples

    See that we've been able to remove two 1s as candidates from other cells? Even better, that has left a 6 as a single candidate! The puzzle is now much easier to solve!

    Spotting these pairs is quite easy, but the same technique can also be applied to larger groups, of triples and quads. You might also see this technique called "Disjoint Subsets"

    An example of a Naked Triple might be: {1578} {4} {569} {569} {25} {1589} {569} {27} {3} Can you spot that {569} occurs three times? That means that the values 5,6,9 exist in only those three cells - and can't exist in any of the other cells. After you remove the candidates from other cells you end up with: {1578} {4} {569} {569} {25} {1589} {569} {27} {3} Which becomes {178} {4} {569} {569} {2} {189} {569} {27} {3} (And you can now see the single candidate 2!)

    Getting Clever

    A bit trickier still is that quite often you can apply the same technique, even if it doesn't look like an obvious triple.

    Look in this highlighted area:

    There's actually a triple in there you can work with, even though it isn't complete! Look for 1s, 3s and 8s.

    If you were to write it out, you'd see the following: {149} {18} {1589} {38} {45} {7} {138} {6} {2} The trick is to look for cells which only contain values out of those three candidates. (In this case 1,3,8) {149} {18} {1589} {38} {45} {7} {138} {6} {2}

    What you have are three cells which between them must contain 1,3,8 and no others! Because they

  • 8/6/2019 Sudoku Techniques

    11/29

    Solving Sudoku : Technique 6 : Naked Pairs/Triples

    must contain just those three values, it means you can remove them as candidates from other cells: {149} {18} {1589} {38} {45} {7} {138} {6} {2}

    Tip: You might often see this in puzzles with three cells containing just two values each, for instance {24} {47} {27}. Again, there's just three values shared between three cells, so you can remove 2,4 and 7 from any other cells in that area!

    Why are they called "Naked"? They are called naked because whether they contain all of the set you're

    looking for or not, they won't be hidden underneath any other candidates. In the 1,3,8 example above, the naked triple only contains those values, and nothing else to hide behind!

    Can you find the triples in these puzzles?

    http://www.palmsudoku.com/pages/techniques-6.php?print=1

    http://www.palmsudoku.com/pages/techniques-6.php?print=1http://www.palmsudoku.com/pages/techniques-6.php?print=1
  • 8/6/2019 Sudoku Techniques

    12/29

    What about quads?

    Quads are much harder to spot - because each cell in the quad might have 2,3 or all 4 of the candidates for the quad. It really takes a long time to look for these by eye, and in general you'll only find these in really tough puzzles.

    Can you spot the quad for 1,3,5 and 7 in this puzzle?

  • 8/6/2019 Sudoku Techniques

    13/29

    Solving Sudoku : Technique 7 : Hidden Pairs/Triples

    Hopefully you've got the hang of finding Naked Pairs and Triples - if not, practise looking for those before trying to understand the hidden equivalent! Hidden pairs and triples are quite a bit trickier to spot - they're hiding after all!

    Look in this highlighted area:

    See that there are actually only two places where 1 and 3 can exist. You'd see them as two pairs, if one of them wasn't hidden by sneaking in an extra 2.

    Using the same notation as before, just looking at the cells which haven't been fixed yet: {46} {24} {13} {26} {123} Because 1 and 3 can only exist in two of those cells (no other cells will accept either of them), that means they must be in those two cells, leaving no room for any other. Even though you don't know which is a 1 and which is a 3, you do know that the two isn't welcome, so you can remove it as a candidate from the end cell! (The eagle-eyed readers will spot that you could have arrived at the same result by looking for the naked triple {46} {24} {26} - which would result in just the same - removing the 2 as a candidate from the end cell. This happens quite often!)

    Looking for hidden groups

    Just remember that you're looking for a group of numbers that are limited to only a small group of cells. If you're looking for hidden pairs, you're looking for two numbers which only exist in two cells within that area - even though there will be other candidates in the same cell "hiding" them. For triples, you'll be looking for three cells, and so on.

    Spot the hidden pair in this puzzle:

  • 8/6/2019 Sudoku Techniques

    14/29

    Solving Sudoku : Technique 7 : Hidden Pairs/Triples

    Even harder...

    Where this gets trickier still is that with hidden triples and quads, just like with naked triples and quads, each cell doesn't have to have all of the set you're looking at...

    Look for the hidden triple for 3, 4 and 7 in this puzzle:

    You should be able to remove the candidate for 1 from the top cell - but it's definitely a challenge to spot!

    Can you find the hidden triples in these lines?

    The elusive Hidden Quad?

  • 8/6/2019 Sudoku Techniques

    15/29

    Solving Sudoku : Technique 7 : Hidden Pairs/Triples

    Thankfully very few puzzles require finding a hidden quad to solve, because they're particularly tricky to spot, and devilishly hard to work out!

    Even with the highlight to help you to know where to look, it might still take you a while to pick out the quad! A very unusual beast, is the hidden

  • 8/6/2019 Sudoku Techniques

    16/29

    Solving Sudoku : Technique 8 : X-Wing

    X-Wings are fairly easy to spot, but a little harder to understand than some other techniques. Like others it relies on using positions of pencilmarks to infer enough to allow you to eliminate some other candidates. X-Wings are when there are two lines, each having the same two positions for a number.

    Take a look at this puzzle:

    Once you've satisfied yourself that there aren't any easy methods you can apply to move forward, take a look at the candidate positions for 6, in rows 4 and 9.

    The trick to understanding X-Wings is to imagine what would happen if you chose just one of those positions - what would it do to the others? Imagine making the top left of those cells be the 6 - it would force the other candidate out on its row, and also force the candidate in the bottom left out too (the red arrows).

  • 8/6/2019 Sudoku Techniques

    17/29

    Solving Sudoku : Technique 8 : X-Wing

    In turn, this would force the final cell to also be a 6 (the green arrow)

    So a 6 in the top left cell, would force the bottom right cell to also be a 6:

    By exactly the same logic, a 6 in the top right cell would force the bottom left cell to be a 6

    See how these two forcing lines form an X? That's how the technique got its name.

    OK, I get the name, now what good does it do me?

    If you think about it, whichever position 6 occupies in the top

  • 8/6/2019 Sudoku Techniques

    18/29

    Solving Sudoku : Technique 8 : X-Wing

    If you think about it, whichever position 6 occupies in the top

    row, forces the other to occupy the opposite position in the bottom row. Here's the clever bit - even though you don't know which row has the 6 at the left, and which row has the 6 at the right, you know for sure that both will be occupied And because you know that the 6 will definitely be in both of those two column positions, you can look up and down those columns, and remove any other candidates!

    We can't remove any 6s from the left hand column this time, but there are two we can remove from the right hand column, and one of those leaves an 8 as a single candidate!

    What is new about this technique is that knowledge about two (similar) rows, lets you make removals from columns. Of course, it works the other way too, if you can spot similar columns. You'll often spot X-Wings - they are quite common, but they won't always lead to you being able to remove candidates.

    Tip: The trick to spotting X-Wings is to look for the rectanges of possible candidates. If you find four candidates on the corners of a rectangle, check to see if they are an X-Wing for both rows and columns - that might save you some extra time!

    Some more examples

    X-Wing in rows for 8.

    X-Wing in rows for 9.

  • 8/6/2019 Sudoku Techniques

    19/29

    Solving Sudoku : Technique 8 : X-Wing

    X-Wing in columns for 7.

    X-Wing in columns for 4.

  • 8/6/2019 Sudoku Techniques

    20/29

    Solving Sudoku : Technique 9 : Swordfish

    This is very similar to using X-Wings, in that it will allow you to use knowledge about rows to remove candidates from columns, and vice versa. Make sure you're happy with why X-Wings work before moving on to Swordfish! The complexity here is that you're using knowledge from 3 rows at the same time - and that's what makes

    them harder to spot. Unlike X-Wings, they don't form a simple rectangle. This puzzle is mostly solved - but we've reached a point where simpler methods aren't helping.

    There's actually a Swordfish in 4s in this puzzle, so we'll explain what it is and how it works. To begin with, highlighting all of the places where 4 is still a candidate will help to make things easier.

    What we're looking for are sets of values that we can use to make a chain - just like in an X-Wing being a closed chain of four values, a Swordfish needs a closed chain of 6 (or more) values.

    The Swordfish here is in three rows (3, 5 and 8). We'll remove the other values for now to make it a little clearer.

    Just like in the X-Wing example, a value in one position forces the other in the same row to not be that value. Lets put in some arrows to help to show that.

  • 8/6/2019 Sudoku Techniques

    21/29

    Solving Sudoku : Technique 9 : Swordfish

    See that each of the arrows end in a column that matches one of the other rows?

    This makes a fairly neat closed chain - and that means we can be sure that every one of those columns is occupied. To show the links, here are the arrows.

    There really are only two possibilites for the positions of the 4s within this loop:

    Either way the values were arranged, you can see that these three columns are occupied by the contents of those three rows.

    Once again highlighting the columns, you know that you can remove candidates for 4 from anywhere in those columns other than the three Swordfish rows.

    That's a great deal of work just to remove one candidate - but any progress helps when you're in the toughest puzzles!

  • 8/6/2019 Sudoku Techniques

    22/29

    Solving Sudoku : Technique 9 : Swordfish

    Tip: This only works because the loop is closed! This makes it easier to search for - you know that if you follow a chain and find yourself back at the start, there's a closed loop! It might not mean you can remove any candidates every time, though, which means you have to carry on searching.

    Here's another example - there's a Swordfish in rows for 1s.:

    Hang on... so this works for any closed loops?

    Yup - and it doesn't have to be limited to lines - its possible to connect values that share the same box, but it really does get incredibly complicated! Chances are that you can probably find a simpler method to help you.

    Isn't an X-Wing just a closed loop?

    Again, yup! An X-Wing and Swordfish are really the same thing - an X-Wing with 2 rows and columns, and a Swordfish on 3 rows and columns. If you can see where this is heading... yes, it means that it is possible to have a Swordfish-4, which means it uses the connections between 4 lines! (These are sometimes called Jellyfish.) These are incredibly rare indeed, and usually another technique will work without you having to rely on them!

  • 8/6/2019 Sudoku Techniques

    23/29

    Solving Sudoku : Technique 10 : Forcing Chains

    This technique (thankfully!) is quite easy to understand, but can take quite some time to work out within a puzzle. This is a technique where having a separate copy or notepad overlay really helps, because you'll be making lots of notes! A simple forcing chain is when you have lots of cells with just 2 candidates - and whichever value you

    would choose for one cell forces another cell to be just one of its two values. (It'll be clearer with an example!)

    The First Choice

    Take a look at this puzzle, which shows an example of a forcing chain.

    It doesn't matter which value - 1 or 2 - was in the top cell (at coordinate C3,R1), they would force the value 5 into the other cell (C1,R4).

    Now before starting, its worthwhile mentioning that some of these chains can be short, and sometimes they can be quite long! This example has one of each.

    First of all, imagine if the top cell is a 1. This in turn would force the {14} a few cells below it to be a 4, and so on. Can you follow the chain?

  • 8/6/2019 Sudoku Techniques

    24/29

    Solving Sudoku : Technique 10 : Forcing Chains

    So, the 1 forces the 5:

    The Second Choice

  • 8/6/2019 Sudoku Techniques

    25/29

    Solving Sudoku : Technique 10 : Forcing Chains Side 3 af 4

    Now start again, but instead of a 1, this time make the top cell a 2. Again crossing out the values which get ruled out - you'll see its quite a long chain!

    Here's what it looks like with the arrows...

    The two chains different paths starting with each of the two values for the first cell, but either one means there'll be a 5 in the second cell.

    As soon as you find a situation like this, even though you don't know what the first cell will be, you definitely know the value in the second cell, so you can write it in!

    Is this the same as guessing?

    Not quite - what you're doing is simultaneously looking at the implications of either choice, and seeing if any other cells will turn out the same whichever your choice would be. If you were to have just guessed one, and worked from there, you would actually fill in the same result for the second cell, but depending on whether you guessed correctly or not, you might have made a whole batch of mistakes on the way.

  • 8/6/2019 Sudoku Techniques

    26/29

    Solving Sudoku : Technique 10 : Forcing Chains

    Can this one get harder too?

    What makes this method hard is that you might have to follow chains a long way, and you will have a lot of testing to do. Longer chains don't make it conceptually any harder, but they do make it more likely that you'll make mistakes along the way. Sticking to working with just the pairs generally keeps it fairly simple, but there's nothing stopping you considering the effects of triples or other techniques as you go!

    Tip: When using an overlay (tracing paper or computer overlay), here's a method which makes finding the chains a bit easier. Pick your starting cell, and make a small u shape (a little smiley curve) underneath the first pencilmark. From there, look around, but instead of crossing out pencilmarks (otherwise it gets too messy!), when you find a value that it forces somewhere else, put the same u shape underneath the forced value. Ignore any that the first choice eliminated - you might need them later! Carry on doing this until you can't make any more "u" forces. Now choose the second value in your original cell - and this time put a little "n" symbol (a downturned mouth) above the second pencilmark. Like before, look at the implications and forces that this makes, continuing on until you can't find any more.

    If there's a forcing chain, at some point you'll find a pencilmark with both a "u" and "n" on the same mark (in which case they'll almost join up!). When you see this its a sure sign that whichever candidate you picked for the first cell, you've found the right value for the second cell. Fill in that value, because it means you don't need to look any further! Some people use colours to make it easier too - but it isn't essential.

  • 8/6/2019 Sudoku Techniques

    27/29

    Solving Sudoku : Technique 11 : Nishio

    One technique known as "Nishio" means to find a cell with just a couple of candidates, and to pick one of the candidates. If you work through from that point, and it turns out to be solvable and a valid grid, then great, you guessed right! If your guess was wrong, maybe it would show itself up within just a couple more moves, maybe it would take right until the very end before the last number was incompatible... Do you feel lucky? Some people will try just a few moves, before deleting them and trying another for speed. Finding an incompatibility quickly means you can delete that option, and know that the other choice was correct. In some ways, picking the right number is less lucky, because you won't be sure it was right until you've gone on to solve the entire grid!

    Here's a puzzle with a cell highlighted.

    Lets choose the value 8 for that cell, and follow through the values it would force into the nearby cells and so on. Without too much effort we reach this, crossing out the candidates that aren't possible, and highlighting in blue the single candidates that would become the new cell contents if we followed the results of that 8.

    (There are still a few more that could be crossed out - but this is far enough for the example.)

    There are lots of cells you can see with blue entries, which would be the single candidates for those cells - but have a look at the two highlighted cells on the far right column - which would be a 2 and a 3.

  • 8/6/2019 Sudoku Techniques

    28/29

    Solving Sudoku : Technique 11 : Nishio

    Can you see what effect these two would have on the cell marked in grey?

    Because that 8 would lead to the grey cell having no possible candidates, you can be sure that 8 cannot possibly be the value in the original highlighted cell, so you can safely choose the 5 as the correct option.

    Is it always that hard?

    Not always - but often! Sometimes you'll see the contradiction (error) within just a couple of placements, sometimes you'll get nearly to the end. It is worth reminding here that Nishio only works by finding a contradiction, from which you know to pick the other option. Only if it actually leads you to complete the grid can you be sure that you had the right option to begin with. If you can only fill in a few cells, and there are still more to determine, then it isn't enough for you to be sure. A positive isn't proof, but a negative is a disproof!.

    Tip: Try picking a value for a cell which looks like it will immediately force lots of other values. That way you can be sure that you'll get good reward for your effort if it does turn out to have a contradiction. Tip: Try picking three or four values and just working out a short chain from each. If you don't find one quickly, then move on and try another. There's often a very short chain nearby, and its worth a quick search to find it before you start the much longer and more meticulous searches. Tip: An overlay (tracing paper or a computer equivalent) really helps you to try out various chains without you making a complete mess of your original!

  • 8/6/2019 Sudoku Techniques

    29/29

    Solving Sudoku : Technique 12 : Guessing

    If you've tried everything else you can think of, and a few quick Nishio attempts haven't yielded a result (or completed the grid), then you may need to break down and make a guess. Most good Sudoku puzzles won't require you to guess, but it may just be that there's another logical technique out there you haven't used, or it might just be a puzzle which really does require a guess!

    First of all, if you have to make a guess, at least try to make a guess in a place with limited options, that will open up a whole new set of cells for you. Next, be aware that even after making your guess, you might still have lots of hard work ahead of you before you get close to either completing the puzzle, or knowing that it was the wrong guess! Finally, and here's the worst part, one guess might not be enough! It might be that along the route to completion you have to make several guesses, each one leading you down a different path with different choices to make. Better have an eraser handy! If multiple guesses are required, you'll find yourself needing to track back if you find you did make a wrong turn (and end up in a dead end). For that reason, a guess-based technique that follows from Nishio is known as "Ariadne's Thread" - meaning following guesses, but each time you find an error backtrack to your last choice, and take a different path, like Ariadne of legend! Yes, you'll eventually get to the end of the Sudoku, but it could take a very long time with a great deal of wrong turns! Working things out with logic is much simpler when you can! (Ariadne was the daughter of the Cretan King Minos, who helped Theseus by giving him a sword with which to kill the Minotaur, and a thread which he used to find his way back out of the labyrinth, winding the thread back up every time he made a decision ending in a dead- end, and taking a different path.) The technique of guessing (or trial and error) is also known as bifurcation - and many computer based solvers only include this technique! That may seem strange, but it is very easy for a computer program to brute-force run through each of the guesses to complete the puzzle, and trivial for it to backtrack to a previous choice - humans just don't work this way! (But then, we can make deductive leaps of logic that computers can't... yet!)