The sinusoidal tetris

1 minute read

Let’s play Tetris, but with a twist. No geometrical figures will fall from the sky. Instead, you control a sinusoid, defined by: \(f(x)=A*sin(\omega x + \varphi)\):


Free suggestions in the beginning. If you follow all of them, you win.
Turn-Based Mode (the sinusoid doesn’t drop automatically)

(Source code)


Controls

  • To increase the angular frequency, \(\omega\), press: s;
  • To decrease the angular frequency, \(\omega\), press: x;
  • To increase the amplitude, \(A\), press: a;
  • To decrease the amplitude, \(A\), press: z;
  • To increase the phase: \(\varphi\), press: q;
  • To decrease the phase: \(\varphi\), press: w;
  • To drop the sinusoid, press p;

To win the game, you need to reduce the signal as close to zero as possible. It’s hard but not impossible. There’s a current threshold of unit * 0.3. Surviving is not winning. The Path of the Alternating Phases is boredom.

You lose if the original signal spikes outside the game buffer (canvas).

A professional player turns off the suggestions, now enabled by default. If you are a savant, you can compute the Fourier Series Coefficients in your head. Cancel that noise!

To better understand what is happening, check out this first article of a series.


The game was developed using p5js.

The source code (here) is not something I am particularly proud of.


Some discussion from around the web:


This game is a joke I put together during a weekend. I’m sorry for the graphics.

Updated:

Comments