Skip to content

Solve the Pentomino puzzle in 30+ programming languages — Ruby, Python, C, Go, Rust, and more.

sense-n-react/PentominoSolvers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pentomino Solvers in Various Programming Languages

Solve the Pentomino puzzle — a classic tiling and combinatorial problem — implemented in 20+ programming languages, including Ruby, Python, C, C++, Go, Rust, JavaScript, and more.

This repository provides a collection of Pentomino solver algorithms written in different programming languages to demonstrate differences in syntax, performance, and algorithmic approach.
It is ideal for learners who want to compare how the same logic is expressed across multiple languages, and for developers interested in puzzle-solving algorithms and optimization techniques.

🧩 The Pentomino puzzle consists of twelve unique pentomino pieces, each made of five connected squares.
The challenge is to fill a rectangular board using all pieces without overlap — a great problem for exploring recursion, backtracking, and constraint-solving algorithms.


Table of Contents


How to Run Programs

Execute solver.xx

$ ruby solver.rb           # Ruby
$ python3 solver.py        # Python

$ gcc -o solver.c.out solver.c    # Compile C program
$ ./solver.c.out                  # Run the compiled executable

Using run-solver script

$ ./run-solver rb py        # Specify one or more extensions
# or
$ ./run-solver ruby python  # Specify one or more languages

Run all programs

$ ./run-solver --all

Languages Implemented

Ruby Python Lua Squirrel Julia
JavaScript TypeScript Groovy Perl AWK
PHP C C++ C# Java
Kotlin Go Rust Swift LISP
Crystal Elixir F# D Dart
Zig Nim Pascal

More languages may be added over time.

Solver Algorithm

All solvers use the same core algorithmic strategy based on recursive backtracking to explore all possible board placements of the 12 pentomino pieces.

For a detailed explanation of the algorithm, implementation structure, and optimization ideas, see
👉 ALGORITHM.md

Processing Time

Processing Time

Learning Objectives

This project is designed to:

  • Compare syntax and style differences across programming languages
  • Explore recursion, constraint satisfaction, and backtracking algorithms
  • Measure relative performance between compilers and interpreters
  • Serve as a study reference for students learning algorithm design

License

This project is licensed under the MIT License.

About

PentominoSolvers
A multi-language collection of Pentomino puzzle solvers for algorithm comparison and educational purposes.
Created and maintained by sense-n-react.

About

Solve the Pentomino puzzle in 30+ programming languages — Ruby, Python, C, Go, Rust, and more.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published