The best strategy seems to be to give people the benefit of the doubt initially, being kind and altruistic without reservation. But as soon as they don’t respond in kind, you update your strategy immediately and stop extending any generosity beyond baseline courtesy. The ball is in their court now. If they switch from selfishness to altruism, then you can match them. Otherwise, don’t let yourself be exploited.
I’ve found this approach has simplified many social decisions for me. Even things like whether to say hi to a neighbor passing on the sidewalk. I used to not always be sure of the best way to handle these situations. If you give a hearty greeting and are ignored, you feel lame and rejected. If you ignore them and it turns out they are friendly, they could see you as unfriendly, or they might also be on the fence, waiting to see what you do, and by ignoring them you miss out on establishing a friendship that could be valuable to both of you in the long run.
Now it’s easy: I say hi the first time I see someone and treat them warmly. If they aren’t friendly back, I don’t worry about it. I simply ignore them now unless they make an effort to change the dynamic (happens more than you might think, actually).
This way you don’t miss out on the good people, don’t sweat the bad/manipulative people, and remain flexible in case someone was just feeling shy or having a bad day. Game theory ftw!