Skip to main content
1 of 4
Kyle Kanos
  • 4.4k
  • 2
  • 19
  • 31

#Artemis Fowl

package Humans;

public class ArtemisFowl extends Human {
    public String takeSides(String history) {
        int good = 0, evil = 0;
        for(int i = 0; i < history.length(); i++)   {
            switch(history.charAt(i))   {
                case '0': evil++;
                case '1': good++;
            }
        }
        if(good % 5 == 0){
           return "good"
        } else if (evil % 5 == 0){
           return "evil"
        } else {
           if(good > evil){
              return "good"
           } else if(evil > good){
              return "evil"
           } else {
              return Math.random() >= 0.5 ? "good" : "evil";
           }
        }
    }
}

In Book 7, The Atlantis Complex, Artemis Fowl contracted a psychological disease (called Atlantis complex) that forced him to do everything in multiples of 5 (speaking, actions, etc). When he couldn't do it in some multiple of 5, he panicked. I do basically that: see if good or evil (intentional bias) is divisible by 5, if neither is, then I panic & see which was greater & run with that or panic even further & randomly choose.

Kyle Kanos
  • 4.4k
  • 2
  • 19
  • 31