private void floodfill(Point source, boolean[][] visited, int color) {
		Point[] queue = new Point[board.getHeight() * board.getWidth()];
		int queueStart = 0, queueEnd = 0;
		
		if (!board.sameColor(source, color)) {
			return;
		}
		
		queue[queueEnd++] = source;
		visited[source.getRow()][source.getCol()] = true;
		
		while (queueStart < queueEnd) {
			Point cur = queue[queueStart++];
			
			for (int direction = 0; direction < Layout.DIRECTION.length; direction++) {
				for (int k = -1; k < 2; k += 2) {
					int d = Layout.DIRECTION[direction];
					int dx = Layout.DELTA[d][0] * k;
					int dy = Layout.DELTA[d][1] * k;
					
					int newX = cur.getRow() + dx;
					int newY = cur.getCol() + dy;
					if (board.sameColor(new Point(newY, newX), color) && !visited[newX][newY]) {
						visited[newX][newY] = true;
						queue[queueEnd++] = new Point(newY, newX);
					}
				}
			}
		}
	}