Class 6 · Unit 5: Computational thinking · Lesson 5.2 · 40 min
The weaver's code
An old man reads out numbers — "three of red, two of green…" — and a weaver builds a shawl from them. Kashmiri weavers were running code long before computers.
Today you will: Find the part of a pattern that repeats · Write it as a short code, like a talim · Make Scratch draw a border with one loop
Story
In a small workshop in Kanihama, near Srinagar, a weaver sits at a wooden loom. He does not look at a picture of the shawl. Instead, an older man sits beside him and reads aloud from a paper full of numbers and signs.
He calls out: "Three of red, two of green, three of red…"
The paper is called the talim. A designer, the naqash, first draws the pattern on graph paper. Then a specialist turns the drawing into a code: which colour, and how many threads, in each row. The weaver follows the code row by row, using small wooden spools called kanis, each carrying a different coloured thread. That is how a Kani shawl gets its name.
Kashmiri weavers were following written instructions to build a pattern long before computers existed. That is exactly what a computer program is.
Watch
The talim: Kashmir's oldest computer code? — scan code 6.5.2 in the printed book.
Warm up your fingers
Practise top-row letters and brackets, because code uses symbols.
- typing.com: Beginner → Top row lessons
- Then type this line three times without mistakes:
repeat (10) [ move (20) turn (90) ]
On the laptop
You need: Scratch Desktop (offline, no account) — or scratch.mit.edu without signing in
Mission 1: Draw one tooth (pairs, 7 min)
- ☐1
Open Scratch. Click Extensions (bottom left) and add Pen.
- ☐2
Under when green flag clicked, drag in:
erase all→go to x: -220 y: 0→pen down→set pen size to 4. - ☐3
Add one zig-zag tooth:
set pen color to (red)→move 20→turn ↺ 45→move 15→turn ↻ 90→move 15→turn ↺ 45. Click the flag — that's your repeating unit.
Mission 2: Loop it (pairs, 8 min)
- ☐4
Predict: if you repeat the tooth 10 times, how wide will the border be — half the stage, or all of it?
- ☐5
Wrap the tooth blocks inside repeat (10). Run it. You have a border!
- ☐6
Inside the repeat, add
change pen color by (20)so the teeth change colour. - ☐7
Write your talim in a comment (right-click → Add Comment), e.g.
10 × [ red 20, up 15, down 15 ]. Swap laptops: can the next pair say what your border looks like before clicking the flag?
Finished early?
Add a second repeat that draws a matching border below the first (hint: go to x: -220 y: -40).
No laptop today?
On squared paper, colour a 3-square unit (red, red, green). Write its talim: 3 × [red, red, green]. Swap
with a partner — can they weave your border from the code alone?
Now you know
- A pattern is something that repeats in a way you can predict.
- The repeating unit is the smallest piece that repeats.
- A loop tells a computer to do the same steps again and again — in Scratch,
repeat— so you write the unit once. - The talim is a code: symbols that tell someone exactly what to do, step by step.
- AI starts by finding patterns in data, the way a weaver reads a design.
- The same idea everywhere: the khatamband ceilings from Lesson 3.2 are one small unit, repeated by a rule.
Debate it
A computer can now copy any shawl pattern in seconds, and machines can weave fast. What is lost if the talim and the weavers who read it disappear? What does a person bring that a machine cannot?
Check yourself — practice, not a test
1. What is a talim?
- ○ A type of wool
- ○ A written code that tells a weaver how to make a pattern
- ○ A kind of loom
- ○ The name of a shawl colour
2. The smallest part of a pattern that repeats is called the repeating ______.
3. Which Scratch block makes the same steps happen many times?
- ○ move
- ○ turn
- ○ repeat
- ○ pen down
4. Match each word to its meaning:
Naqash · Talim · Kani · Loop
Match with: a small wooden spool of coloured thread · the code for the pattern · repeating the same steps · designs the pattern on graph paper
Remember
Find the part that repeats, write it once, and let the loop do the rest.