title: An experiment in programmatic and artistic constraints date: February 8, 2020 13:29 ---

Write a piece of JavaScript that defines a function named s that

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.

In code:

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)

An example