IQSolver.jl Documentation

Introduction

This is a simple package for solving the IQ Puzzler Pro game. It works for all three variantes of the game, including the 3D pyramid!.

It uses a backtracking algorithm to solve the game, recursing on disconnected empty regions on the board. Although it is really cool to see it solving the puzzle, the plotting is too slow, so only the initial and final states are shown.

To see it in action, first install it.

using Pkg
Pkg.add("https://github.com/JoseKling/IQSolver.jl.git")
using IQSolver

And then simply run this command to solve a specific stage.

solve(80)

Basic functions

IQSolver.solveFunction

Can be called in three different ways:

  • Board + Pieces -> Use the collection of Pieces to solve the Board. Any

Pieces in the collection that are already on the Board will be disconsidered.

  • Board -> Solves the Board with the original game Pieces. Again, Pieces

already on the Board are discarded.

  • Number -> Solves the corresponding game's stage.
source
IQSolver.imageFunction

If a Board is passed, shows the board with empty Cells in black and Cells with pieces with the corresponding color.

If an Int n is passed, shows the configuration of the board in stage n of the original game.

Can also be used to see a specific symmetry of a piece. Simply provide a Piece and an Int n to show the n-th symmetry of the Piece.

source

Original game

IQSolver.rectangular_boardFunction

Creates an empty rectangular board

source

Creates a rectangular board filled with the provided Pieces and Regions.

filled is a Dict of Piece => Region.

source
IQSolver.diagonal_boardFunction

Creates an empty diagonal board (the one on the back of the game)

source

Builds the game's diagonal 2D board filled with the provided Pieces.

source
IQSolver.game_pieces2DConstant

List of all the pieces in the original game. This list is for the 2D variants.

Their names refer to the color. It always start with 'l', 'm', or 'd', for light, middle, and dark. To maintain the standard and to not have any conflicts with any color names, a 'm' is appended even for colors that appear only once, like 'm_orange'.

The individual pieces are also exported.

source
IQSolver.game_pieces3DConstant

List of all the pieces of the game, but for the 3D pyramid variant.

The difference between the 3D and 2D Pieces is the number of symmetries.

source

Data types

IQSolver.PieceType

A Piece is the collection of all its symmetries with a correspoding color. A symmetry of a piece is just a Region (a collection of Cells), which will be always in a normal form. This means that a symmetry always contains the Cell $(0, 0)$ (or $(0,0,0)$) and the first index of all the Cells in it is always non-negative.

The implemented methods for this data type are:

  • n_symmetries -> number of symmetries
  • size -> how many cells it occupies
  • iterate -> iterate over its symmetries
source
IQSolver.BoardType

A Board is a matrix containing either a Color or nothing. Alias for Matrix{Union{Nothing, Color}}.

Implemented methods for this dasta type:

  • empty_region -> Returns the collection of empty Cells
  • image -> Plots the current state of the board
source

Index