예제 #1
0
def narrate_conflict_system(event):
    a, b = get_ab(event)

    print(f"<p class='system'>The date is {event['date']}.</p>")
    print(
        f"""<p class='system'>{a['name']} has concession damage in category <tt>{event['target_property']}</tt> of {round(event['target'], 2)}
         and neuroticism {round(event['neuro_roll'], 2)}.</p>""")

    if not event['initiated']:
        print(
            f"<p class='system'>Neither were sufficiently high to start a conflict.</p>")
        return

    print(f"<p class='system'>One of previous scores exceeded 0.5 threshold. Conflict initiated.</p>")
    print(f"""<p class='system'>{b['name']} with agreeability {round(b['agree'], 2)},
        commitment {round(b['commit'], 2)}, interest {round(b['interest'], 2)}, and
        neuroticism {round(b['neuro'], 2)}, contributed {round(event['score'], 2)} to conflict mitigation.
        </p>""")
    if event['delta'] < 0:
        print(
            f"<p class='system'>Contribution does not exceed concession damage. {a['name']}'s interest in relationship declined to {round(a['interest'], 2)}</p>")
    else:
        print(
            f"<p class='system'>Contribution exceeds concession damage, {a['name']}'s concession damage reduced to {round(a['concessions'][event['target_property']], 2)}</p>")

    print(
        f"<p class='system'>The relationship health is {round(event['health'], 2)}.</p>")
예제 #2
0
def narrate_conflict(event):
    a, b = get_ab(event)
    target_p = event['target_property']

    logging.debug(event['delta'])
    # First get a description of the conflict
    problem_phrase = get_problem(a, b, target_p)

    if not event['initiated']:
        # A was grumpy, but didn't actually initiate a fight.
        print(get_conflict_thought(a, b, event, problem_phrase))
        return

    if random.random() < abs(event['delta']):
        # The bigger the event, the more chance we narrate it explicitly
        # Print some pretext
        rules = {
            'origin': [
                '#message# #meetup# #complaint# #response# #outcome#\n',
                '#message# #complaint# #response# #outcome#\n',
                '#thought# #meetup# #response# #outcome#\n',
                '#thought# #response# #outcome#\n',
            ],
            'thought': get_conflict_thought(a, b, event, problem_phrase),
            'message': artifacts.get_fight_trigger(event),
            'meetup': get_meetup(a, b),
            'complaint': get_problem_statement(a, b, problem_phrase, event),
            'response': get_response(a, b, event),
            'outcome': get_outcome(a, b, event)
        }
        print(tracery.Grammar(rules).flatten('#origin#'))
    else:
        narrate_conflict_zoomout(a, b, event, problem_phrase)
예제 #3
0
def narrate_experience_system(event):
    a, b = get_ab(event)
    print(
        f"""<p class='system'>{a['name']} invited {b['name']} to a
        {round(event['threshold'],2)}-{event['target_property']} experience.</p>""")
    if 'interest' in event:
        print(
            f"""<p class='system'>Activity proposed: {event['interest']}.
            {b['name']} interests: {', '.join(b['interests'])}.</p>
        """)
    print(
        f"""<p class='system'>{b['name']} has {event['target_property']}
        {round(b[event['target_property']],2)} and current concession damage
        {round(b['concessions'][event['target_property']],2)}.
        Reluctance to accept invitation is {round(event['concession_roll'], 2)}.</p>""")
    # how much you don't want to do the activity due to difference
    print(
        f"""<p class='system'>{b['name']} with interest {round(b['interest'], 2)},
        commit {round(b['commit'], 2)}, agreeability {round(b['agree'], 2)}
        produces motivation to accept {round(event['agree_roll'], 2)}.</p>""")
    # motivation is determined by other factors and can outweight reluctance

    if event['rejected']:
        print(
            f"<p class='system'>Motivation did not exceed reluctance. {b['name']} rejected the invitation.</p>")
    else:
        print(
            f"<p class='system'>Motivation exceeded reluctance. {b['name']} accepted the invitation. Due to difference in {event['target_property']}, took {round(event['concession'], 2)} concession damage.</p>")
    print(
        f"<p class='system'>The relationship health is {round(event['health'], 2)}.</p>")
