Design the batch macro to take one puzzle at a time and run an iterative macro to solve the puzzle.Create the main workflow, which inputs the 1,000 puzzles data, runs a batch macro, verifies that the solutions from the batch macro are correct, and then exports the results.To solve 1,000 Sudoku puzzles with Alteryx: Once all 1,000 puzzles have been solved, the solved puzzle data is sent back to the workflow, verified, and then exported into a CSV file. Once the current puzzle has been solved, the batch macro can move on to a new puzzle. Once the iterative macro has stopped running, the current puzzle has been solved. Because there is no longer any data sent to the bottom “iterative” output, the iterative macro will stop running. I have programmed Alteryx to stop running the iterative macro as soon as there is no data left in the bottom macro output tool.Īs soon as the puzzle is fully solved, the filter will ensure that the puzzle data is sent only to the top output tool. Now here’s the beauty of how an iterative macro works: As long as the puzzle data continues to be passed to the bottom Macro Output tool (which is called an “iteration output”), the macro will keep running. I would like to sort the solved Sudoku puzzles by their relative difficulty level and save a CSV file that contains the solved puzzle data. This section includes Join, Filter, and Union tools – which each play their part in confirming that the solutions generated by the algorithm are correct. I cross-reference the solutions against a list of known solutions that have been published online. Once the macro has generated solutions for all 1,000 puzzles, I want to ensure that these solutions are correct. I will dive deeper into this section in a few moments. This macro is where I keep the “secret sauce” – the algorithm that actually solves Sudoku puzzles. The “macro” is actually an entire workflow hidden inside one tool. This includes an Input tool that reads a CSV file containing 1,000 randomly selected Sudoku puzzles and a Select tool that allows me to clean my data before using it in the rest of the workflow. This workflow has four main parts, each consisting of multiple tools: A software tool that I enjoy using – Alteryx – is really useful for automating “analytic processes” such as this.īut wait! How can a Sudoku puzzle be solved with an “ analytic process ”? So, I decided to make a robot that can follow the same thought process that I was using but hopefully solve the puzzles a lot faster and without manual effort. My brain was having fun, but my writing hand was getting sore. This tedious manual effort can cause an infraction to Rule 3: “Have fun!”Īfter playing Sudoku many times myself, I realized that I was using the same patterns, again and again, to find the solutions to these puzzles. Sometimes, these strategies can be very repetitive and require a lot of manual effort to execute (the game is typically played on paper with a pencil). While the game itself can be challenging and complex, several strategies can be used successfully to find the solution. For very hard puzzles, that number can be much higher. It is believed that the average Sudoku player spends approximately 20 minutes solving a typical Sudoku puzzle. It seems simple, right? Wrong! It can be incredibly challenging to solve a Sudoku puzzle.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |