OpportunistJAVA: Opportunist
package Humans;
/**
* Always follows the group who was strongest the last turn.
*/
public class Opportunist extends Human{
@Override
public String takeSides(String history) throws Exception {
int participants = history.length();
String str = history.replace("0", "");
int good = str.length();
return (good > participants/2 ? "good" : "evil");
}
}