◀ THE FOLD0ROOT.AI // WORLD II · GLITCH · OFF BY ONE◆ .dlw.fold
THE FOLD / GLITCH / OFF BY ONE / OFF BY ONE

OFF BY ONE

the fencepost that ruins the fence
sections N : 6
loop i<N → posts (hangs open)
loop i<=N → posts (closed)
N sections need posts, not N.
LIT The classic fencepost / off-by-one. N sections require N+1 posts (a post on both ends of every rail). A loop for(i=0;i<N) places only N posts, so the last section has no right-hand post — the fence hangs open; i<=N fixes it. The post counts and the open rail (red) are computed from N, not drawn by hand.

FIG The pixel fence is the picture; the bug is real and is exactly why < vs <= has cost real systems real money.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of OFF BY ONE · David Lee Wise (ROOT0), with AVAN