So there is little possibility of creating a code that seeks "pleasure" and avoids "pain"? That's how humans learn on a very basic level and should be easy to codify.
Nope, pleasure of the individual is not pleasure if it causes the majority of the group pain, but the individual wouldn't know. Like a general charging itself at enemy ranks. Highly pleasurable for the general. Highly painful for the army and the player.

Forcing the individual to listen to the group would work better, but isn't very adaptive.