Implemented a very smart cat algorithm