Motivation: I have a grinder that spawns spiders which are then moved to a very small space. When they accumulate in big enough numbers, I pull a lever and let a piston crush them 11 times. Then I can kill them with one hit and harvest experience.
This becomes a problem once there are a lot of spiders - the game starts to lag and it is difficult (if not impossible) to have the precise number of hits.
Question: For some n, how do I create a circuit that generates n impulses before shutting down?
Or in this case, how do I make a piston hit exactly 11 times?