1 / 18

KenKen Solver

KenKen Solver. Jason Neufeld. KenKen is a popular number placing puzzle game. It is often compared to Sudoku. Unlike Sudoku, subproblems are not always square and have a mathematical operation associated with them. What is KenKen ?. What is KenKen ?. What is KenKen ?. Python 2.x

ellema
Download Presentation

KenKen Solver

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. KenKen Solver Jason Neufeld

  2. KenKen is a popular number placing puzzle game. • It is often compared to Sudoku. • Unlike Sudoku, subproblems are not always square and have a mathematical operation associated with them. What is KenKen?

  3. What is KenKen?

  4. What is KenKen?

  5. Python 2.x • Tkinter for cross-platform GUI • Numpy for multidimensional arrays Solver Implementation

  6. Simple keyboard-based GUI. • Groups and operations can be entered quickly. • Multiple grid sizes are allowed. Interface Design

  7. Interface Design

  8. The solver is separated into two steps: • Pre-processing • Solution Search Solver Algorithm

  9. Without any tree pruning, search sizes can be massive using depth-first search. • Examples: • A 4x4 puzzle, 8 subgroups, 5 possible number combinations (test cases) for each subgroup = 58, or 390,625. • A 9x9 puzzle, 35 subgroups, 5 test cases for each = 535, or ~2.91*1024. Pre-processing

  10. Step 1: Ensure validity of entered board. • Step 2: Determined possible factors of each subgroup: • Equals operation requires only one square, and its only possible value is the total value. • Multiplication, Addition, Subtraction, and Division are all recursively solved for each possible valid combination. • Step 3: Discover conflicts between subgroups. This allows the search process to quickly prune invalid nodes later on. Pre-processing

  11. Subgroups are ordered by their amount of test cases, from least to greatest. • Each subgroup, in order, loops through each of its tests. • Each test spawns a recursion for the next subgroup. • If a conflict is found, that node is pruned. • If a full solution is found, it is returned immediately. • If no solution, a null object is returned. Solution Search

  12. 80 puzzles were tested with this size breakdown: Performance Results

  13. All puzzles which completed execution returned valid solutions. • Execution time increased exponentially with grid size. • Average solution time by grid size: Performance Results

  14. Performance Results

  15. Pre-processing made an immense improvement in the amount of nodes in the search tree: Performance Results

  16. Large puzzles caused execution time to lengthen significantly. • 8x8 puzzles caused some delays, but some 9x9 puzzles timed out. • An improved algorithm reduced some delays, but a few tests still timed out. Problems

  17. Add mouse-based GUI for general users. • Continue to work on solving heuristics to improve performance of larger puzzles. Further Improvements

  18. On to the demonstration…

More Related