Deep in the Clay Tunnel are the Underground Ruins. These ruins are
seldom seen caves which hold a massive puzzle. The first one is the
focus of the Pokémon Regirock and has you have to do a puzzle that can
only be known if you visit the place at Day and night. The puzzle
requires you to move 6 steps down from the centerpiece and then move 9
steps right. Then select down to hit a hidden switch. This changes the
ruins so Regirock becomes available
-Serebii
Make sure to get all the steps right.
Source