Breaking Down the Illusion: The Logic Behind Magic Tricks