◀ basic-hourglass

Basic Hourglass

Who needs abs() when you have multiplication? (⌐■_■)

← 03-alice-creations-01

#1 on the code size leaderboard!

Basic Hourglass

GridCode SizeLeaderboardCyclesLeaderboardDate
9x9x910🏆 #16.395#9112026-02-23

Solution

return x*x<y*y and 9

How it works

The hourglass is every voxel where |x| < |y|. Instead of abs(x) < abs(y) (4 tokens for two abs calls), we compare squares: x*x < y*y. Squaring preserves the magnitude relationship while ditching the function calls. and 9 returns YELLOW when true, empty when false.