If life is a cosmic accident, by definition there is no purpose for it. There are not, and cannot, be "rules" for an "accidental collocation of molecules".
Life is an accident, some day you will die. Soon after, your remaining friends and family members will die, and no one will remember you or anything you have done. Even if you have some fame you might be remembered for a decade or even 100 years - maybe even 1,000. But, eventually the sun will burn out, and no one will remember, or be affected by, any good or bad that you or anyone else has done. This is the reality of the materialist, but they do not live consistently with their reality. They live as if actions matter, as if people matter, as if love matters. They cannot avoid the reality that it all matters, and it could only matter if the material world is not accidental but purposeful. Ironically, all of their senses tell them that it is purposeful, but, they suppress even the evidence of their own senses.