Skip to content

Implement Donald Knuth's Algorithm X and Dancing Links data structure to find solutions for a puzzle game.

Notifications You must be signed in to change notification settings

Qanpi/iqArrowsSolver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iq-arrows-solver

A unique implementaion of Donald Knuth's algorithm and data structure to compute solutions at lightning speeds for the IQ-arrows puzzle game.

image

Introduction

What & Why?

This project seeks to tackle the root cause of my frustration. Once, when walking in a book store, I noticed an IQ puzzle game on sale. It was labelled as extremely difficult and I felt up for the challenge. However, I must admit that after trying the harder levels of the game, I felt defeated. But I wasn't about to give up this easily, so I devised a plan to create an algorithm that would obliterate this game. Coincidentally, I was also brainstorming ideas for my personal MYP project and this seemed like a perfect opportunity. You can read my report on the project here.

Technical specifications

  • written in Java from scratch
  • implements Donald Knuth's Algorithm X
  • for improved efficiency and time, relies on the Dancing Links data structure
  • GUI based on Java Swing

Documentation

Game overview

As mentioned in the introduction, the ultimate purpose of this project is to compute solutions to a puzzle game.

image

The game consists of a 6x3 board, 6 differently shaped pieces with arrows on them, and a booklet with challenges.

image

Each challenge in the booklet is presented in the form of the blank board with arrows drawn on it (left). The aim of the game is to position the puzzle pieces in such a manner that the arrows on them line up with those given by the challenge (right). Further information about the game can be found here.

This program allows the user to enter the starting position of the challenge through an intuitive user interface. Then, in a matter of milliseconds, it computes the appropriate answer that fulfills the starting criteria.

Example

  1. Download or clone the repository to your local machine.
  2. If necessary, configure the starting point to Solver.java
  3. Run the code to see a GUI representing the physical board.

image

  1. Enter a combination of arrows either from a challenge or randomly. Clicking again on an arrow will rotate its direction clockwise.

image

  1. Press solve to generate the solution. If not possible, an error will be displayed.

image image

Reflection

How has this project changed me?

This was a milestone project for me as it taught me to develop my own, independent solution. While algorithms for cracking puzzle games have existed and developed for decades, as far as I am aware, no one has applied one to this specific game. As such, I was forced to roam through scientific papers in order to fully grasp the inner-workings of an algorithm and apply it to this problem. It was no easy task, but it felt extremely rewarding to have personally developed a unique solution to a unique problem with almost no outside reference.

What would I improve?

Honestly, I'm rather proud and happy with this project. That being said, I believe I could've structured and documented my code more clearly. In addition, I would also like to explore customizations of the GUI and perhaps incorporating some additional features to the program. Such as for instance being able to interpret a challenge through image recognition from the picture of a page of a booklet.

About

Implement Donald Knuth's Algorithm X and Dancing Links data structure to find solutions for a puzzle game.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published