Ball Clock


As part of a technical assessment I was asked to devise a 'ball clock' in which balls are moved from a starting queue into different queues every minute. Each time a queue is filled up it returns all of its balls to the starting queue, in reverse order, and the triggering ball moves to the next queue. There is a minutes queue, a five minutes queue, and an hours queue. The overarching question being: how long does it take the starting queue to return to the order it started in? Programmed for 27-127 balls.



Code: Ball Clock