The grayscale pyramids are used to track your number of moves. They all begin lying flat; whenever you swap pieces on the board, you must also stand up a grayscale pyramid.
When all of these pyramids are upright, the game is over.
(If you didn't win in under 27 moves, you can continue to measure your performance by reversing the scoring track, flattening the scoring pyramids as extra turns are taken, to see how far over “par” you went.)