PatmaxDaddy wrote:
- Code: Select all
Band Counter 0.4
Permutations 4.8
Band 1 0.3
Gangsters 3.6
Gang lists 0.4
Gang counts 0.2
Band counts 2.2
Grid count 24.2
Overhead 0.1
Total 36.1
The crucial part of this method is the main counting which is an 3863552-size loop. This number is given by 44 (gangsters) * 56^3 (choices for boxes on second row) / 2 (band 2<->3 swapping).
I have a new counting method that does the job in 30.2 milliseconds, but this is on a 3GHz, so I still think PatmaxDaddy is best. But I'm sure this new method has a potential, particularly if PatmaxDaddy starts picking at my code...
The method is as follows, First choose the configurations for the columns in box 2 and 3, and the rows for box 4 and 7:
- Code: Select all
+---+---+---+
| |col|col|
+---+---+---+
|row| | |
+---+---+---+
|row| | |
+---+---+---+
This means that we specify which numbers to place in which column in box 2, but not in which order.
With the configuration given as above, the completion of box 1,2,3,4,7 is independent from the completion of box 5,6,8,9. Thus the two completions can be calculated independently and multiplied together, which is the strength here. There is also a degree of symmetry in the configuration set, which helps me to reduce them down to 2865 equivalence classes.
Box 1,2,3,4,7 completion: There are 36 choices for the column configuration of box 4, and then either 8 (9 out of 10) or 0 (1 out of 10) choices for a column configuration of box 1 and 7. Then we look up the number of band 1 completions from their column configuration as done in the band by band method. The average number of loops is then 36*8*9/10 = 259.2. With 2865 classes, the excepted number of loops becomes 742608. The actual number is 761680.
Box 5,6,8,9 completion: There are 56 choices for the row configuration of box 5 such that it fits with box 4, then the rows in box 6 are given. It is then 8*9/10 choices for the column configuration of box 5 and 8 (as for 12347-counting). Then, with the rows of box 6,7 and columns of box 3,8, we look up the number of completions. Average number of loops is 56*8*9/10=403.2. With 2865 classes, the expected number of loops is 1155168, actual number is 1145600.
In total, we have 1145600+761680=1907280 loops.
In addition, there are loops for creating the lookup-tables, so the total is about 2200000, much less than 3863552 for band by band counting.