Project Nayuki


Panel de Pon puzzle solver (JavaScript)

There is a series of puzzle video games made by Nintendo with the same mechanics but different titles. Panel de Pon (パネルでポン) (SNES) is the first game in this series, followed by Tetris Attack (SNES), Pokémon Puzzle League (N64), Pokémon Puzzle Challenge (GBC), and Panel de Pon (GameCube).

This page features a JavaScript-based solver for puzzles where you have a limited number of moves to clear all the tiles. Left-click on a tile to advance to the next color or right-click to go back to the previous color, set the maximum number of moves, then click the solve button.

Program

Requires JavaScript

Text import/export:


Moves:

    Notes

    • The program uses breadth-first search to find a solution to your input puzzle. The displayed solution is as short as possible, even if there are moves remaining. The program does not support solving puzzles that require active manipulation while tiles are in the process of clearing.

    • The source TypeScript code and compiled JavaScript code are available for viewing.

    • Java program: PaneldeponPuzzleSolver.java
      This command-line program takes a puzzle text from standard input (in the import/export format) and prints the solution to standard output.

      The Java program runs the same solver algorithm as the JavaScript program on this web page, but is faster and more memory-efficient – which would be useful on inputs that need many moves, have complex tile arrangements that lead to many possible states, and/or have a large board.

    • I first wrote this program in year 2007 in Java. In 2014 I cleaned up the logic, mechanically translated the program to JavaScript, added an HTML user interface, and published the page. In 2018, I upgraded the JavaScript code to TypeScript and did some minor clarification/simplification/reorganization.

    • Developing the software in Java was a good idea because its static typing and compile-time checking made many silly errors of mine very easy to detect and fix – such as confusing Boolean and integer variables, expecting a list but getting a string, refactoring 1D vs. 2D arrays, misspelling names, and using incorrect access modifiers. When it was time to create the JavaScript version, the work was a straightforward matter of copying and pasting the Java code, changing all the variable declarations from int, etc. to just var or nothing, and patching small pieces of code for JavaScript-specific idioms and APIs. By design, the overall structure and particular algorithms of the program are extremely similar to the Java version it was based on.