예제 #4
0
def narrate_rejection(event, events):
    a, b = get_ab(event)
    rules = {
        'origin': "#Onday# #want#, #reject#.",
        'a': a['name'],
        'b': b['name'],
        'Onday': [
            f"On {event['date'].strftime('%A')},",
            f"{event['date'].strftime('%A')} came around.",
            "Later that week,"
        ],
        'want': [
            '#a# asked #b# if they wanted to hang out',
            f'#a# asked #b# if {b["they"]} were free',
            '#a# wanted to hang out with #b#',
            '#a# wanted to see #b#',
        ],
        'reject': [
            'but #b# was busy',
            'but #b# forgot to return #a#\'s message',
            'but #b# had other plans',
            'but #b# never responded to #a#\'s message'
        ]
    }
    if event.get('phase') == Phase.COURTING and random.random() < 0.6:
        print(artifacts.get_date_artifact(event, events, True))
    else:
        print(tracery.Grammar(rules).flatten('<p>#origin#</p>'))
    return
예제 #5
0
def narrate_meeting_system(event):
    a, b = get_ab(event)
    print(f"""
            <p class='system'>{a['name']} with confidence
            {round(a['confidence'], 2)}, interest
            {round(a['interest'], 2)} has
            {round((a['interest'] + a['confidence'])/2 * 100, 1)}% chance to initiate contact.
        </p>""")
    if event['delta'] == -1:
        print(
            f"<p class='system'>{a['name']} declined to initiate contact.</p>")
    else:
        print(
            f"<p class='system'>{a['name']} successfully initiates contact.</p>")

    print(f"""
            <p class='system'>{b['name']} with interest
            {round(b['interest'], 2)} responds with
            {round(event['delta'], 2)} enthusiasm.
            </p>""")
    if (event['delta'] > 0):
        print(
            "<p class='system'>Relationship successfully advanced to the courting stage.</p>")
    else:
        print(
            "<p class='system'>Relationship failed to advance to the courting stage.</p>")
예제 #6
0
def narrate_interests(event, events):

    # check whether previous events contain a non-rejected experience
    # if none found, this is the first d    ate
    # and we want to trigger the interests narration
    prev_experiences = [
        e for e in events if e['type'] == EventType.EXPERIENCE
        and e['phase'] == Phase.COURTING and e['rejected'] == False
    ]

    a, b = util.get_ab(event)

    person = event["person"]

    rules = {
        'origin': [
            f"#{event['target_property']}#, {person['name']} #shared# #interests#."
        ],
        'interests':
        f"{util.oxford_comma(person['interests'], conj = 'and')}",
        'libido':
        util.rank([
            "As they held hands", "While cuddling", "Later",
            "After they cooled down", "Later", "While laying in bed",
            "With their faces pressed together"
        ], event["threshold"]),
        'extra':
        util.rank(
            ["While they hung out", "Throughout the evening", "All night"],
            event["threshold"]),
        'open': ["While on their date"],
        'shared': [
            "was excited to tell Alex about", "talked a lot about",
            "gushed about", f"shared {person['their']} interest in"
        ]
    }

    if len(prev_experiences) == 0 and event['phase'] == Phase.COURTING:
        grammar = tracery.Grammar(rules)
        grammar.add_modifiers(base_english)
        print(grammar.flatten('#origin#'))
        print(f"""<p class='system'>{event['phase']}</p>""")

    if len(prev_experiences) == 3:
        get_first_impressions(person)
