I've got a reason to count a number of marbles in a game. Up to about 100. I can feed them down a track one at a time. I can ensure that they each go down separately, although I can't accurately control the distance between them. Marbles are glass and hence they are both translucent and reflective. They vary in diameter between about 16mm to 18mm, and are not perfectly spherical, although they roll easily down a 2% slope.

I had several ideas in mind and I wonder if anyone has any practical experience on this. Almost certainly, it will involve a uC that counts pulses. To make a pulse, I suppose I could have some kind of beam breaker. Or have each marble land on a piezo. Or even activate a micro switch. I'm sure each of these has it's own advantages and drawbacks, but before I make a prototype I'd like to canvas any suggestions first.

I know this is also an engineering question, but I thought this board would be more or less the best.