Solving Naked Triples in Sudoku
Posted
by Kave
on Stack Overflow
See other posts from Stack Overflow
or by Kave
Published on 2010-06-10T22:11:57Z
Indexed on
2010/06/10
22:23 UTC
Read the original article
Hit count: 320
Hello,
I wished I paid more attention to the math classes back in Uni. :)
How do I implement this math formula for naked triples?
Naked Triples
Take three cells C = {c1, c2, c3} that share a unit U. Take three numbers
N = {n1, n2, n3}. If each cell in C has as its candidates ci ? N then we can remove all
ni ? N from the other cells in U.**
I have a method that takes a Unit (e.g. a Box, a row or a column) as parameter. The unit contains 9 cells, therefore I need to compare all combinations of 3 cells at a time that from the box, perhaps put them into a stack or collection for further calculation.
Next step would be taking these 3-cell-combinations one by one and compare their candidates against 3 numbers. Again these 3 numbers can be any possible combination from 1 to 9. Thats all I need.
But how would I do that? How many combinations would I get? Do I get 3 x 9 = 27 combinations for cells and then the same for numbers (N)?
How would you solve this in classic C# loops? No Lambda expression please I am already confused enough :)
Many Thanks for any help,
© Stack Overflow or respective owner