I use the following code to draw pentomino shapes and boards.
How can I put each pentomino in a unique style, so that each one can be rotated or flipped vertically or horizontally to fill pentomino boards.
\documentclass[12pt,a4paper]{article}
\usepackage{verbatim}
\usepackage{tikz}
\usepackage{geometry}
\geometry{a4paper, left=10mm, right=10mm, top=8mm, bottom=15mm}
\begin{document}
%begin defining shapes ==========================
\pgfmathsetmacro{\lwdth}{.3mm}% for line width
\tikzset{%
filrd/.style={%
fill=red},
filrdl/.style={%
fill=red!40!white},
filgr/.style={%
fill=green},
filbl/.style={%
fill=blue},
filbll/.style={%
fill=blue!50!white},
filcn/.style={%
fill=cyan},
filcnl/.style={%
fill=cyan!70!white},
filtl/.style={%
fill=teal},
filtll/.style={%
fill=teal!70!white},
filov/.style={%
fill=olive},
filovl/.style={%
fill=olive!80!white},
filvtl/.style={%
fill=violet!50!white},
filyw/.style={%
fill=yellow!50!white},
filbk/.style={%
fill=black},
}
%end defining shapes ==========================
%begin defining grid ==========================
\newcommand\sqw{1}
\tikzset{
pics/square/.default={\sqw},
pics/square/.style = {
code = {
\draw[pic actions, draw=none] (0,0) rectangle (#1,#1);
}}}%draw=none is to avoid displaying the little squares outline
\renewcommand\sqw{1.4}
%end defining grid ==========================
%begin defining pentoshapes ==========================
\def\pentshap#1
{%
\begin{tikzpicture}[scale=#1, transform shape]
\draw[step=\sqw] (\sqw,\sqw) grid (15\sqw, 16\sqw);
%
\node at (2.5\sqw,12.5\sqw) {\huge\bf T};
\foreach \i in {15}{
\foreach \j in {1,2,3}{
\pic[filcn] at (\j\sqw,\i\sqw) {square};};};
\pic[filcn] at (2\sqw,14\sqw) {square};
\pic[filcn] at (2\sqw,13\sqw) {square};
%
\node at (6.5\sqw,12.5\sqw) {\huge\bf U};
\foreach \i in {14}{
\foreach \j in {5,6,7}{
\pic[filcnl] at (\j\sqw,\i\sqw) {square};};};
\pic[filcnl] at (5\sqw,15\sqw) {square};
\pic[filcnl] at (7\sqw,15\sqw) {square};
%
\node at (10.5\sqw,12.5\sqw) {\huge\bf V};
\foreach \i in {13}{
\foreach \j in {9,10,11}{
\pic[filtll] at (\j\sqw,\i\sqw) {square};};};
\pic[filtll] at (9\sqw,15\sqw) {square};
\pic[filtll] at (9\sqw,14\sqw) {square};
%
\node at (14.5\sqw,12.5\sqw) {\huge\bf Y};
\foreach \i in {15,...,12}{
\foreach \j in {13}{
\pic[filrd] at (\j\sqw,\i\sqw) {square};};};
\pic[filrd] at (14\sqw,14\sqw) {square};
%
\node at (2.5\sqw,11.5\sqw) {\huge\bf W};
\foreach \i in {9}{
\foreach \j in {1,2}{
\pic[filbll] at (\j\sqw,\i\sqw) {square};};};
\foreach \i in {8}{
\foreach \j in {2,3}{
\pic[filbll] at (\j\sqw,\i\sqw) {square};};};
\pic[filbll] at (1\sqw,10\sqw) {square};
%
\node at (6.5\sqw,11.5\sqw) {\huge\bf X};
\foreach \i in {9}{
\foreach \j in {5,6,7}{
\pic[filvtl] at (\j\sqw,\i\sqw) {square};};};
\pic[filvtl] at (6\sqw,10\sqw) {square};
\pic[filvtl] at (6\sqw,8\sqw) {square};
%
\node at (10.5\sqw,11.5\sqw) {\huge\bf Z};
\foreach \i in {10,...,8}{
\foreach \j in {10}{
\pic[filrdl] at (\j\sqw,\i\sqw) {square};};};
\pic[filrdl] at (9\sqw,10\sqw) {square};
\pic[filrdl] at (11\sqw,8\sqw) {square};
%
\node at (13.5\sqw,11.5\sqw) {\huge\bf L};
\foreach \i in {10,...,7}{
\foreach \j in {13}{
\pic[filgr] at (\j\sqw,\i\sqw) {square};};};
\pic[filgr] at (14\sqw,7\sqw) {square};
%
\node at (2.5\sqw,6.5\sqw) {\huge\bf P};
\foreach \i in {5,4}{
\foreach \j in {2,3}{
\pic[filov] at (\j\sqw,\i\sqw) {square};};};
\pic[filov] at (2\sqw,3\sqw) {square};
%
\node at (6.5\sqw,6.5\sqw) {\huge\bf F};
\foreach \i in {5}{
\foreach \j in {6,7}{
\pic[filovl] at (\j\sqw,\i\sqw) {square};};};
\foreach \i in {4}{
\foreach \j in {5,6}{
\pic[filovl] at (\j\sqw,\i\sqw) {square};};};
\pic[filovl] at (6\sqw,3\sqw) {square};
%
\node at (10.5\sqw,6.5\sqw) {\huge\bf N};
\foreach \i in {5,4}{
\foreach \j in {11}{
\pic[filtll] at (\j\sqw,\i\sqw) {square};};};
\foreach \i in {4,...,2}{
\foreach \j in {10}{
\pic[filtll] at (\j\sqw,\i\sqw) {square};};};
%
\node at (13.5\sqw,6.5\sqw) {\huge\bf I};
\foreach \i in {5,...,1}{
\foreach \j in {13}{
\pic[filbl] at (\j\sqw,\i\sqw) {square};};};
\end{tikzpicture}
}%
%end defining pentoshapes ==========================
\begin{center}
The 12 Pentominoes shapes
\pentshap 1
\end{center}
\newpage
\begin{center}
\begin{tikzpicture}[scale=1, transform shape]
\draw[step=\sqw] (\sqw,\sqw) grid (9\sqw, 9\sqw);
\foreach \i in {5,4}{
\foreach \j in {4,5}{
\pic[filbk] at (\j\sqw,\i\sqw) {square};};};
\end{tikzpicture}
\end{center}
\end{document}




pentominoN, but you can add it to all the pieces until you have your draw complete and then comment it or remove it. – Juan Castaño Jan 31 '22 at 07:09