This is my first mini-experiment with an algorithm. Just do what the cat tells you to do and be amazed!
I worked out all the programming by myself, but I got the idea from a course on C# from udemy.com