cannibal and missionaries, javascript