/tetromino

This program solves tetromino puzzles and they are written in Ruby language.

Primary LanguageRuby

This program solves tetromino puzzles.

What is a Tetromino Puzzle?

A tetromino is a shape made up of four squares, with each square connected along its sides. There are 5 different types of tetrominoes, as shown below:

  • I-shaped tetromino
  • L-shaped tetromino
  • T-shaped tetromino
  • O-shaped tetromino
  • Z-shaped tetromino
oooo

o
ooo

 o
ooo

oo
oo

oo
 oo

The goal of the puzzle is to arrange the tetrominoes to fit into a specific shape, usually a rectangle. If two patterns are symmetrical or one can be rotated to match the other, they are considered identical.

This program offers three different types of puzzles:

find4x2.rb

The rectangle is a 4x2 grid. You can use two identical tetrominoes. This is the easiest puzzle in the repository.

find4x4.rb

The rectangle is a 4x4 grid. You can use two identical tetrominoes, but you must use at least three different types.

find6L.rb

Use six L-shaped tetrominoes and form a rectangle.

How to use the programs

  1. Install Ruby.
  2. Download the files.
  3. Run a terminal (a shell in Linux or Command Prompt in Windows).
  4. Type "ruby find4x2.rb" in your terminal.
  5. Do the same for "find4x4.rb" and "find6L.rb"