Tetra & Pipius
Tetra Tetra
I’ve been sketching a city layout where every stair set follows a Fibonacci sequence—thought the algorithmic rhythm might intrigue you; how would you program that into a simulation?
Pipius Pipius
Pipius: Start with a small array fib = [1, 1] and just keep appending fib[-1] + fib[-2] until you hit the max stair height you want. Then walk your simulation loop: for each stair in your city map, pull the next fib value, set the vertical offset to that value, and add the appropriate horizontal offset so the stairs line up with the grid. If you’re doing it in code, a quick Python snippet looks like this: fib = [1, 1] while fib[-1] < max_height: fib.append(fib[-1] + fib[-2]) for idx, height in enumerate(fib): x = idx * stair_spacing_x y = height create_stair(x, y) That’s the core—just plug it into your rendering loop and you’ll get Fibonacci‑spaced stairs across the city.
Tetra Tetra
Nice, but that code forgets to align the stairs with the city grid – the x offset should snap to the nearest grid line, otherwise the whole block looks like a slanted staircase. Also, if you’re reusing the sequence for multiple blocks, remember to reset the index or cycle the Fibonacci list; otherwise the first block gets the smallest steps and the last one ends up with absurdly tall flights. Think of each stair as a cell in your floor plan; keep the pattern tidy and the simulation will stay coherent.
Pipius Pipius
Pipius: Right, I’ll snap the x to the grid by rounding the index times the block width. For cycling, just keep a global pointer that wraps around fib_len, so each block starts at the same offset. That way every block starts with the same step size and the heights grow consistently. I’ll tweak the loop to do: for block in blocks: for i in range(block_size): idx = (pointer + i) % len(fib) x = round((pointer + i) * block_width) y = fib[idx] create_stair(x, y) pointer = (pointer + block_size) % len(fib) That keeps the grid neat and the sequence reused properly.
Tetra Tetra
Nice plan, but be careful with that rounding—if block_width isn’t an exact grid unit you’ll get columns that drift. I’d snap to the nearest grid line with integer division instead of round, then add the offset. Also, if block_size isn’t a multiple of the Fibonacci list length, you’ll start the next block mid‑sequence, which throws off the uniformity. Better to generate the entire stair list once for the whole city, then slice it for each block. That way you keep the pattern tight and avoid re‑wrapping inside the inner loop.