예제 #7
0
def narrate_commit_system(event):
    a, b = get_ab(event)
    print(
        f"""<p class='system'>Current relationship health of {round(event['health'] - event['delta'], 2)} exceeds threshold of {event['health_threshold']} and last event improved relationship health over 0.4.</p>"""
    )
    print(
        f"""<p class='system'>
        {a['name']} with interest {round(a['interest'], 2)} and commitment {round(a['commit'], 2)}
        produces relationship advancement interest score of {round(event['initiate_ratio'])}.</p>""")
    if event['initiate_ratio'] < 1:
        print(f"""<p class='system'>Interest score did not exceed threshold of 1.0. Relationship advancement failed.</p>""")
        return
    print(
        f"""<p class='system'>Interest score exceeded threshold of 1.0. Next, {a['name']} with confidence of {round(a['confidence'], 2)}, has {int(a['confidence'] * 100)}% chance of initiating relationship advancement.</p>""")
    if not event['confidence']:
        print(
            f"""<p class='system'>Confidence test failed. {a['name']} remains silent. Relationship advancement failed.</p>""")
        return
    print(
        f"<p class='system'>{a['name']} successfully initiated relationship advancement.</p>")
    print(
        f"""<p class='system'>
        {b['name']} with interest {round(b['interest'], 2)} and commitment {round(b['commit'], 2)}
        produces relationship advancement interest score of {round(event['success_ratio'])}.</p>""")
    if event['success_ratio'] > 1:
        print(
            f"""<p class='system'>
            Relationship advancement succeeded. The relationship has reached the {event['phase'].value} stage.
            {a['name']} experienced growth in commitment, interest, and confidence, as well as a reduction in neuroticism.
            {b['name']} experienced growth in commitment, interest, and confidence.</p>""")
    else:
        print(
            f"""<p class='system'>
            Relationship advancement failed. There were {event['prev']} previous failed attempts.
            {b['name']} experienced withdrawal from the relationship, manifesting in reduced interest.
            {a['name']} experienced an increase in neuroticism and a decline in confidence.
            </p>""")
    print(
        f"<p class='system'>The relationship health is {round(event['health'], 2)}.</p>"
    )
예제 #8
0
def get_fight_trigger(event):
    a, b = get_ab(event)
    a_nick = a['nickname']
    b_nick = b['nickname']
    messages = [{
        'text': '#text#',
        'nickname': a_nick,
        'a': 'b',
        'time': event['date']
    }]
    rules = {
        'origin': ['#preface#\n#msg#\n'],
        'preface':
        f'{get_message_intro(a, b)}',
        'msg':
        get_message_html(messages),
        'text': [
            'Hey, there\'s something I want to talk to you about.',
            'Hey can we talk?', 'Hey, I think we should check in later.',
            'Hey do you have a minute to chat?'
        ],
    }
    grammar = tracery.Grammar(rules)
    return grammar.flatten("#origin#")
