Algorithms implemented for fun