Small Programming Challenge (Special Shaped Sudokus)
Leído po 91 usuarios
966666667 284319675 999667777 361258794 999997777 458973162 555111888 927586413 551518188 139647258 555111888 845731926 333344444 793862541 333322444 612495387 322222224 576124839 The following sudoku is special because the numbers are inside the numbers, or (in number-shaped cells), which is revealed when the number fields are delimited by a darker line. Each number field is basically its own face (as much as possible). Considering that they are arranged in a single square solution, without any matching, additional fields. 2,2,7,7,7,7,7,7,1 1,2,7,3,5,6,4,9,8 2,2,2,8,7,8,7,1,1 3,4,5,6,2,7,8,1,9 2,2,2,5,8,7,1,1,1 8,7,6,4,9,1,5,2,3 2,9,9,8,5,8,5,5,1 9,3,2,5,8,4,1,6,7 9,9,9,9,8,5,5,5,1 6,8,1,7,3,9,2,5,4 6,6,9,8,5,8,5,3,1 5,1,9,8,7,2,3,4,6 6,9,9,4,8,4,3,3,3 7,5,4,9,1,8,6,3,2 6,6,6,4,4,4,4,3,3 4,9,3,2,6,5,7,8,1 6,6,6,4,4,4,3,3,3 2,6,8,1,4,3,9,7,5 e.g. 66 Six 6 Seven 7777 666 7 666 7
Did I understand correctly that you currently have some algorithm, but it's a bit slow?
6 6 8 8 8 8 8 8 8,,8126a5479 6 6 2 2 2 8 2 3 8,,ccoooxozx 6 6 6 6 2 2 2 3 3,,a53768291 6 5 5 1 2 2 1 3 3,,23zxccx65 5 5 1 1 1 1 1 3 3,, 685139347 5 5 1 7 7 1 3 3 4,, ooxccxzcr 5 5 7 7 7 4 4 4 4,, 52143798a 9 5 7 9 7 7 4 4,, xzoxooo14 9 9 9 9 9 9 9 4 4,, 7492a6153 A thorough in-depth analysis and assessment of the Sudoku solution. :) For those who don't like Sudoku, the following story will be very boring. But it may help to make special-shaped Sudokus. The first proposed Sudoku solution (impossible without modification). Due to the difficult places marked with stars. The middle area of ones in the middle paralyzes the possibilities of replacing numbers, and the two penultimate lines with very difficult possibilities at the edges ensure failure. Although the extreme lines alleviate and are easy, a successful solution is still 3 errors away. In principle, knowing about such difficult places, you can assess whether the solution is real. In other words, the presence of 12 x and z in this example did not allow reaching a solution. Which is also logical, because the solution depends on flexible possibilities and if there are 9 numbers in a 9-digit number system, then there are no difficult possibilities, because they are also affected by relationships that affect them from three directions. X and z give one possibility in one direction. C gives double and o triple the number of moves. By avoiding ten X and z, very peculiarly shaped sudokus are possible. The best-placed letter is marked with a, which has many possibilities in one or more directions. The easiest solution is provided by the letters A and T. However, the more difficult ones are the shapes with individual, protruding parts.
Tiidu and I came to a solution ourselves. Results (we generated each Sudoku 55-st 100 times): 0) Maximum time: 141 ms, average time: 9 ms 1) Maximum time: 250 ms, average time: 14 ms 2) Maximum time: 16 ms, average time: 6 ms 3) Maximum time: 31 ms, average time: 6 ms 4) Maximum time: 32 ms, average time: 7 ms 5) Maximum time: 2515 ms, average time: 49 ms 6) Maximum time: 296 ms, average time: 15 ms 7) Maximum time: 47 ms, average time: 7 ms 8) Maximum time: 47 ms, average time: 10 ms 9) Maximum time: 16 ms, average time: 6 ms 10) Maximum time: 16 ms, average time: 5 ms 11) Maximum time: 250 ms, average time: 28 ms 12) Maximum time: 453 ms, average time: 16 ms 13) Maximum time: 79 ms, average time: 8 ms 14) Maximum time: 94 ms, average time: 12 ms 15) Maximum time: 219 ms, average time: 8 ms 16) Maximum time: 16 ms, average time: 6 ms 17) Maximum time: 516 ms, average time: 20 ms 18) Maximum time: 16 ms, average time: 6 ms 19) Maximum time: 16 ms, average time: 6 ms 20) Maximum time: 47 ms, average time: 6 ms 21) Maximum time: 32 ms, average time: 7 ms 22) Maximum time: 109 ms, average time: 13 ms 23) Maximum time: 1282 ms, average time: 47 ms 24) Maximum time: 94 ms, average time: 11 ms 25) Maximum time: 16 ms, average time: 6 ms 26) Maximum time: 32 ms, average time: 10 ms 27) Maximum time: 63 ms, average time: 8 ms 28) Maximum time: 16 ms, average time: 5 ms 29) Maximum time: 32 ms, average time: 5 ms 30) Maximum time: 203 ms, average time: 21 ms 31) Maximum time: 485 ms, average time: 16 ms 32) Maximum time: 31 ms, average time: 10 ms 33) Maximum time: 484 ms, average time: 25 ms 34) Maximum time: 16 ms, average time: 6 ms 35) Maximum time: 219 ms, average time: 17 ms 36) Maximum time: 78 ms, average time: 9 ms 37) Maximum time: 1157 ms, average time: 38 ms 38) Maximum time: 1281 ms, average time: 22 ms 39) Maximum time: 16 ms, average time: 7 ms 40) Maximum time: 625 ms, average time: 21 ms 41) Maximum time: 953 ms, average time: 27 ms 42) Maximum time: 172 ms, average time: 11 ms 43) Maximum time: 16 ms, average time: 5 ms 44) Maximum time: 32 ms, average time: 7 ms 45) Maximum time: 63 ms, average time: 8 ms 46) Maximum time: 16 ms, average time: 6 ms 47) Maximum time: 32 ms, average time: 10 ms 48) Maximum time: 281 ms, average time: 18 ms 49) Maximum time: 32 ms, average time: 6 ms 50) Maximum time: 93 ms, average time: 11 ms 51) Maximum time: 3266 ms, average time: 517 ms 52) Maximum time: 16 ms, average time: 6 ms 53) Maximum time: 16 ms, average time: 6 ms 54) Maximum time: 32 ms, average time: 7 ms 55) Maximum time: 62 ms, average time: 15 ms It took 15 hours of programming and testing. 51. I messed around with sudoku for half an hour but couldn't get any faster. One option is to throw it out or let's see how quickly the server generation works (the times given are on my random laptop).
Interestingly, it only took 15 hours to write the code, which is hard to believe.
The time it takes depends on two things: the complexity of the task and the level of the programmer.
For comparison: I wrote the entire Bismarck game in 15 hours. Special-shaped sudokus take about 3 times longer.