The Algorithm of Salsa

Salsa dancing is often perceived as pure feeling, but it is built on a rigid logical framework. By deconstructing the movement into variables—Timing, Space, and Energy—we can program the perfect Basic Step.

Scroll down to compile the code.

1. The Temporal Grid

Salsa music is played in 4/4 time, creating an 8-count loop. However, we only step on 6 of those beats. The secret isn't when you move, but when you don't.

Status: Idle

2. The Spatial Logic

The Basic Step is a linear oscillation along the Y-axis. We alternate moving one foot while the other acts as an anchor.

L
R
// Code Logic if (count == 1) { ... }

3. Parameter: Step Size

Why small steps? Because of Recovery Time. Large steps create distance that cannot be traversed before the next beat arrives.

Efficiency: Optimal

4. The Z-Axis (Damping)

Beginners tend to oscillate vertically (bounce). This wastes energy ($E_{total}$). Professional dancers isolate movement to the horizontal plane.

Potential Energy (ΔY): 0

5. The Full Simulation

Let's run the full algorithm with audio. Sync your breathing: Inhale on 1-2-3, Exhale on 5-6-7.

L
R