I am trying to find a robust way to classify and distinguish [polyominoes](https://en.wikipedia.org/wiki/Polyomino). I would like to write a simple algorithm that could identify similar *free* polyominoes (under translation, rotation, reflection or glide reflection), given a set. Since I am new to this topic, I am getting a bit lost in the literature and I don't really know where to look.

I was thinking that something based on counting the length of the sides could work. For example, the following polyomino:

[![enter image description here](https://i.stack.imgur.com/CnpGd.png)](https://i.stack.imgur.com/CnpGd.png)

has one 5-length side, two 2-length sides and five 1-length sides. So we could describe it with the following notation: $\{(5,1),(2,2),(1,5)\}\,$, where the first number in parenthesis stands for the length of the side and the second one for the number of sides of that length. Then, all translations, rotations, reflections or glide reflections of this shape would result in the same description. Which is good.

However, this doesn't work in general. For example, the following two **different** polyominoes:

[![enter image description here](https://i.stack.imgur.com/RedIX.png)](https://i.stack.imgur.com/RedIX.png)

would result in the same description $\{(5,1), (3,1), (2,2), (1,6) \}$.

Probably, someone has already figured out a better way to do this, but, as I said, I am getting lost in the literature of the topic. Can anybody point me to the right direction?

**Update:**

Thanks for the useful suggestions in the comments. After some more research I found an interesting method, explained in the book *"Linknot: Knot Theory by Computer - S. Jablan, R. Sazdanovic"*, which works like this:

Let's imagine the path of a ray of light (bold line in figure) in a polyomino with the borders consisting of mirrors, where in every border cell we place two-sided mirrors (bolder lines) perpendicular to the internal edges in their midpoints . After a series of reflections, the ray of light will describe a shape called self-avoiding curve. If we denote a reflection in a border mirror by 0, and a reflection in an internal mirror by 1, we have 0-1 words for polyominoes, where these words are cyclically equivalent (this means, could be red starting from any sign 0 or 1 and ending in it).
For n = 1 we will have only one polyomino 0000, for n = 2 the polyomino 00010001, for n = 3 two polyominoes: 000101000101 and 000100100011, for n = 4 five of them: 0001010100010101, 0001010001100011, 001001001001, 0001001100010011, and 0001001010001011, etc.

[![enter image description here](https://i.stack.imgur.com/OGFxL.png)](https://i.stack.imgur.com/OGFxL.png)

We can translate these symbols (or binary numbers) into hexadecimal numbers and assign one number to each polyomino, in order to establish one-to-one correspondence between the numbers and polyominoes. For example, this number can be the minimum of all cyclic-equivalent symbols (e.g. to the polyomino 00010001 correspond cyclically equivalent symbols 00100010, 01000100, 10001000 and the minimum of them is 00010001 = 11 in the hexadecimal system). Hence, we have a notation for polyominoes where exactly one number corresponds to every polyomino, and vice versa.

This last part of the method is similar to what [achille hui](https://math.stackexchange.com/users/59379/achille-hui) was suggesting in his "dumb" method, in the comments. I don't know how the efficiency of this approach compares to the efficiency of the "dumb" one, but I think it should be faster, since we are only considering the "perimeter" of the polyomino and forgetting about the cells in the inside (this could be a problem for polyominoes with holes, but for my application I am only interested in the outer perimeter, so it's not a big deal).

However, I did not find a proof that in this notation *"exactly one number corresponds to every polyomino, and vice versa"*, even though it intuitively feels right.

**Update 2:**

To clarify, the reason why I want to label (or *encode* or *hash*, the difference is still not completely clear to me...) the polyominoes is because I have a code that simulates the evolution of a 2d system where the different states of the system can look like polyominoes (something like a [cellular automaton](https://en.wikipedia.org/wiki/Cellular_automaton)). Basically, labelling the different shapes would allow me to give at each state a unique identifier and, for example, efficiently count how many times a given state has been visited.