I believe you are reading a novel? The author is using a literary technique here called personification, which gives non living things life-like qualities. So the “play” here is more describing the light from the sun hitting the carpet in a moving and joyful way. I hope this helps :)