<commit_before>"""MBTI types.

All profile descriptions from
http://www.myersbriggs.org/my-mbti-personality-type/mbti-
basics/the-16 -mbti-types.htm:
"""

from collections import namedtuple


AttributeMatrix = namedtuple('AttributeMatrix', ', '.join([
    'strength', 'endurance',
    'defense', 'intelligence',
    'agility', 'charisma',
    'wisdom', 'willpower',
    'perception', 'luck'
]))


class MBTIType(object):
    """Base class."""

    def __init__(self, name):
        """Add attrs to personality type."""
        self._name = name
        self.hp = 100
        self.mp = 100

    def interact_with(self, neighbor):
        """Engage in an interaction with a neighbor.

        All child classes should override this method.
        """
        raise NotImplementedError

    @property
    def name(self):
        """Basic name."""
        return self._name


class Introvert(MBTIType):
    """Introverted people."""

    def interact_with(self, neighbor):
        """Engage in an interaction with a neighbor."""
        name = neighbor.name
        if name.startswith('i'):
            print('Hello fellow introvert ({}).'.format(name))
            self.hp = min(self.hp + 1, 100)  # Cap hp to 100
        else:
            print('...')
            self.hp -= 1


class Extrovert(MBTIType):
    """Extroverted people."""

    def interact_with(self, neighbor):
        """Engage in an interaction with a neighbor."""
        name = neighbor.name
        if name.startswith('e'):
            print('Hello fellow extrovert ({}).'.format(name))
            self.hp = min(self.hp + 1, 100)  # Cap hp to 100
        else:
            print('...')
            self.hp -= 1


class Istj(Introvert):
    """A Meyer-Briggs personality type indicator.

    'Quiet, serious, earn success by thoroughness and dependability. Practical,
    matter-of-fact, realistic, and responsible. Decide logically what should be<commit_msg>Add new character profile properties, and helper methods. Also check if a character has died.<commit_after>"""MBTI types.

All profile descriptions from
http://www.myersbriggs.org/my-mbti-personality-type/mbti-
basics/the-16 -mbti-types.htm:
"""

from collections import namedtuple

from faker import Faker

fake = Faker()
CharacterMatrix = namedtuple('CharacterMatrix', ' '.join([
    'name', 'age', 'gender',
]))
AttributeMatrix = namedtuple('AttributeMatrix', ', '.join([
    'strength', 'endurance',
    'defense', 'intelligence',
    'agility', 'charisma',
    'wisdom', 'willpower',
    'perception', 'luck'
]))


class MBTIType(object):
    """Base class."""

    def __init__(self, name):
        """Add attrs to personality type."""
        self._name = name
        self.hp = 100
        self.mp = 100
        self.char = CharacterMatrix(
            name=fake.name(),
            age=fake.age(),
            gender=fake.gender(),
        )

    def interact_with(self, neighbor):
        """Engage in an interaction with a neighbor.

        All child classes should override this method.
        """
        raise NotImplementedError

    def is_introvert(self, neighbor):
        """Determine if neighbor is an introvert type."""
        return neighbor.name.startswith('i')

    def is_extrovert(self, neighbor):
        """Determine if neighbor is an extrovert type."""
        return neighbor.name.startswith('e')

    def is_dead(self):
        """Determine if the person is 'dead'."""
        return self.hp <= 0

    @property
    def name(self):
        """Basic name."""
        return self._name


class Introvert(MBTIType):
    """Introverted people."""

    def interact_with(self, neighbor):
        """Engage in an interaction with a neighbor."""
        name = neighbor.name
        if self.is_introvert(neighbor):
            print('Hello fellow introvert ({}).'.format(name))
            self.hp = min(self.hp + 1, 100)  # Cap hp to 100
        if self.is_extrovert(neighbor):
            print('...')
            self.hp -= 1
        if self.is_dead():
            print('{} died!'.format(self.name))


class Extrovert(MBTIType):
    """Extroverted people."""

    def interact_with(self, neighbor):
        """Engage in an interaction with a neighbor."""
        name = neighbor.name
        if self.is_extrovert(neighbor):
            print('Hello fellow extrovert ({}).'.format(name))
            self.hp = min(self.hp + 1, 100)  # Cap hp to 100
        if self.is_introvert(neighbor):
            print('...')
            self.hp -= 1


class Istj(Introvert):
    """A Meyer-Briggs personality type indicator.

    'Quiet, serious, earn success by thoroughness and dependability. Practical,
    matter-of-fact, realistic, and responsible. Decide logically what should be
{'fraction_non_alphanumeric': 0.13334742180896028, 'fraction_numerical': 0.010355029585798817, 'mean_word_length': 2.447195921340131, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2310687', 'n_tokens_mistral': 1439, 'n_tokens_neox': 1359, 'n_words': 397}