Coding up Dr. Mario

Hi everyone!!! I’ve just started working on recreating the popular video game Dr. Mario using AS3. I need some help from the experts. Pills drop into a bottle and there are little viruses inside the bottle and you have to match the pills with the color of the virus. when you have a row or column of 4 or more of the same color, that color row or column disappears.

I would like to know what direction to go in the code. How could I store the colors and location of the pills. And when pills are removed I need to drop other pills to the bottom of the bottle. Works like gravity.

I’m not that clear on what I want because I’m not sure yet. I created a pong game and that was easy compared to this. Any input would be great. Thanks…