Itunes: Flipping Pancakes

A game of 0s & 1s.

This game has the simple goal of turning all sides of all the pancakes red.

Download from Itunes

Here is how the game begins:


The base of the bottom most pancake touches the fire; it is colored red and has an assigned weight = 1.

[You may add more pancakes and select different gaming modes.]

Tap on a pancake to make it flip.



The flip occurs keeping the single stack structure intact i.e. when you tap a pancake all pancakes above it flips along with it. Its like flipping them with a spatula. [The process is much the same for preparing Roti/Indian bread on a tava/frying pan]


Now consider this:

Observe the binary string 00 00 01 (0 is weight of the untoasted side; 1 is the weight of the toasted side) generated in the above example.

You always start with decimal 1 (binary equivalent of 00 00 01).

When you reach the goal you generate 11 11 11 (ie. 2^2n -1: where n is the number of discs/pancakes).

So you start with decimal 1 and end with decimal 2^2n-1, and each flip gives you an integer in the range of 1 to 2^2n-1.

Try generating different integers in the quickest possible way.

Is it possible to generate all integers in the range of 1 to 2^2n -1?