public class BitPerson {
    
    private byte data;
    
    public Person(byte data) {
        this.data = data;
    }
    
    public boolean isAdult() {
        return (data & 0b00000001) != 0;
    }
    
    public void growUp() {
        data |= 0b00000001;
    }
    
    public boolean isBoring() {
        return (data & 0b00000010) != 0;
    }
    
    public void turnBoring() {
        data |= 0b00000010;
    }
    
    public void haveFun() {
        data &= ~0b00000010;
    }
 
    //between 0 and 7
    public int getScore() {
        return (data & 0b00011100) >> 2;
    }
    
    public void setScore(int value) {
        data &= ~0b00011100;
        data |= (value << 2) & 0b00011100;
    }
    
    public boolean isReady() {
        return (data & 0b00100000) != 0;
    }
    
    public void changeReadyState() {
        data ^= 0b00100000;
    }
    
    public void printInfo() {
        String str = "This person is a ";
        str += isBoring() ? "boring" : "fun";
        str += " ";
        str += isAdult() ? "adult" : "child";
        str += " with a score of " + getScore();
        str += ". ";
        if (isReady()) {
            str += "Ready for action.";
        }
        System.out.println(str);
    }
    
    public byte getDataForSync() {
        return data;
    }
    
    public void setDataFromSync(byte data) {
        this.data = data;
    }
}