Blog.

An experiment in programmatic and artistic constraints

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

Takes three non-negative integer arguments: x , y , t ( x and y less than 16 ).

, , ( and less than ). Returns a non-negative integer less than 16 2 .

. The code can be syntactically written in a 16x16 block of characters.

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