Evolutionary dynamics of altruism and cheating among social amoebas