예제 #9
0
def get_date_artifact(event, events, detail):
    a, b = get_ab(event)
    a_nick = event['protagonist']['nickname']
    b_nick = event['person']['nickname']
    a_interest = event['protagonist']['interest']
    b_interest = event['protagonist']['interest']

    # Look for the most recent event and use it to
    # determine the first message sent
    experiences = [e for e in events if e['type'] != EventType.NOTHING]
    recent_experience = experiences[-1]

    if recent_experience['type'] == EventType.CONFLICT and recent_experience[
            'initiated']:
        # This means there was a conflict recently
        message = [
            "Hey, can I cheer you up?",
            "Sorry about the other day. I wanna make it up to you! ",
        ]
    elif recent_experience.get('rejected'):
        # There was a previous rejection
        if recent_experience['protagonist_initiated'] == event[
                'protagonist_initiated']:
            message = ["Hey, uh, ", "are you around? ", "Mm, ", "hello? "]
        else:
            message = [
                "#hello# sorry again I was busy earlier! "
                "Ok I'm free now. ",
                "hey, sorry about that. ",
            ]
    elif recent_experience['type'] == EventType.COMMIT and recent_experience[
            'initiated']:
        if recent_experience['success_ratio'] > 1:
            # we only do these texts in COURTING, this is just a placeholder for now
            message = [';)']
        else:
            message = [
                "Well let's keep hanging out still!",
                "I still enjoy spending time with you",
                "I still really like you",
                "I'm still interested in hanging out more!"
            ]
    else:
        message = util.rank([
            '#hello# ',
            f'#hello# it was really nice to see you the other day!',
            f'i had fun! ',
            f'i had a lot of fun the other day! ',
            "You're cute. ",
            f"i had a #great# time! ",
            "You're a cutie. ",
            f"you are #great#. ",
            f"can’t stop thinking about you. ",
        ], random.gauss(a['interest'], 0.3))

    # Create the messages array
    # Initial message asks for the date
    messageA = '#start##punc# #ask#'

    # Always provide detail if rejecting
    if event['rejected']:
        detail = True

    # Set the response appropriately...
    messageB = '#resp#'
    if detail:
        messageB = '#rej#' if event['rejected'] else '#response#'

    messages = [{
        'text': messageA,
        'time': event['date'],
        'nickname': a_nick if event['protagonist_initiated'] else b_nick,
        'a': 'a' if event['protagonist_initiated'] else 'b'
    }, {
        'text': messageB,
        'time': event['date'],
        'nickname': b_nick if event['protagonist_initiated'] else a_nick,
        'a': 'b' if event['protagonist_initiated'] else 'a'
    }]

    if detail:
        # Splice in another message
        messages.insert(
            1, {
                'text': '#date_suggest#',
                'time': event['date'],
                'nickname': messages[0]['nickname'],
                'a': messages[0]['a']
            })

    rules = {
        'origin': ['#preface# #msg#', '#msg#', '#msg#'],
        'preface':
        get_message_intro(a, b),
        'msg':
        get_message_html(messages),
        'punc': ['', '#e#'],
        'e':
        HEART_EMOJIS,
        'start':
        message,
        'ask': [
            'can i see you again?',
            'when can i see you again?',
            'when can i see u next?',
            'when r u free?',
            'when are u free next?',
            'See me again soon?',
            'Want to hang out #day#?',
            'Want to hang out again?',
            'When are you free next?',
            'When are you free?',
            "I'd love to see you again!",
        ],
        'hello': [
            'hey',
            'heyy',
            'heya',
            'hi',
            'hello!',
            'yo',
            'sup',
            'Hey!',
            'Heya!',
            'Yo!',
            'Hello!',
            'Whats up!',
            '',
        ],
        'great':
        ['great', 'wonderful', 'fantastic', 'awesome', 'unforgettable'],
        'rej': [
            'uhhh let me take a look at my calendar', 'let me get back to you',
            'im kinda busy rn but ill text u',
            'Hm, my week is looking pretty busy', 'Let me get back to you...',
            'I have a upcoming deadline, can I let you know?'
        ],
        'resp':
        util.rank([
            '#suggest#',
            "#suggest# :)",
            "#suggest# #e#",
            'yea, #suggest#',
            "yes, #suggest#",
            "yes! #suggest#",
            "yeah id love to! #suggest#",
            'Looking forward to it #suggest#',
            'I\'d love to, #suggest#',
            'Of course! #suggest#',
            'Absolutely! #suggest#',
            'For sure! #suggest#',
        ], random.gauss(b['interest'], 0.3)),
        'suggest': [
            'what about #day#?', 'im free on #day#!', 'i can do #day#.',
            'i could do #day#.', '#day#?'
        ],
        'day': [
            'tomorrow', 'the day after tomorrow', 'some time next week',
            event['date'].strftime('%A')
        ],
        'date_suggest':
        f"#{event['target_property']}#",
        'open': [
            'Wanna go #hobby_verb#?', 'We could #hobby_verb#?',
            'Wanna go to #hobby_location#?',
            'We could check out #hobby_location#?'
        ],
        'extra':
        util.rank([
            'We could do something quiet at my place?',
            'We could do something chill',
            'Lets go out somewhere?',
            'We could go out!!',
        ], event['threshold']),
        'libido':
        util.rank([
            'But lets not jump right into bed?',
            'I cant stay over tonight though',
            "Id be interested in getting to know you better! #e#",
            '#e##e##e#',
            'wanna get freaky? #e##e##e#',
        ], event['threshold']),
        'hobby_location':
        INTERESTS[event['interest']]['location']
        if 'interest' in event else '',
        'hobby_verb':
        INTERESTS[event['interest']]['verb'] if 'interest' in event else '',
        'response':
        util.rank([
            "I'd love to! #suggest#", "Sounds like fun! #suggest#",
            "Yes, let's do it, #suggest#", "Sure! #suggest#", "Okay",
            "Oh, okay", "I guess so...", "Do we have to?",
            "You know I don't like that"
        ], event['concession']),
    }
    if 'interest' in event:
        rules.update(getInterestRules(a, b, event['interest'], pov=1))
    grammar = tracery.Grammar(rules)
    return grammar.flatten("#origin#\n")
