Circular Buffer was today’s C# exercise. It was a fairly tricky one. I wanted to watch for the pointers to overlap which doesn’t really work when capacity is one. Instead I switched to a counter that keeps track of how many are stored. It worked better and cleaner that way.

I don’t think their solution is very good. It works but it allocate memory and uses a list object instead of a fixed array. Circular buffers shouldn’t be allocating memory, and a list is O(n) access while an array give O(1). I feel like they missed the point of the circular buffer.

The new project is 2048. I am going to use the version from “The Big Book of Small Python Projects” by Al Sweigart as a guide. It won’t be just a copy. Mine will be written it in C++, and it will be graphical using SDL2 (his is text only). I spent way too much time wresting with CMake (I am building under WSL right now, will port to Visual Studio later), and SDL2 (should I have switched to SDL3). All I have to show for it is a 4×4 grid with numbers on it.