I've recently been working on a number of small test programs for the different sections which make up a game I'm planning on writing. One of these test systems involved a series of polyominoes which I needed to rotate. Internally, the data for these shapes are stored as a simple boolean array, which I access as though it were two dimensions. This article and corresponding source code download describe how to rotate 2D rectangular arrays (or 1D arrays that masquerade as 2D) in 90° intervals clockwise or anti-clockwise.

Continue Reading