예제 #10
0
def narrate_experience(event, events):
    a, b = get_ab(event)

    if event['rejected'] and event['target_property'] not in ['con', 'exp', 'neuro']:
        narrate_rejection(event, events)
        narrate_experience_system(event)
        return

    detail = False

    artifact = False
    if event.get('phase') == Phase.COURTING and random.random() < 0.6:
        artifact = True
        # 50% chance to show the detail of the experience in the artifact
        detail = random.random() < 0.5
        print(artifacts.get_date_artifact(event, events, detail))

    # compare the target_properties of the characters
    # create boolean that asks if b > a
    b_greaterthan_a = b[event['target_property']] > a[event['target_property']]

    # openness activities can fall 3 different ways
    # <.33 proposer suggests activity they like
    # <.66 proposer suggest an activity that their partner likes
    # < 1 proposer suggests any activity

    if event['target_property'] == 'open':
        rules = {
            'origin': '<p>#hobby_proposal# #reply# #outcome# </p>',
            'mood': util.rank([
                "Having a strong preference for what #they# wanted to do for date night,",
                f"Having been obsessed with {event['interest']} more than ever lately,",
                "Wanting to have a nice evening together,",
                "Wanting to surprise #b#,",
                "In effort to mix up what they usually do,",
                "In the mood for adventure,"
            ], event['threshold']),
            'proposed': [
                "asked #b# to", "begged #b# to", "proposed that they",
                "wondered if it would be fun to", "suggested that they",
                "wanted to", "invited #b# to"
            ],
            'hobby_proposal': [
                f"#mood# #a# #proposed# go to {random.choice(INTERESTS[event['interest']]['location'])} together.",
                f"#mood# #a# #proposed# {random.choice(INTERESTS[event['interest']]['verb'])} together."
            ],
            'response': util.rank([
                "I'd love to!", "Sounds like fun!", "Yes, let's do it,",
                "Sure!", "Okay,", "Oh, okay,", "I guess so...",
                "Do we have to?", "You know I don't like that,"
            ], 1-event['delta']),
            'reply': ['"#response#" #b# replied.'],
            'quality': util.rank([
                'terrible', 'pretty bad', 'okay',
                'decent', 'good',
                'joyous', 'fantastic', 'outstanding'
            ], event['delta']),
            'verdict': util.rank([
                '#b# would rather not spend their time like this in the future.',
                'Perhaps, they could try something else next time.',
                '#b# would consider doing a similar activity again.',
                f'#b# enjoyed {b["themself"]}.',
                '#b# could see the two of them doing this often.',
                '#b# loved the date.'
            ], 1 - event['concession_roll']),
            'match': f"#b# loved {event['interest']}",
            'outcome': "The two had a #quality# time. #verdict#"
        }
        rules.update(getInterestRules(a, b, event['interest']))
        grammar = tracery.Grammar(rules)
        if not detail:
            print(grammar.flatten('<p>#origin#</p>'))
        else:
            print(grammar.flatten('<p>#outcome#</p>'))
        # logging.debug(
        #    f"OPEN EXPERIENCE {event['interest']} {event['threshold']} a: {a['open']} b: {b['open']}")
    elif event['target_property'] in ['extra', 'libido']:
        rules = {
            'origin':
            f"#Onday# #{event['target_property']}#. #{event['target_property']}_{b_greaterthan_a}_response#.",
            'day': ['day', 'morning', 'afternoon', 'evening'],
            'Onday': '#artifact#' if artifact else '#later#',
            'artifact': [
                f"On {event['date'].strftime('%A')}, #they#",
                f"{event['date'].strftime('%A')} came around. #they.capitalize#",
                f"{event['date'].strftime('%A')} arrived. #they.capitalize#",
            ],
            'later': [
                '#artifact#',
                '#artifact#',
                "Later that week, #they#"
            ],
            'extra':
            util.rank([
                '#enjoyed# a tranquil #day# watching Netflix',
                '#enjoyed# a tranquil #day# watching Youtube videos',
                '#enjoyed# a tranquil #day# watching a movie',
                '#enjoyed# a quiet #day# reading together',
                '#enjoyed# a #day# of people-watching',
                '#enjoyed# a #day# hanging out with friends',
                '#enjoyed# a night out together at the bar',
                '#enjoyed# a night out at the club',
            ], event['threshold']),
            'libido':
            util.rank([
                'held hands',
                'cuddled on the couch',
                'shared a kiss',
                'made out #vigorously# #location# upon seeing each other',
                'sneakily groped each other #in_public#',
                '#enjoyed# a steamy evening together',
                '#enjoyed# an intensely passionate evening together',
            ], event['threshold']),
            'they': [
                'they', 'the couple', '#a# and #b#', 'the two of them',
                'the pair'
            ],
            'enjoyed': util.rank([
                'spent', 'happily spent', 'enjoyed',
                'excitedly spent', 'savored',
                'reveled in', 'relished'
            ], event['delta']),
            'vigorously': util.rank([
                'awkwardly', 'briefly', '', 'passionately', 'vigorously'
            ], event['delta']),
            'location': [
                "on the street", "outside #a#'s apartment", "on #b#'s doorstep", "in the back of the rideshare",
                "outside the subway",
            ],
            'in_public': [
                "while walking down the street", "while waiting in line at checkout"
            ],
            # if B has higher libido than A:
            'libido_True_response': util.rank([
                '#b# was enraptured',
                '#b# sighed with pleasure',
                '#b# smiled coyly',
                f'"How nice", #b# thought to {b["themself"]}',
                '#b# was left wanting more',
                '#b# wanted to go further, but #a# pulled away',
                '#b# excitedly attempted to push things further, but #a# pulled away',
                '#b# was left to take care of their needs alone',
            ], event['concession']),
            'libido_False_response': util.rank([
                '#b# gasped with excitement',
                '#b# sighed with pleasure',
                '#b# smiled coyly',
                f'"How nice", #b# thought to {b["themself"]}',
                '#b# felt a little uncomfortable with how fast things were moving',
                '#b# felt that #a# was pushing things further than #b# would have liked',
                '#a# sure loved getting it on! #b# sighed',
                f'#b# wanted to pushed #a# away. "There\'s more to me than my body," #b# thought to {b["themself"]}'
            ], event['concession']),
            # b has higher extra
            'extra_True_response': util.rank([
                '#b# loved hanging out with #a# this way',
                '#b# was happy to hang out with #a# this way',
                'While #b# enjoyed #a#\'s company, #b# yearned for a more lively social experience',
                '#b# felt that it was a little bit boring',
                '#b# felt the urge to fill the silence with conversation',
                '#b# wished they had gone out to a more lively environment',
            ], event['concession']),
            'extra_False_response': util.rank([
                '#b# loved hanging out with #a# this way',
                '#b# was quiet, but happy to hang out with #a# this way',
                'while #b# enjoyed #a#\'s company, #b# yearned for a quieter social experience',
                f'#b# felt a bit awkward. "What should I be doing with my hands?" #b# thought to {b["themself"]}',
                'After a few hours, #b# was spent and made excuses to head home',
                '#b# collapsed on arriving home. How exhausting',
            ], event['concession']),
            'a': a['name'],
            'b': b['name'],
        }
        grammar = tracery.Grammar(rules)
        grammar.add_modifiers(base_english)
        print(grammar.flatten("#origin#"))
    else:
        rules = {
            'origin': [
                f"#Onday# #{event['target_property']}# #next#",
            ],
            'Onday': [
                f"On {event['date'].strftime('%A')}, ",
                f"{event['date'].strftime('%A')} came around. ",
                "Later that week, "
            ],
            'hot': util.rank([
                '#b# noticed that #a# sometimes gave off a mildly unpleasant odor.',
                f'#a# bragged to #b# about how infrequently {a["their"]} hair needed to be washed.',
                '#a# met #b# wearing an old college sweatshirt and an ill-fitting pair of jeans.',
                '#b# noticed #a# went to sleep without washing up first.',
                '#a# bought more skincare products.',
                '#a# went shopping for the latest trendy fashions.',
                '#a# went shopping for organic groceries. That figure didn\'t keep itself in shape!',
                '#a# spent the #day# at the gym. That body didn\'t keep itself in shape!',
            ], event['threshold']),
            'con': util.rank([
                '#b# noticed #a# had a lot of dishes piled up in the sink.',
                '#a# decided to call in sick to work. After all, you only live once.',
                f'#a# forgot to do {a["their"]} laundry.',
                '#a# left a couple of dishes piled up in the sink.',
                f'#a# noticed {a["they"]} needed to vacuum the carpet.',
                '#a# decided to start keeping a daily todo list.',
                f'#a# spent the #day# arranging {a["their"]} books by color and subject.',
                '#a# went shopping and purchased a daily planner.',
                '#a# stayed late at work.',
                '#a# spent the #day# #cleaning# the apartment.',
                '#a# spent the #day# #cleaning# the apartment. It was moderately dusty.',
                '#a# spent the #day# #cleaning# the bathroom. It certainly was in need of some attention.',
            ], event['threshold']),
            'exp': util.rank([
                '#a# was upset with #b#, but said nothing.',
                '#a# was jealous of #b#\'s moderately attractive co-worker.',
                f'#a# asked #b# how {b["they"]} felt about the relationship. The couple had an earnest conversation about where things were going.',
                f'#a# suggested that they enact weekly relationship check-ins. #b# agreed happily.'
            ], event['threshold']),
            'neuro': util.rank([
                '#b# had a night out with friends planned. #a# was happy to pass the evening doing other things.',
                '#b# had not responded to #a#\'s text messages for a few hours. #a# sent a followup.',
                '#a# fretted. #a# had not heard from #b# for a couple days.',
                f'#a# worried when #b# said that {b["they"]} sometimes preferred to be alone.',
                '#a# worried that #b# did not actually find them to be attractive.'
                '#b# kept a journal of how long it took for #a# to text them back.',
                '#a# worried that #b# would leave them some day soon.',
            ], event['threshold']),
            'cleaning': ['tidying', 'cleaning', 'organizing'],
            'day': ['day', 'morning', 'afternoon', 'evening'],
            'a': a['name'],
            'b': b['name'],
            'response': util.rank([
                '#b# was happy that the two of them shared similar habits.',
                '#b# was perfectly willing to support #a# when this happened.',
                '#b# didn\'t always understand #a#\'s actions.',
                '#b# did not appreciate #a# when things like this happened.',
            ], event['concession']),
            'rejection':
                '#b# refused to participate in this kind of behavior.',
            'next': '#rejection#' if event['rejected'] else '#response#'
        }
        print(tracery.Grammar(rules).flatten('#origin#'))
        # logging.debug(f"Event: {event}")
    prologue.narrate_interests(event, events)
    narrate_experience_system(event)
