From a256aa20c993adf244c394b2121104004d7439a2 Mon Sep 17 00:00:00 2001
From: Marcin Chrzanowski
+Write a piece of JavaScript that defines a function named
+
+
+s
that
+
+
+
+x
,
+ y
, t
(x
and y
+ less than 16).
+
+The source code defining s
will be visually displayed on a 16x16
+grid. 32 times a second, it will be separately called for each x
,
+y
coordinate of the grid, initially with a t
parameter
+equal to 0, and incrementing by one with each series of calls.
+
+The result of each call to s
will determine the shade of the
+character in the corresponding grid location.
+
+var step = 0 +_frame = function() { + for (var row = 0; row < 16; row++) { + for (var column = 0; column < 16; column++) { + var shade = s(row, column, step) + var cell = display.children[row].children[column] + cell.style.color = `rgb(${shade}, ${shade}, ${shade})` + } + } + step++ +} +setInterval(_frame, 31.25) ++ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+