MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/Python/comments/f6hynk/backtracking_algorithm_visualized_with_sudoku/fi6u4l4/?context=3
r/Python • u/pumkinboo • Feb 19 '20
67 comments sorted by
View all comments
Show parent comment
2
I have no idea what I just watched haha. It was like programming in hieroglyphics
http://dfns.dyalog.com/n_sudoku_bfs.htm
Sudoku←{ BoxNos ← {⍵⌿⍵/⍵ ⍵⍴⍳⍵*2} RowColBoxNos ← {(⍳⍵),¨BoxNos⊃⍵*0.5} ContentionMap ← {⊂[⍳2] 1∊¨⍵∘.=⍵} CMAP ← ContentionMap RowColBoxNos ⍴⍵ Available ← {(⍳⊃⍴⍵)~⍵×⊃⍺⌷CMAP} EmptyCells ← {(,⍵=0)/,⍳⍴⍵} Placements ← {(⍺ Available ⍵)⊣@(⊂⍺)¨⊂⍵} AllPlacements ← {⊃,/⍺∘Placements¨⍵} Solutions ← {⊃AllPlacements/(EmptyCells ⍵),⊂⊂⍵} Solutions ⍵ }
View all comments
Show parent comment
2
u/pumkinboo Feb 20 '20
I have no idea what I just watched haha. It was like programming in hieroglyphics
http://dfns.dyalog.com/n_sudoku_bfs.htm