Many composers have written “musical puzzles,” compositions that were amusing to them, if not to their listeners, who probably did not recognize them as such. Haydn’s Piano Sonata in A, for example, contains a minuet “al rovescio” (in reverse), in which the second part is exactly the same as the first, but played in reverse.
Similarly, in one section of Arnold Schoenberg’s Pierrot Lunaire, the music goes forward to a midway point and then works its way exactly backward.
Paul Hindemith has gone them one better. In Ludus Tonalis, the Postlude is, with the addition of a final chord, the same as the Prelude, but the score is played upside down and backward.