After displaying the tiles in the first iteration of the While loop, you then end up pointing to a null in b.brick.
To verify that this is happening, run your code in "debug" mode and look at b.brick.
Place "b.brick=First brick" after the Flip statement to point to the beginning of your type variable in your loop.
To verify that this is happening, run your code in "debug" mode and look at b.brick.
Place "b.brick=First brick" after the Flip statement to point to the beginning of your type variable in your loop.