예제 #11
0
def narrate_meeting(event, events):
    a, b = get_ab(event)
    if event['delta'] == -1:

        narrate_meeting_system(event)
        return

    text = "<p>"
    if event['protagonist_initiated']:
        text += get_interest_sentence(event['protagonist'], event['person'],
                                      event['protagonist']['interest'])
    else:
        text += get_interest_sentence(event['person'], event['protagonist'],
                                      event['person']['interest'])
    adverb = util.rank(
        ['nervously', 'shyly', 'quietly', 'gently', 'intently', 'boldly'],
        a['interest'])

    if event['delta'] <= 0:
        REJECTIONS = [
            f", but {b['name']} averted {b['their']} eyes.",
            f", but {b['name']} did not respond.",
            f", but {b['name']} quickly turned away.",
        ]
        followup = random.choice(REJECTIONS)
    else:
        follow2 = random.choice([
            f'Soon, they got to talking and found themselves engaged in animated conversation. ',
            f"They exchanged several friendly words, before agreeing to meet again sometime soon. "
        ])
        contact = random.choice([
            'phone number', 'email', 'contact',
            'phone number scrawled onto a crumpled piece of paper',
            'phone number hastily scribbled on a napkin',
            'email address dashed onto a post-it note',
            'Discord server invite', 'laughter echoing in their ears',
            'smile etched into their memory', 'Instagram handle'
        ])
        follow3 = random.choice([
            f"{a['name']} left with {b['name']}'s {contact}. ",
            f"{b['name']} left with {a['name']}'s {contact}. ",
        ])
        ACCEPTS = [
            f". {b['name']} returned a flirtatious glance. {follow2}{follow3}",
            f". {b['name']} waved in return. {follow2}{follow3}",
            f". {b['name']} smiled back. {follow2}{follow3}"
        ]
        followup = random.choice(ACCEPTS)
    time = random.choice([
        'After a few moments, ',
        '',
        'After several minutes, ',
        'Eventually, ',
    ])
    APPROACHES = [
        f"{time}{a['name']} waved {adverb}{followup}",
        f"{time}{a['name']} smiled {adverb}{followup}",
        f"{time}{a['name']} began to gaze {adverb} at {b['name']}{followup}",
        f"{time}{a['name']} giggled {adverb}{followup}",
        f"{time}{a['name']} walked {adverb} toward {b['name']}{followup}"
    ]
    print(text + random.choice(APPROACHES) + "" + "</p>")

    narrate_meeting_system(event)
