Label the hinged tetrominoes - [FINALIZED]
+1
−0
Now posted: Label a hinged tetromino
Given a hinged tetromino, give it a unique, consistent label.
Tetrominoes
A tetromino is a connected subset of the square tiling, composed of 4 squares, where connection can only be edge connection.
Here are the 5 tetrominoes:
Hinged tetrominoes
A hinged tetromino is a connected subset of the square tiling, composed of 4 squares, where connection can be edge connection or corner connection.
Here are the 22 hinged tetrominoes:
Input
- A 4 by 4 grid containing a hinged tetromino.
- You may take input in any convenient format that does not include full or partial precalculation.
- For example, this could be a string or sequence of strings, a 1 or 2 dimensional list/array/vector, a sequence of coordinates, or a 16 bit variable where each 1 bit represents part of the hinged tetromino and each 0 bit represents part of the background. A variable with more than 16 bits where only 16 of the bits are used would also be acceptable.
Output
- A label for the hinged tetromino.
- The label for each hinged tetromino can be anything you choose, including nothing (no output).
- Each label must be unique (it must not be the label for any other hinged tetromino).
- Each label must be consistent (a given hinged tetromino must always result in the same label, regardless of rotation, reflection, or translation).
Scoring
This is a code golf challenge. Your score is the number of bytes in your code.
Explanations are optional, but I'm more likely to upvote answers that have one.
0 comment threads