Living Museum of Learning

Where real moments become exhibits
← Prev Next →
From a Harp to a Net

From a Harp to a Net

A soccer goal, a right triangle, and the moment a for loop became inevitable.

Jayden was building a soccer stadium for our 2026 World Cup P5JS Challenge.

His goal frame already looked beautiful, but the net behind it was still missing. The first attempt was simply a rectangle. It worked—but it didn't look like a real soccer net.

During class, inspiration struck.

Instead of continuing with P5JS, we completely changed direction.

We returned to Python turtle graphics, a language Jayden had learned weeks earlier but hadn't touched for some time.

The mission was no longer "draw a net."

The mission became:

Discover the algorithm behind a net.

We began with the simplest possible drawing.

One line.

Then a right triangle.

Then the same triangle using user inputs instead of hard-coded numbers.

Everything felt familiar.

Then came a question.

"At the middle of the base, how tall should the vertical line be?"

Jayden answered immediately.

"a / 2."

Perfect.

Another question followed.

"What about the quarter position?"

After several rounds of debugging, another vertical line appeared.

Then another.

The triangle slowly transformed into something resembling the strings of a harp.

The real challenge, however, had not yet arrived.

Now we introduced a new variable.

Instead of using the middle or quarter positions, we asked the user to enter any spacing n.

A tiny right triangle appeared inside the large one.

Both triangles were similar.

Jayden quickly recognized the relationship:

a / b = m / n

But finding m from the other three quantities wasn't immediate.

For several minutes, he simply lived inside the confusion.

There was no rush.

Eventually the formula emerged.

m = a × n / b

The mathematics was now ready to become code.

The first line appeared at:

b − n

The second:

b − 2n

The third:

b − 3n

Suddenly, the pattern became obvious.

The repeated code wanted to become a for loop.

The loop wasn't introduced because Python has loops.

The loop appeared because mathematics demanded one.

Near the end of class, I asked,

"Jayden, do you have any idea why we bothered doing all this?"

He didn't answer.

Instead, he quietly switched back to his P5JS World Cup project.

He rotated the soccer goal to reveal the empty space where the net should be.

No words were necessary.

The Python program had never been about turtle graphics.

It had always been about building a real soccer goal.

Before the class ended, Jayden shared:

a video of the turtle drawing every line one by one,
a screenshot of his whiteboard investigation,
the similarity equation a / b = m / n,
and the complete Python program.

The algorithm had been discovered.

Next time, we will add the horizontal lines.

The harp will become a real net.

A soccer net can emerge naturally from similar triangles, algebra, and a single for loop.

A real project leads to mathematical modeling. Mathematical modeling leads to an algorithm. The algorithm naturally becomes code.

Programming becomes far more meaningful when students see mathematics as a creative tool for building something they genuinely care about.