void floodfill(int x, int y, int color) {
int[] left = { x - 1, y };
int[] right = { x + 1, y };
int[] up = { x, y - 1 };
int[] down = { x, y + 1 };
past.add(new Point(x, y));
if (block[x][y].getColor() == color) {
past_temp.add(new Point(x, y));
count++;
if (left[0] != -1 && !isInList(left[0], left[1])) {
floodfill(left[0], left[1], color);
}
if (right[0] != 10 && !isInList(right[0], right[1])) {
floodfill(right[0], right[1], color);
}
if (up[1] != -1 && !isInList(up[0], up[1])) {
floodfill(up[0], up[1], color);
}
if (down[1] != 10 && !isInList(down[0], down[1])) {
floodfill(down[0], down[1], color);
}
}
}