AS2 Game Logic Problem

Hey guys i solved the last problem i was having but now i need some help, i have a grid (10 by 10) and in the grid are 100 MovieClips named Dice1, Dice2, Dice3 and so on. Basically each dice is either a number between 1 and 6 or a blank frame to suggest there is no dice on that frame. I want to compare the dice in the grid to see if the dice above, below, left and right of the current dice are on the same number and then if there are 6 dice with the number 6 on them they will be removed and points added to a score. The dice don’t have to be in a line of 6 but just 6 dice connected. The idea is that if a dice is showing a number and has that amount of dice connected to it either directly or non-directly they will be removed. I can’t figure this out, please help.
(I’m trying to rebuild the PS1 game Devil Dice!)

Thanks in advance.