
Binary patterns, algorithms, and error correction in the tie-dye looms of Telangana.
The Pattern Problem
In the town of Pochampally, about fifty kilometres east of Hyderabad in Telangana, a fourteen-year-old girl named Lakshmi sat beside her mother at a wooden loom and stared at a bundle of yarn that looked like a mess.
The yarn was cotton, dyed in alternating bands of red and white. But it wasn't dyed after weaving — it was dyed before. Each individual thread had been tied tightly at specific intervals with wax-coated string, then dipped in red dye. The wax resisted the dye, so the tied sections stayed white while the exposed sections turned red. When the ties were removed, the thread had a precise pattern of red and white segments along its length.
This process is called ikat — from the Malay-Indonesian word meaning "to tie" — and Pochampally is one of the most famous ikat weaving centres in the world. The Pochampally telia rumal (oil-treated cloth) has been woven here for over five hundred years, and in 2021, it received a Geographical Indication (GI) tag from the Indian government, recognising its unique origin and method.
But Lakshmi had a problem. She was learning to create a new pattern — a geometric diamond design with eight repeating units across the width of the cloth. Her mother, Padma, had shown her the design on graph paper: each diamond was made of diagonal lines that shifted one thread to the left or right on each row, creating a zigzag that formed a diamond shape when you stepped back and looked at the whole cloth.
"I understand the picture," Lakshmi said. "But how do I turn this picture into ties on the yarn?"
From Picture to Instructions
Padma smiled. This was the hard part. The beautiful pattern on the graph paper had to be translated into a sequence of tie and skip instructions for each thread — and there were over six hundred threads in the warp (the vertical threads on the loom).
"Think of each thread as a line of instructions," Padma said. "At each centimetre along the thread, you either tie (the thread stays white at that point) or skip (the thread gets dyed red at that point). Tie means protected. Skip means exposed."
She picked up a single thread and showed Lakshmi the pattern for the first thread: skip, skip, tie, tie, tie, skip, skip, tie, tie, tie, skip, skip... A repeating sequence.
"But the second thread is different," Padma continued. She shifted the pattern by one position: skip, tie, tie, tie, skip, skip, tie, tie, tie, skip, skip, skip... The same pattern, offset by one.
Lakshmi stared. "Each thread has the same basic pattern, but shifted by one position from the thread next to it?"
"Yes. And that shift is what creates the diagonal line. When you weave them together, thread 1's white section is one position higher than thread 2's white section, which is one position higher than thread 3's. The eye connects them into a diagonal line."
The Algorithm
That night, Lakshmi sat at the family's old computer and tried to write down her mother's instructions as clearly as she could. She realised she was writing something very specific: a set of rules that transforms an input (the design) into an output (the tying pattern for each thread) through a defined sequence of steps. Her computer science teacher had a word for this: an algorithm.
The algorithm for the diamond ikat pattern went like this:
Step 1: Define the base pattern for one thread as a sequence of 1s and 0s, where 1 means "tie" (protect from dye) and 0 means "skip" (expose to dye). For the diamond, the base pattern was: 0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,1 — groups of three zeros and five ones, repeating.
Step 2: For each subsequent thread, shift the pattern by one position to the right. Thread 2 starts where thread 1 had its second element. Thread 3 starts at thread 1's third element. And so on.
Step 3: After the pattern has shifted enough positions to reach the widest point of the diamond (the midpoint), reverse the direction of the shift. Now each thread shifts one position to the left, creating the other half of the diamond.
Step 4: Repeat the entire sequence for as many diamonds as needed across the width of the cloth.
Lakshmi realised this was essentially a modular arithmetic operation — each thread's pattern was the base pattern shifted by (thread number modulo pattern length) positions. The "modulo" operation meant the pattern wrapped around, creating seamless repetition.
Binary and Error
Something else struck Lakshmi. The entire pattern could be described using only two symbols: 1 (tie) and 0 (skip). Protected or exposed. On or off. This was exactly what her computer science teacher called binary — the language of computers, where everything is encoded as sequences of 0s and 1s.
She drew out the first ten threads of the diamond pattern as a grid of 1s and 0s. It looked exactly like a bitmap image — a digital picture where each pixel is either on or off. The weavers of Pochampally had been creating binary-encoded images for five centuries, long before the first computer was invented.
But there was a problem with binary systems — one that both weavers and computer scientists struggled with. Errors.
"Amma," Lakshmi said the next day, "what happens if you accidentally tie one extra section on a thread? Or skip one you should have tied?"
Padma nodded gravely. "That's the worst thing that can happen. One wrong tie doesn't just affect one thread — it shifts the whole pattern. The diagonal line breaks. The diamond distorts. And you don't notice until you've woven twenty rows and it's too late to fix."
This was the analog equivalent of a bit error in digital communication — one flipped bit that corrupts the entire message. In computer science, the solution is error detection and correction codes — extra bits of information added to the data that allow the receiver to detect and sometimes correct errors.
The weavers had their own version. Padma showed Lakshmi how experienced weavers used a counting string — a separate reference thread with knots tied at every pattern boundary. After tying each section of the work thread, the weaver checked it against the counting string. If the count didn't match, there was an error. This was essentially a checksum — a simple, redundant check that catches mistakes before they propagate.
"Your grandmother could also tell by feel," Padma added. "She'd run her fingers along the tied thread and know from the spacing whether a tie was in the wrong place. Fifty years of practice gave her an error-detection system in her fingertips."
The Weaving
Weeks later, Lakshmi's threads were ready. Six hundred and forty threads, each one precisely tied and dyed, each one carrying its own shifted copy of the binary diamond pattern. She mounted them on the loom, threaded the shuttle with the weft (horizontal) yarn, and began to weave.
Row by row, the pattern emerged. What had been invisible — hidden in the tied segments of individual threads — became visible as the threads came together in the cloth. The diamonds appeared as if by magic, their diagonal lines crisp and even, their symmetry perfect.
Lakshmi looked at the cloth and thought about two things simultaneously. She thought about her mother and grandmother and the five hundred years of weavers who had perfected this technique through trial and error. And she thought about Alan Turing and binary and algorithms and error correction.
The weavers of Pochampally had discovered these principles in thread and dye. The computer scientists had discovered them in circuits and code. The principles were the same. Only the materials had changed.
A tourist from Hyderabad came to the workshop and asked how the pattern was made. Lakshmi thought about explaining binary encoding and modular shift registers and checksums. Instead, she said what her mother always said:
"We tie and dye. Thread by thread."
It was true. It just wasn't the whole truth.
The end.
Choose your level. Everyone starts with the story — the code gets deeper as you go.
Here is a taste of what Level 1 looks like for this lesson:
import numpy as np
import matplotlib.pyplot as plt
# Your first data analysis with Python
data = [45, 52, 38, 67, 41, 55, 48] # measurements
mean = np.mean(data)
plt.bar(range(len(data)), data)
plt.axhline(mean, color='red', linestyle='--', label=f'Mean: {mean:.1f}')
plt.xlabel("Sample")
plt.ylabel("Value")
plt.title("Binary Patterns, Algorithms & Error Correction — Sample Data")
plt.legend()
plt.show()This is just the first of 6 coding exercises in Level 1. By Level 4, you will build: Build an Ikat Pattern Generator.
Free
Level 0: Listener
Stories, science concepts, diagrams, quizzes. No coding.
You are here
Level 0 is always free. Coding levels (1-4) are part of our 24-Week Bootcamp.
How Pochampally ikat weavers encode geometric designs as binary sequences — and the algorithms and error-checking they use.
The big idea: "The Ikat Weaver of Pochampally" teaches us about Binary Patterns, Algorithms & Error Correction — and you don't need to write a single line of code to understand it.
Imagine you have a torch and you need to send a message to a friend on the other side of a dark field. You can only do two things: light on or light off. That is it. No colours, no brightness levels — just on or off. Can you send complex messages with just two states?
Yes, you can — and this is the foundation of every computer, every digital phone, every piece of the internet. Binary is a numbering system that uses only two digits: 0 and 1. In a computer, 0 means "no electrical signal" and 1 means "signal present." In the Pochampally loom, 0 means "expose to dye" and 1 means "tie to protect from dye." The code is the same — only the medium changes.
With one binary digit (called a bit), you can represent two states: 0 or 1, yes or no, on or off. With two bits, you can represent four states: 00, 01, 10, 11. With eight bits (a byte), you can represent 256 states — enough to encode every letter, number, and punctuation mark in English. With millions of bits, you can encode photographs, music, and video.
The Pochampally weavers think of each centimetre of thread as one bit: tie (1) or skip (0). A thread with 100 positions encodes a 100-bit pattern. Six hundred threads, each 100 bits long, create a 60,000-bit image — a bitmap. The weavers of Pochampally have been working in binary for five hundred years, without ever using the word.
Key idea: Binary uses just two states (0 and 1) to encode any information. With enough binary digits (bits), you can represent text, images, sound, or anything else. Ikat weaving encodes patterns as binary: each point on a thread is either tied (1) or exposed (0).
A recipe tells you: take these ingredients, do these steps in this order, and you get a cake. An algorithm is the same idea applied to information: take this input, follow these precise steps, and you get a predictable output. The crucial word is precise — an algorithm must be so clear that someone (or a machine) can follow it without needing to make any decisions or guesses.
The Pochampally diamond algorithm is a perfect example. The input is a base pattern (say, 00011111). The steps are: (1) Write this pattern for thread 1. (2) For thread 2, shift the pattern one position to the right. (3) Keep shifting for each subsequent thread until you reach the midpoint. (4) Reverse the shift direction. The output is a set of six hundred tying instructions that, when woven, produce a diamond pattern.
Notice that the algorithm does not say "make it look like a diamond." It says "shift by one position for each thread." The diamond emerges from the algorithm — it is not designed directly. This is a powerful idea in computer science: complex patterns arising from simple, repeated rules. It appears everywhere, from snowflake formation to fractal geometry to cellular automata.
Every algorithm has three properties: (1) Finiteness — it must eventually stop. (2) Definiteness — each step must be unambiguous. (3) Effectiveness — each step must be something you can actually do. The Pochampally tying algorithm satisfies all three: it processes a fixed number of threads (finite), each step is "tie or skip" (definite), and a weaver can physically perform each tie (effective).
Key idea: An algorithm is a precise, finite sequence of unambiguous steps that transforms an input into an output. Complex patterns can emerge from simple algorithms — the Pochampally diamond arises from a single rule: shift the base pattern by one position per thread.
Access all 130+ lessons, quizzes, interactive tools, and offline activities
Look at a clock. When it is 11 o'clock and you add 3 hours, you do not get 14 o'clock — you get **2 o'clock**. The numbers "wrap around" when they rea...
Imagine you are reading a phone number aloud to a friend: "9-8-4-0-1-2-3-4-5-6." Your friend writes it down but accidentally writes "9-8-4-0-1-2-3-4-5...