예제 #12
0
def narrate_commit(event, events):
    a, b = get_ab(event)
    if event['initiated']:
        enthusiasm = util.scale(event['success_ratio'], 1, 3, 0, 1)
        rules = {
            'courting_phase': ['<p>#dating#</p>'],
            'dating_phase': ['<p>#iloveyou#</p>'],
            'dating': ['#dating_challenge# #dating_result#'],
            'iloveyou': ['#ily_challenge# #ily_result#'],
            'dating_challenge': [
                "#a# asked to start dating.",
                "#a# asked if #b# would be interested in dating.",
            ],
            'dating_result':
            f"#b# agreed {util.enthusiastically(enthusiasm)}. "
            if event['success_ratio'] >= 1 else
            f'#b# said that {b["they"]} needed more time. ',
            'ily_challenge':
            f"#a# said \"I love you,\"",
            'ily_result': [
                'but #b# could not say it back. #a# was #hurt#'
                if event['success_ratio'] < 1 else
                f'and #b# returned the words {util.enthusiastically(enthusiasm)}.'
            ],
            'hurt': util.rank(
                [
                    'hurt, but said #a_they# understood.',
                    'wounded. A tear fell from #a#\'s left eye. ',
                    'devasted. #a_they.capitalize# had hoped #b#\'s response might have been different this time.',
                    'mortified. #a# shouted that #b# was wasting #a#\'s time. #b# shrugged. '
                ],
                util.scale(event.get('prev', 0), 0, 3, 0, 1)
            ),
            'a': a['name'],
            'b': b['name'],
            'a_they': a['they']
        }

    elif event['initiate_ratio'] > 1:
        # Narrate a failed commit event held back by confidence
        rules = {
            'courting_phase': '#origin#',
            'dating_phase': '#origin#',
            'origin': [
                '#a# felt nervous, but excited. ',
                '#a# sighed. #b# seemed so amazing. But would #b_they# return #a#\'s feelings?',
                '#a# smiled quietly to themselves. Perhaps the right time to talk to #b# would come some day. ',
                "#a# had the urge to ask #b# about how they felt about the relationship, but wasn't quite confident enough to ask. ",
            ],
            'a': a['name'],
            'b': b['name'],
            'b_they': b['they'],
        }
    else:
        # Not interested enough.
        rules = {
            'courting_phase': [
                "#a# continued to use dating apps from time to time. ",
                "#a# considered sending #b# a message, but decided not to. ",
                "#a# noticed a message from #b#. #a# ignored it. ",
                "#b# had yet to meet most of #a#'s friends. ",
            ],
            'dating_phase': [
                "#a#'s Facebook relationship status still read 'Single'. ",
                "#a# had yet to mention #b# to their parents. ",
                "#a# told #b# they were busy, but in fact #a# had no concrete plans that day. ",
                "#a# lay awake at night, mulling over exes from previous relationships. ",
            ],
            'a': a['name'],
            'b': b['name'],
            'interest': a['interests'],
        }
    grammar = tracery.Grammar(rules)
    grammar.add_modifiers(base_english)
    if event['phase'] == Phase.COURTING:
        print(grammar.flatten('<p>#courting_phase#</p>'))
    elif event['phase'] == Phase.DATING:
        print(grammar.flatten('<p>#dating_phase#</p>'))
    print('\n')
    narrate_commit_system(event)