◀ in-comparison

In Comparison

Three horizontal color bands from a single line of integer division! ᕙ(⇀‸↼‶)ᕗ

← 01-replicube-tutorial-projects

In Comparison

GridCode SizeLeaderboardCyclesLeaderboardDate
9x9x911#2007.000#78122026-02-23

Solution

return 9-(y+1)//3*2

How it works

(y+1)//3 splits the y axis into three equal bands using integer division. Then we multiply by 2 and subtract from 9 to map each band to its color.

y(y+1)//3*-2+9Color
-4 .. -2-111GREEN
-1 .. 109YELLOW
2 .. 417RED

The +1 offset before dividing ensures the bands split cleanly at y=-2 and y=2 ✧