◀ conditions-may-apply

Conditions May Apply

Top half DARKBLUE, bottom half ORANGE, solved with pure bit math! (¬‿¬)

← 01-replicube-tutorial-projects

#1 on the code size leaderboard!

Conditions May Apply

GridCode SizeLeaderboardCyclesLeaderboardDate
7x7x76🏆 #14.000#1582026-02-23

Solution

return y+11&-4

How it works

y+11 shifts our coordinate range from {-3..3} to {8..14}. Then bitwise AND with -4 (which is ...11111100 in binary) rounds everything down to the nearest multiple of 4.

yy+11&-4Color
-3 .. 08 .. 118ORANGE
1 .. 312 .. 1412DARKBLUE

Pure bit math, no branching needed! ᕦ(ò_óˇ)ᕤ