The Mathematics Behind Sherlock Holmes: A Game of Shadows