What are steps?

By: Yamamoto

Summary: This is essay two in a series exploring the Chromie Squiggle trait data. In this essay, we explore the 'Steps Between' trait. You can read the first essay, about segments, here

TLDR:
1. Squiggles are made of hundreds or thousands of circles. A step is just a circle.
2. The Steps Between trait is always one short.

50 should be 51.
200 should be 201.
1000 should be 1001.

What is a step?

Chromie squiggles are made by generating hundreds or thousands of circles. These circles are layered on top of another, slightly alternating their color and position on the screen.

The term 'step' refers to an individual circle, the smallest building block of a Squiggle. Below, you can see the first 50 circles (steps) being generated in Squiggle 1177.

An example image

When you look at the trait data for any specific squiggle, you will see the “Steps Between:" trait with one of three values, 50, 200 or 1000.

An example image

The Steps Between trait tells you the number of circles in each segment. A segment is a collection of circles. The three Steps Between values will always map to a specific squiggle type.

50 steps: Slinkys and Pipes
200 steps: Normal, Ribbed, Bold
1000 steps: Fuzzies

An example image

In summary, a step is just a single circle. And the Steps Between trait tells us how many circles are in each segment.

Why is the 'Step Between' trait innacurate?

The Steps Between trait data is always one circle short of what the code actually ran. If you look at the squiggle codebase, you can see steps are defined here:

An example image

The steps variable is in fact set to 50, 200, or 1000 steps. When the codebase actually loops and generates these circles, it was instructed to create one more than expected. Here's the code where this is defined.

An example image

So what does this code say? Put simply, create a circle for every number 0 through 50. Accounting for 0, this actually creates 51 unique circles.

The key issue here is the less than or equal to operator.

If it had just been less than, the code would run exactly 50 times. The less than or equal to operator, means it runs one extra.

More detail for those of you who are interested:

i = 0, This creates a counter variable called i, and sets it to 0.

i++, Everytime a step is created, add 1 to our counter variable.

(i <= steps), Keep creating new steps, until the counter is less than or equal to the number of steps.

Below is a code editor where I've set the steps to 50. I copied the loop exactly from the Squiggle codebase but simplified to just tell us exactly what step it created. When you run it, you will notice it loops 0 through 50. Accounting for the 0, this is 51 steps, not 50.

Loading...

You'll need to scroll in the terminal below to see all the iterations

Summary

In conclusion, the official 'Steps Between' trait data is consistently one circle short of what the code actually generates. If you want your true step data, just add one to the Steps Between trait. While this doesn't have a huge impact on the visual nature of a squiggle, it does have an impact on some downstream traits. I will explore these topics in later essays.