NaNoGenMo / 2024

National Novel Generation Month, 2024 edition.
10 stars 1 forks source link

Markov Based Simulation #25

Open plan9ch7 opened 1 day ago

plan9ch7 commented 1 day ago

Generates a >= 50K novel by setting up a world and characters who battle and negotiate. The story ends when the hero resolves the 2nd encounter with the villain, whether by winning, losing or negotiating. Markov Chains govern the interactions and they get updated as the hero journeys through the world to build up skills for a second rematch. Done as a notebook as I wanted to write more prose to describe the approach and make it more suitable for learning.

plan9ch7 commented 1 day ago
# -*- coding: utf-8 -*-
"""Simulation Based (Markov Chain)

Automatically generated by Colab.

Original file is located at
    https://colab.research.google.com/drive/1yMNMicVRdtUHk0GnzN_ofLUzB1uzA0r6

# Disclaimer
This program sheet comes with no guarantees or warrantees, I'm not liable for anything, etc... Use at your own risk.

# Markov Chains
This approach uses Markov Chains, so now's a good time to introduce them.  A Markov Chain is a way of representing a network of conditional probabilities.  For instance, if a person encounters another person, the encounter can be friendly, hostile or even violent.  The probabilities of them being any of those depends on the person's mood.  An angry person will have a higher probability of entering into a negative encounter while a peaceful person has a higher probability of having a friendly encounter.  This mood is called state and Markov Chains are ways of modeling these probabilities that are based on states.

This gives us a way of modeling character interactions such as conflicts by having different Markov Chains for interactions with different kinds of characters and updating them based on interactions.  Using the Markov Chains to show chains of different events then give us the sequence of interactions; emit words for them, and we have our novel.

# Overview
This sheet generates a 50,000 word novel by creating a role playing game in which the goal is for the hero to defeat the villain.  The battles and interactions are simulated via Markov Chains representing the hero's interaction with each character, and the narrative flow is nudged by ensuring the hero can't win against the nemesis and thus must journey to build up the relevant skills, themselves modeled as modifications of the transition probabilities on the Markov Chain.  To ensure a chance of winning, the neighborhood is built in such a way that initial encounters are ones the hero is likely to win, and the hero must journey to the ends of his world and then back, and it's only on the second encounter that the novel can end.  

The combination of world length and encounter length helps get the word count.

I used a Markov Chain to govern interactions for the following reasons:
1. Simplification of interaction code.
1. Richer, more complex interactions.
1. Curiosity/amusement.

# Caveats
This program was put together in a hurry, and was a process of discovery even while coding.  As a result, it is not a model of great programming.  There are instances where I hardcode names, places where I could have refactored and so on.  However, it's designed as a combination prototype, proof of concept and something others could hopefully learn from; this is why it's a notebook rather than a traditional script.

# Preliminaries

# @title Install a Markov Chain Package
!pip install PyDTMC > /dev/null 2>&1
"""

# @title Package Imports
from pydtmc import MarkovChain
from random import choice, randint
from string import Template

"""# The Implementation

The novel is generated by writing out descriptions of the simulation.  To accumulate these descriptions, let's create a Novel class.
"""

# @title Novel Class
import re

class Novel(list):
    def append(self, x:str) -> None:
        super().append(self.normalize(x))

    def print(self) -> None:
        print('\n\n'.join(self))

    def normalize(self, x:str) -> str:
        return re.sub(r'\s{3,}', ' ', x) if x != None else ''

"""Using a Markov chain to simulate an interaction consists of starting the chain in a given state and continuing to walk through it until we get to an absorbing state.  An absorbing state is just a  state that you can never get out of.  This means the end of an interaction, whether it's a victory, loss or something else."""

# @title Walking the Markov Chain
def walk(mc, start_state) -> list[str]:
    state = start_state
    states = [state]
    while not mc.is_absorbing_state(mc.states.index(state)):
        state = mc.next(state)
        states.append(state)
    return states

"""For variety, there are numerous possible descriptions for any event. These descriptions were generated from an LLM with little to no curation, so there may be inconsistencies, like references to a location that wasn't established..."""

# @title Descriptions
Encounter_Start = [
    "Buford saw a tall figure looming in the distance.",
    "Buford suddenly saw someone emerge from the shadows.",
    "Buford thought he saw a flicker of movement nearby.",
    "Through the mist, Buford saw a familiar face.",
    "Buford barely saw the outline of a person in the fog.",
    "With a start, Buford saw a mysterious stranger standing quietly.",
    "Buford distinctly saw someone watching him from afar.",
    "At the edge of his vision, Buford saw a dark shape approaching.",
    "Buford saw a figure dart across the street.",
    "In the corner of his eye, Buford saw someone slipping away.",
    "Buford saw a shadowy figure moving swiftly through the trees.",
    "To his surprise, Buford saw an old acquaintance from years ago.",
    "Buford saw someone he hadn't expected to encounter in such a place.",
    "From the corner of his eye, Buford saw a figure waiting.",
    "Buford slowly saw a pair of glowing eyes staring back at him.",
    "Buford caught sight of a person hiding in the alley.",
    "Buford saw a silhouette against the setting sun.",
    "With a glance, Buford saw someone step out from behind the curtain.",
    "Buford thought he saw a woman rushing past him in a hurry.",
    "Buford could have sworn he saw someone watching him from the window.",
    "Buford, startled, saw a figure leaning casually against the wall.",
    "Buford saw a shadow creep across the floor as the door creaked open.",
    "Buford caught a glimpse of a person standing at the far end of the room.",
    "As he walked, Buford saw someone duck into a nearby doorway.",
    "Buford saw a figure shift in the moonlight, barely visible.",
    "He didn't know why, but Buford saw something strange in the distance.",
    "Buford saw a lone figure standing motionless in the field.",
    "With sharp eyes, Buford saw a man watching him from across the street.",
    "Suddenly, Buford saw someone running in the opposite direction.",
    "Buford could clearly see a figure approaching slowly in the dark.",
    "Buford saw someone disappear behind the tree line.",
    "He blinked, and Buford saw a flash of red as someone rushed by.",
    "Buford saw a person leaning against a lamppost, staring into space.",
    "Buford saw a shadow move across the ground, but there was no one in sight.",
    "Through the fog, Buford saw a figure standing perfectly still.",
    "In the distance, Buford saw a figure raise their hand as if to wave.",
    "Buford saw someone walk briskly toward the horizon, disappearing into the mist.",
    "Buford caught sight of a person huddled beneath the overpass.",
    "He looked up, and Buford saw a familiar face from his past.",
    "With keen eyes, Buford saw someone quietly slip into the crowd.",
    "Buford thought he saw something shift in the trees, but it was gone too quickly.",
    "Buford saw a lone figure, backlit by the streetlamp, slowly approaching.",
    "Buford saw someone briefly peer out from behind the curtain.",
    "Through the open door, Buford saw a person pacing nervously inside.",
    "Buford saw a tall, imposing figure standing motionless at the far end of the hallway.",
    "Buford squinted into the distance and saw someone standing under the overhang.",
    "Buford thought he saw someone waving at him from across the street.",
    "In a flash, Buford saw a blur of motion at the edge of his vision.",
    "Buford saw someone sitting in the corner of the dimly lit room, staring intently.",
    "Buford caught sight of a person peering out from behind the bushes.",
    "Through the cracked door, Buford saw a figure standing just beyond the threshold.",
    "Buford saw someone watching him from across the street with a serious expression.",
    "In the dark, Buford saw two gleaming eyes fixed on him, unblinking.",
    "Buford saw a tall woman step out of the shadows, her face half-hidden.",
    "Buford saw someone quickly dart behind the parked car.",
    "He turned his head, and Buford saw a figure moving swiftly through the crowd.",
    "Buford saw someone at the end of the hallway, standing still and silent.",
    "Buford saw someone quietly watching him from across the room, unblinking.",
    "Through the door, Buford saw a shadow flit by the window.",
    "Buford thought he saw a figure standing at the edge of the woods, barely visible.",
    "In the dim light, Buford saw a woman with long hair standing perfectly still.",
    "Buford saw someone sneak up behind him, their footsteps muffled on the floor.",
    "Buford saw a person with a hood pulled low over their face standing silently nearby.",
    "Buford, suspicious, saw someone hiding behind the large pillar in the hallway.",
    "Buford caught sight of a figure standing at the top of the stairs, silhouetted against the light.",
    "Buford saw someone quickly move out of the corner of his eye, vanishing into the night.",
    "Buford saw a figure appear suddenly, blocking his path in the dark alley.",
    "Buford saw a person emerge from the shadows, moving with an air of authority.",
    "In the flickering streetlight, Buford saw a solitary figure walking toward him.",
    "Buford saw a person standing at the door, looking out into the storm.",
    "Buford saw a stranger standing quietly in the doorway, just staring at him.",
    "Buford saw someone slip out of the alleyway and disappear into the crowd.",
    "As the fog rolled in, Buford saw a figure step out from behind the tree.",
    "Buford saw someone linger at the far end of the street, watching him intently.",
    "Buford glanced over and saw a figure in a trench coat standing by the lamppost.",
    "Buford saw a man standing motionless by the window, gazing outside.",
    "Buford could have sworn he saw someone step out of the shadows, but there was no one there.",
    "With his heart racing, Buford saw a shadow pass quickly across the wall.",
    "Buford saw a person standing motionless under the streetlight, their features obscured.",
    "Suddenly, Buford saw a face peek out from behind the heavy curtain.",
    "Buford, his instincts on alert, saw someone move stealthily in the corner of the room.",
    "With a sharp intake of breath, Buford saw someone appear from behind the corner.",
    "Buford saw a dark figure walking swiftly down the alleyway, disappearing into the night.",
    "Buford, his eyes narrowing, saw someone standing at the far end of the parking lot.",
    "Buford turned quickly and saw someone duck out of sight behind the door.",
    "Buford saw a figure dart into the alley, vanishing from view.",
    "Buford saw someone standing near the gate, looking out into the distance.",
    "Buford saw a figure step out into the light, their face half-hidden by a wide-brimmed hat.",
    "Buford saw a silhouette outlined against the dark sky, standing in the doorway.",
    "Buford glanced over and saw someone casually leaning against the wall, watching him.",
    "Buford saw a tall man standing at the far end of the hallway, his back to the wall.",
    "Buford caught a glimpse of someone stepping out of the shadows and into the light.",
    "Buford saw someone slowly creeping toward him from the other side of the street.",
    "Buford saw someone standing on the balcony, their face obscured by the shadows.",
    "Buford saw a figure in the distance, moving slowly toward the streetlight.",
    "Buford saw a woman with a hood pulled low, her eyes peeking out from the darkness.",
    "In the dark, Buford saw someone watching him from the other side of the room.",
    "Buford saw someone standing motionless at the edge of the platform, staring out at the horizon.",
    "Buford saw a flash of movement and quickly turned to see who it was, but no one was there.",
    "Buford saw a figure standing near the entrance, waiting silently for something to happen.",
    "Buford caught sight of a figure lurking in the shadows, just beyond the light.",
    "Buford saw someone standing just inside the doorway, watching him closely.",
    "Buford turned quickly and saw someone move in the direction of the alley.",
    "Buford saw a figure appear at the far end of the hall, walking toward him.",
    "Buford saw someone standing at the edge of the platform, staring off into the distance.",
    "Buford saw a shadow cross the street and quickly glance over, but it was gone in an instant.",
    "Buford saw someone stand up suddenly, their silhouette outlined in the doorway.",
    "Buford saw a woman step out of the car, her face hidden in the shadows.",
    "Buford saw someone approaching him slowly, their footsteps echoing in the quiet night.",
    "Buford saw a figure in the distance moving quickly toward him.",
    "Buford saw a man with a wide-brimmed hat standing quietly at the edge of the street."
]

Meet = [
    "Buford narrowed his eyes at $opponent, unsure if he was about to face a worthy adversary or someone to share a drink with.",
    "Buford sized up $opponent’s stance, wondering if that scowl meant business or just bad coffee.",
    "Buford and $opponent exchanged suspicious glances, both wondering if they were about to become best friends or worst enemies.",
    "Buford flexed his fists, trying to read $opponent’s body language—was this guy a fighter, or just someone who liked to take long walks?",
    "Buford stared at $opponent, wondering if the smirk on his face was a sign of a friendly greeting or an impending roundhouse kick.",
    "Buford and $opponent stood face-to-face, both thinking, 'Is this a handshake or a haymaker?'",
    "Buford sized up $opponent's shoes, trying to figure out if they were a signal of peace or a statement of war.",
    "Buford looked at $opponent’s chest, trying to determine whether that muscle was flexed out of intimidation or just an unfortunate habit.",
    "Buford and $opponent exchanged eye contact, each waiting for the other to make the first move—whether it be a punch or a friendly nod.",
    "Buford sized up $opponent’s wristwatch, wondering if it was an expensive piece of jewelry or a carefully concealed brass knuckle.",
    "Buford adjusted his stance, trying to decide if $opponent was a rival looking for a fight or someone just trying to find their way to the food court.",
    "Buford and $opponent circled each other like two confused squirrels, trying to figure out if the other was a threat or just lost.",
    "Buford squinted, trying to read $opponent’s expression—was he about to throw a punch or offer a sandwich?",
    "Buford watched $opponent's hand twitch, wondering if it was a sign of aggression or a nervous tick from too much coffee.",
    "Buford adjusted his posture, thinking, 'Is he sizing me up for a fight, or is he just wondering if I have a good barbecue recipe?'",
    "Buford locked eyes with $opponent, each silently calculating whether they could take the other down or just grab a cup of coffee instead.",
    "Buford clenched his fists, unsure if $opponent was preparing to launch an attack or just stretch his arms after a long day.",
    "Buford studied $opponent’s stance, wondering if it was one of aggression or simply a misunderstanding of personal space.",
    "Buford and $opponent stared each other down like two confused puppies trying to figure out who was in charge.",
    "Buford tapped his foot nervously, trying to determine if $opponent was waiting for a fight or just trying to find a good spot to sit.",
    "Buford studied $opponent’s shoes, wondering if he was dealing with a tough guy or someone who just didn’t know how to tie laces properly.",
    "Buford eyed $opponent’s jacket, wondering if it was a disguise for weapons or simply a fashion choice from the '90s.",
    "Buford looked at $opponent’s clenched jaw, wondering if it was the look of a man ready to brawl or just someone who needed a toothpick.",
    "Buford and $opponent exchanged an awkward nod, both unsure if they were about to spar or share a quiet moment of mutual understanding.",
    "Buford rubbed his chin thoughtfully, trying to figure out if $opponent was sizing him up for a fight or just trying to read his T-shirt slogan.",
    "Buford squinted suspiciously at $opponent’s fists—were they ready to throw punches or just making casual gestures for dramatic effect?",
    "Buford took a step back, trying to figure out if $opponent was about to attack or just pulling out his phone for a selfie.",
    "Buford adjusted his collar, unsure whether $opponent was about to throw down or just checking his posture in a reflective window.",
    "Buford stared at $opponent, wondering if he was about to witness a duel or if this was just an awkward encounter at the grocery store.",
    "Buford paced in a circle, wondering if $opponent was a fighter or just someone who liked to strike dramatic poses.",
    "Buford and $opponent exchanged stares, each wondering if the other was a long-lost friend or someone with really bad intentions.",
    "Buford raised an eyebrow, wondering if $opponent was trying to intimidate him or just curious about his shoes.",
    "Buford looked over $opponent’s outfit, trying to decide if it was armor for battle or simply an unfortunate choice in fashion.",
    "Buford squinted at $opponent, wondering if he was about to fight or if they were just playing the world’s longest staring contest.",
    "Buford grinned nervously, unsure whether to offer $opponent a handshake or a roundhouse kick.",
    "Buford scanned $opponent’s face for any signs of a smile, trying to decide if this was a threat or a surprise party in disguise.",
    "Buford watched $opponent’s muscles twitch, wondering if it was a sign of aggression or just a muscle spasm from too much coffee.",
    "Buford looked at $opponent, trying to figure out if they were about to engage in a battle or just share a quiet moment of awkwardness.",
    "Buford raised an eyebrow, suspicious of $opponent’s overly confident grin—was he looking for a fight, or was he just really proud of his new watch?",
    "Buford gave $opponent a slow nod, trying to figure out if they were going to fight or just exchange awkward pleasantries.",
    "Buford stared at $opponent’s clenched fist, wondering if it was a sign of impending violence or just a really weird way of asking for the time.",
    "Buford squinted at $opponent’s hands, wondering if they were holding a weapon or simply trying to impress with dramatic gestures.",
    "Buford sized up $opponent’s posture, trying to figure out if this was a friendly conversation or a prelude to a dramatic brawl.",
    "Buford adjusted his jacket nervously, unsure whether $opponent was about to attack or just adjusting his clothing for comfort.",
    "Buford looked at $opponent’s boots, wondering if they were meant for kicking or simply for kicking back at the end of a hard day.",
    "Buford cracked his knuckles, watching $opponent do the same, both wondering if this was the start of an epic showdown or just two guys with bad habits.",
    "Buford paced a little, trying to decide if he was about to fight $opponent or if they were simply both looking for the nearest exit.",
    "Buford stared intently at $opponent’s sunglasses, wondering if they were a sign of confidence or just a fashion choice.",
    "Buford raised his hands slowly, unsure if he should ask if $opponent was ready to fight or just wanted to borrow some change.",
    "Buford eyed $opponent’s stance, wondering if he was about to deliver a knockout blow or offer a friendly high-five.",
    "Buford turned his head slightly, studying $opponent for any sign of weakness, or was he just admiring the way he wore his jacket?",
    "Buford gave a dramatic sigh, unsure if $opponent was about to start a fight or if they both just needed to take a nap.",
    "Buford leaned back, trying to figure out if $opponent was ready to throw down or just stretching his arms after a long day of sitting.",
    "Buford adjusted his posture, wondering if $opponent was preparing for a battle or just figuring out how to sit comfortably.",
    "Buford squinted at $opponent’s shoes, wondering if they were a signal of aggression or just poor taste in footwear.",
    "Buford and $opponent exchanged a silent moment, both unsure whether they were about to clash or just agree on the best lunch spot.",
    "Buford checked his watch nervously, wondering if $opponent was really sizing him up or just running late for an appointment.",
    "Buford raised his fists slightly, unsure if $opponent was preparing to strike or just trying to reach for his car keys.",
    "Buford sized up $opponent’s posture, wondering if it was one of a warrior or someone simply trying to find the nearest restroom.",
    "Buford tried to figure out if the look in $opponent’s eyes was one of intimidation or just a desperate need for a good nap.",
    "Buford clenched his jaw, wondering if $opponent was about to strike or just thinking about where to eat after this encounter.",
    "Buford scanned $opponent’s attire, wondering if he was preparing for a fight or just a day at the beach.",
    "Buford locked eyes with $opponent, silently asking himself if this was a prelude to a knockout or just an awkward social experiment.",
    "Buford straightened up, trying to decide if $opponent was about to challenge him to a fight or simply trying to find his lost keys.",
    "Buford sized up $opponent’s height, wondering if this was a fight to the death or just a misunderstanding over seating arrangements.",
    "Buford stared intently at $opponent’s face, trying to gauge whether he was about to throw a punch or throw a party.",
    "Buford and $opponent exchanged glances, each wondering if the other was about to make a move or just call it a day and grab a snack.",
    "Buford paced back and forth, unsure whether to initiate a fight or just ask $opponent for directions.",
    "Buford adjusted his belt, wondering if $opponent was about to start a fight or just making a fashion statement.",
    "Buford and $opponent locked eyes, both wondering if this was about to become an epic showdown or just two guys in search of a good burger."
]

Negotiate = [
    "Buford begged, 'Come on, $opponent, let’s settle this with a game of rock-paper-scissors!' but $opponent replied, 'I prefer a good old-fashioned brawl!'",
    "Buford pleaded, 'We can just hug it out, $opponent, it’s scientifically proven to lower stress!' but $opponent shook his head, 'I don’t need science, I need victory!'",
    "Buford said, 'How about a dance-off instead? I can do the moonwalk!' but $opponent snapped, 'I’m not afraid of your fancy feet, Buford!'",
    "Buford tried reasoning, 'I’ve got cookies in my bag, we can share them!' but $opponent scoffed, 'You think cookies can stop me? I want a fight!'",
    "Buford sighed, 'Do we really need to do this, $opponent? I’m sure we could just play Monopoly instead!' but $opponent growled, 'I’m all in for a fistfight, not a board game!'",
    "Buford suggested, 'I’ll give you my last slice of pizza if you call it off!' but $opponent smirked, 'You think pizza can stop me? Let’s go!'",
    "Buford said, 'We could just grab a coffee and talk it out, right?' but $opponent rolled his eyes, 'I’m not here for small talk, Buford, I’m here for action!'",
    "Buford raised his hands, 'How about a pillow fight instead, $opponent?' but $opponent snorted, 'Pillows? Are you serious?'",
    "Buford laughed, 'You know what? Let’s just have a thumb war!' but $opponent gritted his teeth, 'I’ll crush your thumbs, Buford!'",
    "Buford grinned, 'I’ll teach you how to meditate, it’s much more peaceful!' but $opponent snapped, 'I’ve meditated enough to know I want to fight!'",
    "Buford said, 'We could form a rock band together, what do you say?' but $opponent laughed, 'I’m not interested in playing instruments, I’m interested in punching!'",
    "Buford attempted to reason, 'You don’t want to fight me, $opponent. My mom says I have delicate hands!' but $opponent scoffed, 'Delicate hands or not, I’m still punching!'",
    "Buford offered, 'I’ll teach you how to make the best spaghetti! We could cook instead!' but $opponent snorted, 'I came here for a fight, not pasta!'",
    "Buford said, 'Let’s settle this with a thumb war, $opponent. I’ve been practicing!' but $opponent shook his head, 'This isn’t a children’s game, Buford!'",
    "Buford asked, 'What if we just flip a coin to decide who wins?' but $opponent raised an eyebrow, 'I don’t need luck, I need fists!'",
    "Buford said, 'You don’t want to do this, $opponent. I can make balloon animals!' but $opponent grinned, 'And I can break balloons with my fists!'",
    "Buford smiled, 'Let’s play charades instead, $opponent. I’m excellent at it!' but $opponent grinned, 'Charades? Nah, I want to see your moves in the ring!'",
    "Buford tried, 'We could go skydiving together and talk it out in mid-air!' but $opponent smirked, 'I’m already falling for this fight, Buford!'",
    "Buford said, 'How about a friendly game of chess instead? I’m very strategic!' but $opponent cracked his knuckles, 'I prefer checkmate with my fists!'",
    "Buford suggested, 'I’ll let you pick the movie for movie night, $opponent, just don’t punch me!' but $opponent shook his head, 'I came for a fight, not a film!'",
    "Buford offered, 'We could do yoga instead! I know a great downward dog!' but $opponent growled, 'I’ll show you a downward fist, Buford!'",
    "Buford said, 'Let’s just have a staring contest instead, $opponent!' but $opponent rolled his eyes, 'I don’t need to stare, I need to fight!'",
    "Buford said, 'I’ll let you choose the flavor of ice cream if you call this off!' but $opponent laughed, 'You think a scoop of ice cream will stop me?'",
    "Buford begged, 'We could start a garden together instead! Plant some flowers!' but $opponent grinned, 'I’d rather plant my fist in your face!'",
    "Buford tried to persuade, 'I’m great at knitting, $opponent. We could make a sweater!' but $opponent chuckled, 'I’m going to knit you a one-way ticket to the mat!'",
    "Buford said, 'How about a taco eating contest? You can’t fight on an empty stomach!' but $opponent grinned, 'I fight better with tacos in my system!'",
    "Buford suggested, 'Let’s play ping pong instead! I’ll even let you win!' but $opponent snorted, 'I’m here to play, not to ping-pong!'",
    "Buford offered, 'I’ll give you my last donut if you let me go!' but $opponent raised an eyebrow, 'Do you think a donut can stop me, Buford?'",
    "Buford pleaded, 'We could have a jigsaw puzzle competition instead!' but $opponent growled, 'I’m not here for puzzles, I’m here for pain!'",
    "Buford laughed nervously, 'Let’s just agree to disagree and skip the fighting!' but $opponent cracked his knuckles, 'There’s no agreeing, Buford, just punching!'",
    "Buford said, 'You don’t want to fight, $opponent. I’m allergic to pain!' but $opponent grinned, 'Well, it looks like I’m giving you a dose of medicine then!'",
    "Buford tried to bargain, 'I’ll let you have my favorite book if you call it off!' but $opponent smirked, 'I’d rather see you reading while on the ground!'",
    "Buford offered, 'How about a race instead? I’m faster than I look!' but $opponent cracked his knuckles, 'I’m fast at punching, not running!'",
    "Buford begged, 'Let’s just play tag instead! It’ll be more fun!' but $opponent growled, 'Tag? I’ll tag you with my fist, Buford!'",
    "Buford said, 'We could make friendship bracelets instead! I’ve got beads!' but $opponent smirked, 'I’ll give you a bracelet made of pain!'",
    "Buford grinned, 'I’ll buy you lunch if you let me off the hook!' but $opponent shook his head, 'I don’t need lunch, I need to fight!'",
    "Buford suggested, 'We could make a TikTok video instead! Think of the views!' but $opponent glared, 'I’d rather get a view of you on the ground!'",
    "Buford said, 'How about a pie-eating contest instead? That’s more my speed!' but $opponent snapped, 'Pie doesn’t fight back, Buford, I do!'",
    "Buford said, 'We could have a pillow fight, I’m really good at them!' but $opponent raised an eyebrow, 'Are you going to hit me with a soft pillow or a punch, Buford?'",
    "Buford grinned, 'Let’s go play laser tag instead! I’m a pro!' but $opponent snorted, 'Laser tag? I’ll give you a real shot!'",
    "Buford tried to convince, 'We could go for a walk instead, $opponent. Fresh air is great for your health!' but $opponent snorted, 'I’d rather get fresh punches!'",
    "Buford said, 'I’ll let you pick the movie for tonight if you just let this go!' but $opponent growled, 'I’m picking the fight, Buford!'",
    "Buford offered, 'We could take a nap instead, I know the best nap spots!' but $opponent laughed, 'I’d rather nap you out with a punch, Buford!'",
    "Buford tried, 'Let’s have a tickling contest instead! I’m unbeatable!' but $opponent grinned, 'I’ll tickle you into submission with my fists!'",
    "Buford begged, 'I’ll buy you a puppy if you call this off!' but $opponent snorted, 'I don’t need a puppy, I need a fight!'",
    "Buford laughed, 'We could start a knitting club, $opponent!' but $opponent shook his head, 'I don’t knit, I fight!'",
    "Buford said, 'Let’s start a lemonade stand together! It’ll be fun!' but $opponent laughed, 'I’ll squeeze you like a lemon'",
]

Fight = [
    "Buford threw a powerful right hook and landed it squarely on $opponent’s jaw, but $opponent countered with a knee to Buford's stomach.",
    "Buford charged forward with a shoulder tackle and knocked $opponent off balance, but $opponent swept Buford’s legs and sent him to the ground.",
    "Buford landed a quick jab to $opponent’s face, and $opponent retaliated with an elbow to Buford's ribs.",
    "Buford kicked low to $opponent’s legs and struck hard, but $opponent caught Buford's foot and tripped him to the ground.",
    "Buford attempted a flying kick and landed it on $opponent’s chest, but $opponent grabbed Buford’s leg mid-air and flipped him onto his back.",
    "Buford swung a left hook and hit $opponent's temple, but $opponent blocked the next punch and landed a spinning backfist to Buford's head.",
    "Buford rushed in with a series of punches, landing a couple to $opponent's face, but $opponent blocked and then landed a knee strike to Buford’s chest.",
    "Buford attempted a roundhouse kick and connected with $opponent's side, but $opponent caught Buford’s ankle and threw him to the floor.",
    "Buford threw a haymaker and landed it on $opponent’s chin, but $opponent ducked and countered with an uppercut that rocked Buford’s head back.",
    "Buford tried to land an elbow strike and connected with $opponent's shoulder, but $opponent caught Buford's arm and locked him in a wrist lock.",
    "Buford kicked high and struck $opponent’s head, but $opponent caught Buford's foot, swept him off his feet, and sent him to the mat.",
    "Buford threw a jab and landed it on $opponent’s nose, but $opponent dodged the next strike and countered with a spinning back kick.",
    "Buford landed a solid punch to $opponent's body, but $opponent countered with a brutal headbutt that knocked Buford off balance.",
    "Buford charged in with a flying knee and struck $opponent’s chest, but $opponent caught Buford and slammed him hard to the mat.",
    "Buford threw a quick cross and landed it on $opponent’s face, but $opponent parried the next strike and delivered a swift elbow to Buford's temple.",
    "Buford went for a low leg kick and landed it on $opponent's thigh, but $opponent grabbed Buford’s leg and executed a takedown.",
    "Buford threw a straight punch and connected with $opponent’s jaw, but $opponent dodged the follow-up and countered with a vicious hook to Buford’s ribs.",
    "Buford landed a heavy right hook to $opponent’s ribs, but $opponent retaliated with a powerful knee to Buford’s chin that stunned him.",
    "Buford rushed in with a barrage of punches and landed several clean shots to $opponent’s face, but $opponent countered with a spinning elbow that caught Buford off guard.",
    "Buford attempted a head kick and landed it clean on $opponent’s temple, but $opponent ducked and countered with a flying knee to Buford’s midsection.",
    "Buford threw a quick combination and landed two jabs to $opponent’s face, but $opponent countered with a devastating roundhouse kick that landed on Buford's head.",
    "Buford tried a body slam and successfully lifted $opponent, but $opponent blocked it and landed a knee to Buford’s face as he was being lifted.",
    "Buford went for a low kick and connected with $opponent’s thigh, but $opponent checked it and landed a sharp front kick to Buford’s stomach.",
    "Buford attempted a choke hold and almost locked it in, but $opponent countered with an armbar and broke Buford's grip.",
    "Buford went for an axe kick and landed it on $opponent’s shoulder, but $opponent ducked the follow-up and struck Buford with a headbutt.",
    "Buford attempted a flying elbow and hit $opponent’s head, but $opponent caught Buford in mid-air and locked in a triangle choke.",
    "Buford swung a wild punch and landed it on $opponent’s face, but $opponent dodged and countered with a knee to Buford’s abdomen.",
    "Buford charged with a shoulder tackle and knocked $opponent off balance, but $opponent sidestepped and swept Buford’s legs out from under him.",
    "Buford went for a punch to the face and landed it square on $opponent's nose, but $opponent dodged and countered with a crushing elbow strike.",
    "Buford threw a quick left jab and landed it on $opponent’s chin, but $opponent blocked and countered with a spinning heel kick to Buford's midsection.",
    "Buford tried to land a haymaker and landed it clean on $opponent’s cheek, but $opponent ducked and countered with a hook to Buford’s ribs.",
    "Buford threw a series of jabs and landed a couple to $opponent's face, but $opponent dodged the next one and landed a devastating punch to Buford’s chin.",
    "Buford attempted a roundhouse kick and hit $opponent in the side, but $opponent caught Buford's leg and swept him to the ground.",
    "Buford went for a body blow and landed it to $opponent’s ribs, but $opponent evaded the next strike and countered with a knee to Buford’s head.",
    "Buford threw a spinning backfist and landed it on $opponent’s face, but $opponent ducked and countered with a brutal low kick.",
    "Buford tried a quick jab and landed it on $opponent’s cheek, but $opponent parried and countered with a straight punch to Buford’s face.",
    "Buford threw a high roundhouse kick and connected with $opponent’s head, but $opponent blocked it and landed a spinning back kick to Buford’s chest.",
    "Buford charged in with a series of strikes and landed a couple to $opponent's face, but $opponent dodged and delivered a body shot.",
    "Buford went for a leg sweep and landed it on $opponent’s feet, but $opponent jumped over it and countered with an elbow strike to Buford’s jaw.",
    "Buford tried a fast jab-cross combo and landed both on $opponent’s face, but $opponent ducked and countered with a low kick to Buford's thigh.",
    "Buford went for an open-handed slap and landed it on $opponent's cheek, but $opponent caught Buford's wrist and twisted it behind his back.",
    "Buford attempted a Superman punch and connected with $opponent's chest, but $opponent grabbed Buford's arm and threw him to the ground.",
    "Buford threw a heavy right and landed it on $opponent's jaw, but $opponent dodged and countered with a knee to Buford’s chest.",
    "Buford swung a left hook and landed it clean on $opponent’s temple, but $opponent blocked the next punch and landed an uppercut to Buford’s chin.",
    "Buford charged with a flying knee and landed it to $opponent’s chest, but $opponent caught him and landed a sharp elbow to Buford's head.",
    "Buford threw a series of jabs and landed several clean shots to $opponent’s face, but $opponent sidestepped and countered with a spinning back fist.",
    "Buford tried to land a body kick and connected with $opponent's ribs, but $opponent blocked the next strike and kicked Buford in the stomach.",
    "Buford attempted a knee strike and landed it to $opponent’s side, but $opponent caught Buford’s leg and threw him to the ground.",
    "Buford went for a straight punch and landed it on $opponent’s chin, but $opponent dodged and countered with a spinning heel kick.",
    "Buford tried a quick front kick and landed it to $opponent's midsection, but $opponent caught Buford’s foot and threw him to the mat.",
    "Buford attempted an axe kick and landed it on $opponent’s shoulder, but $opponent sidestepped and took Buford down with a leg sweep.",
    "Buford went for an overhand punch and landed it on $opponent's face, but $opponent blocked and landed an uppercut to Buford’s ribs.",
    "Buford landed a solid left hook to $opponent’s cheek, but $opponent answered with a brutal knee to Buford’s face.",
    "Buford tried a spinning back kick and landed it on $opponent’s stomach, but $opponent blocked the next strike and punched Buford in the face.",
    "Buford went for a takedown and almost succeeded, but $opponent sprawled and locked Buford in a headlock.",
    "Buford threw a jab and landed it on $opponent’s face, but $opponent sidestepped and countered with a quick cross to Buford’s jaw.",
    "Buford tried a low kick and connected with $opponent’s thigh, but $opponent checked it and landed a knee to Buford's stomach.",
    "Buford charged in with an elbow strike and landed it to $opponent's temple, but $opponent ducked and hit Buford with a headbutt.",
    "Buford attempted a flying knee and landed it on $opponent's chest, but $opponent caught it and slammed Buford to the mat.",
    "Buford threw a right hook and landed it on $opponent's jaw, but $opponent blocked it and landed an uppercut to Buford’s chin."
]

Lose = [
    "$opponent landed a crushing right hook to Buford’s jaw, sending him crashing to the ground, unconscious.",
    "$opponent unleashed a devastating uppercut that sent Buford flying backward, knocking him out cold.",
    "$opponent delivered a brutal roundhouse kick to Buford’s head, knocking him out before he even hit the ground.",
    "$opponent threw a powerful left hook that dropped Buford like a sack of potatoes, out cold on the pavement.",
    "$opponent stepped in with a lightning-fast jab to Buford’s face, leaving him dazed and crumpled to the floor.",
    "$opponent slammed a knee into Buford’s stomach, knocking the wind out of him and sending him reeling to the ground.",
    "$opponent dropped Buford with a perfectly-timed spinning backfist, leaving him sprawled out unconscious on the floor.",
    "$opponent planted a devastating kick to Buford’s chest, sending him crashing into a nearby fence, out cold.",
    "$opponent swept Buford’s legs from under him with a swift kick, and he crashed to the ground, knocked out.",
    "$opponent charged in with a flying knee that landed square in Buford’s chest, knocking him out cold instantly.",
    "$opponent closed the gap and landed a brutal knee to Buford’s face, knocking him out with a single strike.",
    "$opponent caught Buford with a heavy body blow that sent him gasping for air before a swift uppercut knocked him unconscious.",
    "$opponent delivered a quick right hook to Buford’s temple, and Buford collapsed to the ground, knocked out cold.",
    "$opponent threw a devastating knee to Buford’s ribs, followed by a vicious elbow to the face that left him sprawled out unconscious.",
    "$opponent landed a powerful backhanded slap to Buford’s face, causing him to stumble and collapse, unconscious.",
    "$opponent landed a crushing roundhouse kick to Buford’s head, knocking him out in one swift motion.",
    "$opponent threw a quick jab followed by a hook to Buford’s jaw, knocking him to the ground, unconscious.",
    "$opponent stepped in close and landed a thunderous uppercut that knocked Buford out cold before he hit the floor.",
    "$opponent snapped Buford’s head back with a brutal punch to the nose, sending him crumpling to the ground.",
    "$opponent delivered a lightning-fast sidekick to Buford’s ribs, leaving him gasping for breath and collapsing in a heap.",
    "$opponent landed a sharp knee to Buford’s chest, followed by a heavy punch to the jaw that left Buford out cold on the ground.",
    "$opponent hit Buford with a devastating headbutt to the face, causing him to stagger back and drop to the floor unconscious.",
    "$opponent delivered a clean right hook to Buford’s jaw, dropping him in a single blow, knocked out cold.",
    "$opponent ducked under Buford’s wild swing and nailed him with a perfect uppercut, knocking him out instantly.",
    "$opponent landed a heavy knee to Buford’s stomach, causing him to buckle and fall unconscious.",
    "$opponent threw a powerful overhand right that knocked Buford out cold, sending him straight to the floor.",
    "$opponent caught Buford with a clean punch to the face that sent him sprawling, knocked out before he hit the ground.",
    "$opponent slammed Buford with a heavy hook to the side of his head, knocking him out cold with a single strike.",
    "$opponent landed a sharp elbow to Buford’s temple, causing him to collapse to the floor, unconscious.",
    "$opponent grabbed Buford and slammed him into the ground with a vicious suplex, knocking him out cold.",
    "$opponent delivered a devastating body shot to Buford, followed by a brutal knee to the face that knocked him out instantly.",
    "$opponent unleashed a perfectly-timed side kick to Buford’s chest, sending him sprawling and unconscious on the floor.",
    "$opponent landed a savage elbow to Buford’s jaw, causing him to crumple to the ground, knocked out.",
    "$opponent caught Buford with a brutal spinning back kick that sent him crashing to the ground, knocked out cold.",
    "$opponent dropped Buford with a powerful right hand that landed square on his chin, knocking him out cold.",
    "$opponent grabbed Buford’s head and drove a knee into his face, knocking him out with a sickening thud.",
    "$opponent landed a swift knee to Buford’s ribs, followed by a sharp elbow to the back of his head, knocking him unconscious.",
    "$opponent launched a spinning backfist that landed perfectly on Buford’s jaw, sending him to the ground, knocked out.",
    "$opponent hit Buford with a solid kick to the chest that sent him sprawling across the floor, unconscious.",
    "$opponent delivered a brutal uppercut to Buford’s chin, knocking him off his feet and straight into unconsciousness.",
    "$opponent landed a devastating left hook to Buford’s face, knocking him out with a single strike.",
    "$opponent planted a heavy knee in Buford’s chest, sending him crashing into the ground, unconscious.",
    "$opponent threw a thunderous punch to Buford’s face, knocking him off his feet and out cold.",
    "$opponent slammed a powerful elbow into Buford’s jaw, sending him into a daze before dropping him to the ground, unconscious.",
    "$opponent landed a vicious kick to Buford’s ribs, followed by a crushing punch to his jaw that left Buford knocked out.",
    "$opponent delivered a stunning knee to Buford’s face, knocking him back and out cold in a single blow.",
    "$opponent launched a fast and brutal sidekick to Buford’s chest, knocking him backward and straight into unconsciousness.",
    "$opponent threw a spinning backfist that landed with brutal precision, knocking Buford unconscious in the blink of an eye.",
    "$opponent followed up his lightning-fast jab with a knockout punch to Buford’s chin, sending him crashing to the ground.",
    "$opponent delivered a perfectly executed flying knee to Buford’s face, knocking him unconscious with a single strike.",
    "$opponent swung a powerful hook to Buford’s face, sending him crashing to the ground, knocked out cold.",
    "$opponent landed a heavy cross to Buford’s temple, sending him sprawling to the ground, unconscious.",
    "$opponent took a step forward and threw a quick, brutal knee into Buford’s chest, knocking the wind out of him before he dropped unconscious.",
    "$opponent landed a crushing blow to Buford’s ribcage, knocking him sideways into the wall and knocking him out cold.",
    "$opponent delivered a stunning roundhouse kick to Buford’s head, knocking him unconscious before he even hit the ground.",
    "$opponent threw a quick combo of jabs and finished with a brutal cross to Buford’s face, knocking him out cold.",
    "$opponent hit Buford with a perfectly placed knee to the face, knocking him out with a sickening crunch.",
    "$opponent landed a solid right jab to Buford’s nose, followed by a devastating uppercut that sent him crashing to the floor.",
    "$opponent hit Buford with a thunderous body punch followed by a knee to the face that knocked him out cold.",
    "$opponent unleashed a brutal spinning back kick that landed squarely on Buford’s head, knocking him unconscious.",
    "$opponent landed a quick jab to Buford’s temple, followed by a thunderous uppercut that knocked him out cold.",
    "$opponent caught Buford with a perfect jab to the jaw, followed by a crushing knee to his chest that knocked him out cold.",
    "$opponent delivered a brutal kick to Buford’s ribs, followed by a quick punch to his face, knocking him unconscious.",
    "$opponent launched a perfectly-timed left hook that caught Buford square in the jaw, sending him straight to the floor.",
    "$opponent landed a series of punches to Buford’s head before finishing him with a swift uppercut that knocked him out cold.",
    "$opponent hit Buford with a clean shot to the temple, followed by a crushing right hook that sent him crashing to the floor, knocked out.",
    "$opponent landed a devastating kick to Buford’s chest that sent him flying back, crashing into a nearby wall, unconscious.",
    "$opponent threw a powerful punch to Buford’s face, knocking him down and out cold in a single blow.",
    "$opponent delivered a quick series of jabs to Buford’s face before finishing with a devastating uppercut that knocked him out cold.",
    "$opponent struck Buford with a crushing sidekick that left him sprawling unconscious on the floor.",
    "$opponent landed a perfectly timed jab to Buford’s nose, followed by a brutal elbow to his head, knocking him unconscious.",
    "$opponent threw a crushing hook to Buford’s jaw, sending him to the ground in a heap, knocked out.",
    "$opponent landed a solid punch to Buford’s stomach, sending him gasping for air before a final punch knocked him out cold.",
    "$opponent struck Buford with a savage knee to the chest, followed by a devastating punch to the head that left Buford out cold."
]

Win = [
    "Buford landed a powerful right hook to $opponent’s jaw, sending him sprawling to the ground, unconscious.",
    "Buford launched a lightning-fast uppercut, knocking $opponent clean off his feet and out cold.",
    "Buford kicked $opponent in the chest so hard that he flew backward into a trash can, knocked out cold.",
    "Buford caught $opponent with a perfectly timed roundhouse kick to the face, knocking him out in a single strike.",
    "Buford stepped in with a crushing knee to $opponent’s stomach, knocking the wind out of him before sending him crashing to the floor.",
    "Buford ducked under $opponent’s punch and delivered a brutal body blow, knocking him out with one swift strike.",
    "Buford grabbed $opponent by the collar and tossed him across the room, sending him crashing into a stack of boxes, out cold.",
    "Buford hit $opponent with a brutal right hook to the temple, sending him straight to the floor, knocked out.",
    "Buford unleashed a spinning backfist that landed squarely on $opponent’s face, knocking him unconscious.",
    "Buford knocked $opponent’s legs out from under him with a swift sweep, sending him crashing to the ground, knocked out cold.",
    "Buford landed a quick jab followed by a brutal cross to $opponent’s chin, knocking him out in one punch.",
    "Buford hit $opponent with a crushing uppercut that sent him flying back into a table, knocked out cold.",
    "Buford slammed a knee into $opponent’s ribs, followed by a punch to the jaw that knocked him unconscious.",
    "Buford caught $opponent with a savage punch to the stomach, followed by a powerful elbow to the face that knocked him out.",
    "Buford delivered a thunderous right cross to $opponent’s jaw, sending him crashing to the ground, knocked out cold.",
    "Buford sidestepped $opponent’s attack and landed a brutal uppercut, knocking him straight to the floor, unconscious.",
    "Buford landed a clean punch to $opponent’s nose, followed by a swift knee to the chest that left him gasping for air before dropping unconscious.",
    "Buford launched a flying knee that landed square in $opponent’s chest, knocking the wind out of him and leaving him out cold.",
    "Buford hit $opponent with a perfectly timed sidekick to the ribs, knocking him back into a wall, unconscious.",
    "Buford delivered a devastating elbow to $opponent’s face, knocking him out cold in a single blow.",
    "Buford caught $opponent’s wild punch and twisted his arm behind his back, slamming him to the ground, knocking him out cold.",
    "Buford dodged $opponent’s punch and landed a brutal left hook to his jaw, knocking him out instantly.",
    "Buford followed up his lightning-fast jab with a crushing uppercut that sent $opponent crashing to the floor, unconscious.",
    "Buford landed a solid kick to $opponent’s stomach, knocking him back into a nearby dumpster, knocked out cold.",
    "Buford hit $opponent with a clean spinning back kick to the chest, sending him flying back and crashing to the ground.",
    "Buford slammed a knee into $opponent’s face, knocking him backward and out cold with a single strike.",
    "Buford caught $opponent off guard with a quick jab to the nose, then followed up with a powerful cross to the chin, knocking him out cold.",
    "Buford knocked $opponent out cold with a devastating roundhouse kick to the head, sending him to the ground in one blow.",
    "Buford delivered a crushing body blow to $opponent, followed by a vicious knee to the face that left him knocked out on the floor.",
    "Buford landed a solid punch to $opponent’s jaw, sending him straight into unconsciousness with a single strike.",
    "Buford sent $opponent flying with a devastating backfist that landed squarely on his jaw, knocking him out instantly.",
    "Buford hit $opponent with a series of rapid punches to the face, ending with a knockout punch that sent him crashing to the ground.",
    "Buford caught $opponent with a devastating elbow to the face, knocking him out cold before he even hit the floor.",
    "Buford hit $opponent with a perfectly placed knee to the chest, sending him tumbling backward, unconscious.",
    "Buford landed a crushing blow to $opponent’s ribs, followed by a powerful knee to the head that left him knocked out cold.",
    "Buford delivered a thunderous right cross to $opponent’s jaw, sending him crashing to the floor, knocked out cold.",
    "Buford hit $opponent with a vicious spinning backfist, knocking him out cold in a single strike.",
    "Buford sent $opponent flying with a perfectly timed side kick to his chest, knocking him unconscious in midair.",
    "Buford kicked $opponent in the chest so hard that he crashed into a wall, knocked out cold and unable to stand.",
    "Buford followed up a powerful body punch with a brutal uppercut to $opponent’s chin, knocking him out cold.",
    "Buford caught $opponent’s leg and swept him off his feet, slamming him to the ground with a heavy thud, knocking him out cold.",
    "Buford landed a quick jab to $opponent’s face, then finished him off with a devastating roundhouse kick that left him unconscious.",
    "Buford hit $opponent with a crushing knee to the ribs, followed by a powerful elbow to the jaw, knocking him out cold.",
    "Buford delivered a savage punch to $opponent’s stomach, knocking the wind out of him before a knee to the face left him knocked out cold.",
    "Buford launched a flying kick that landed square in $opponent’s chest, knocking him backward and unconscious.",
    "Buford knocked $opponent out with a swift left hook to the chin, sending him crashing to the ground, out cold.",
    "Buford caught $opponent’s arm and twisted it behind his back before slamming him to the ground, knocking him out cold.",
    "Buford landed a crushing knee to $opponent’s face, sending him flying back and unconscious.",
    "Buford hit $opponent with a quick one-two punch combo, knocking him out with the second punch to the jaw.",
    "Buford unleashed a series of jabs followed by a final knockout blow to $opponent’s face, sending him crashing to the ground.",
    "Buford delivered a crushing knee to $opponent’s chest, followed by a lightning-fast uppercut that knocked him unconscious.",
    "Buford stepped forward with a brutal elbow to $opponent’s jaw, knocking him out in one swift motion.",
    "Buford dodged $opponent’s attack and landed a brutal backfist that knocked him unconscious.",
    "Buford landed a sharp uppercut to $opponent’s chin, sending him flying back and out cold.",
    "Buford hit $opponent with a powerful body shot, followed by a knee to the head that knocked him out cold.",
    "Buford caught $opponent’s punch, twisted his arm behind his back, and slammed him into the ground, knocking him out cold.",
    "Buford delivered a quick jab to $opponent’s nose, followed by a brutal roundhouse kick that sent him crashing to the floor, knocked out.",
    "Buford landed a savage right hook to $opponent’s temple, knocking him unconscious before he even hit the ground.",
    "Buford hit $opponent with a clean shot to the chin, sending him straight to the floor, knocked out cold.",
    "Buford hit $opponent with a perfectly timed spinning kick that knocked him out cold in a single blow.",
    "Buford landed a brutal knee to $opponent’s face, sending him crashing to the floor, unconscious.",
    "Buford knocked $opponent out cold with a devastating left hook to the jaw, sending him crashing to the floor.",
    "Buford delivered a crushing elbow to $opponent’s face, followed by a knee to the chest that left him unconscious.",
    "Buford sent $opponent flying with a perfect sidekick, knocking him unconscious before he even hit the ground.",
    "Buford hit $opponent with a brutal punch to the gut, followed by a devastating knee to the face that knocked him out cold.",
    "Buford launched a quick series of jabs to $opponent’s face before finishing with a crushing uppercut that sent him crashing to the floor.",
    "Buford hit $opponent with a clean left hook to the jaw, followed by a knee to the ribs that sent him sprawling unconscious.",
    "Buford followed up a brutal body blow with a powerful uppercut that knocked $opponent unconscious in one strike.",
    "Buford landed a powerful roundhouse kick to $opponent’s head, knocking him out cold with a single blow.",
    "Buford delivered a quick jab to $opponent’s face, then followed with a brutal right hook that knocked him out cold.",
    "Buford caught $opponent with a brutal knee to the face, knocking him out in a single strike.",
    "Buford landed a devastating left hook to $opponent’s jaw, sending him crashing to the ground, knocked out cold. "
 ]

Peace = [
    "Buford extends a hand of peace, and $opponent hesitates before sighing, 'Fine, I guess no punching today…' ",
    "Buford offers $opponent a cookie, and $opponent grumbles, 'I swear, you only do this to avoid a fight. Whatever, I’ll take it.'",
    "Rather than fighting, Buford suggests a rock-paper-scissors duel, and $opponent reluctantly nods, 'Alright, fine. No punches, but I’m winning this.'",
    "Buford offers $opponent some ice cream, and $opponent groans, 'I can’t believe I’m saying this, but okay, truce. Where’s the ice cream?'",
    "Buford holds out a peace sign, and $opponent rolls their eyes, muttering, 'Fine, whatever, no fighting… but this isn’t over.'",
    "Buford proposes they settle things with a dance-off, and $opponent sighs, 'I’m not happy about this, but fine, let’s get it over with.'",
    "Buford offers a whoopee cushion as a peace offering, and $opponent mutters, 'I’m not even sure how this fixes anything, but fine… I’ll call a truce.'",
    "Rather than fighting, Buford suggests a game of Scrabble, and $opponent reluctantly agrees, 'Alright, but if I lose, I’m blaming the tiles.'",
    "Buford extends an olive branch, and $opponent grudgingly accepts, 'Fine, fine. I’ll call it a truce. Don’t expect me to hug you, though.'",
    "Buford proposes a game of chess, and $opponent grumbles, 'I guess we’re not fighting today… but I’m warning you, I’m a chess master.'",
    "Buford offers $opponent a homemade smoothie, and $opponent sighs, 'Okay, I’ll drink it, but only because I’m too tired to fight.'",
    "Rather than a fight, Buford offers a puppy, and $opponent reluctantly agrees, 'I hate to admit it, but you’ve won me over with this cuteness.'",
    "Buford suggests a cookie-baking contest, and $opponent groans, 'Really? A baking contest? Fine, but you’re not beating me.'",
    "Buford offers a magic trick, and $opponent snorts, 'I can’t believe I’m doing this, but alright, no fighting, show me your trick.'",
    "Buford proposes a peace pact, and $opponent reluctantly agrees, 'Fine, let’s call it a truce. But you owe me after this.'",
    "Buford offers a thumb war to settle their differences, and $opponent sighs, 'Alright, whatever, no fistfight, but this is going to be embarrassing.'",
    "Buford says, 'Let’s talk it out over pizza!' and $opponent hesitates, then says, 'Pizza’s fine… but don’t think this is over.'",
    "Buford suggests laser tag instead of a fight, and $opponent grumbles, 'Fine, I’ll play laser tag, but only because I hate fistfights more than I hate you.'",
    "Buford hands over a balloon animal, and $opponent reluctantly takes it, 'Alright, no fighting, but you better not try to make me wear this.'",
    "Buford offers a game of darts, and $opponent sighs, 'If this means no fistfight, fine, but don’t think I’m going easy on you.'",
    "Buford offers to teach $opponent how to juggle, and $opponent rolls their eyes, 'Fine, whatever, no fight. But if you drop a ball, I’m out.'",
    "Buford extends a handshake, and $opponent takes it, grumbling, 'I swear, Buford, I’m only doing this because I’m not in the mood to throw punches.'",
    "Buford offers a homemade dinner, and $opponent reluctantly agrees, 'Fine, fine, I’ll come to dinner, but I’m not happy about it.'",
    "Rather than fight, Buford suggests a game of Tic-Tac-Toe, and $opponent shrugs, 'Fine, let’s do this. But if I lose, I’m not forgiving you.'",
    "Buford offers a balloon hat, and $opponent reluctantly puts it on, muttering, 'I can’t believe I’m wearing this. You’re lucky I hate fighting more.'",
    "Buford suggests a karaoke battle, and $opponent groans, 'I’m only doing this so I don’t have to punch you. But you’re going down.'",
    "Buford proposes a game of charades, and $opponent sighs, 'Fine, no fighting, but I better not have to act out anything stupid.'",
    "Buford proposes a mural project, and $opponent, looking unimpressed, mutters, 'I can’t believe I’m agreeing to this, but whatever. I’ll paint.'",
    "Buford offers a napkin with a peace speech, and $opponent shakes their head, 'I’m doing this for the peace, not because I like your speeches.'",
    "Buford offers to cook dinner for $opponent, and $opponent, with a deep sigh, agrees, 'Fine, just don’t burn anything this time.'",
    "Rather than a fight, Buford challenges $opponent to a scavenger hunt, and $opponent grumbles, 'I swear, Buford, if I find a sock instead of peace, I’m out.'",
    "Buford proposes a thumb war, and $opponent sighs, 'Alright, I’ll do this stupid thumb war… but you better not cheat.'",
    "Buford suggests a board game instead of a fight, and $opponent reluctantly agrees, 'Fine, we’ll play… but don’t expect me to smile.'",
    "Buford offers $opponent a dance party invitation, and $opponent grumbles, 'I can’t believe I’m doing this, but fine, let’s dance. No fighting.'",
    "Buford hands $opponent a peace pie, and $opponent hesitates before taking a bite, 'I’m not happy about this, but I guess I can’t punch you now.'",
    "Buford proposes a game of 'Find the Missing Sock', and $opponent groans, 'This is ridiculous, but whatever, let’s do it. No fighting.'",
    "Buford offers a balloon hat, and $opponent reluctantly puts it on, 'Fine, but I’m taking it off the second you start gloating.'",
    "Rather than fighting, Buford suggests a hopscotch game, and $opponent groans, 'I swear, if I lose this hopscotch game, I’m never speaking to you again.'",
    "Buford proposes a peaceful walk in the park, and $opponent sighs, 'Fine, but don’t expect me to be happy about it.'",
    "Buford offers a DIY project as a truce, and $opponent grumbles, 'Fine, I’ll help, but you’re doing all the hard work.'",
    "Buford offers a peace treaty written in emojis, and $opponent sighs, 'You’re ridiculous, but alright, I’ll call it a truce. No more fighting.'",
    "Buford offers to teach $opponent a magic trick, and $opponent mutters, 'Fine, show me your dumb magic trick. But if it’s bad, I’m walking away.'",
    "Buford offers $opponent a bowl of popcorn, and $opponent reluctantly agrees, 'Alright, I’ll take the popcorn, but you better not try to make me laugh.'",
    "Buford suggests they work together on a painting project, and $opponent mutters, 'Fine, but you’re not touching the paintbrush.'",
    "Buford offers a trivia contest, and $opponent reluctantly agrees, 'Fine, but I’m only doing this because I’m too lazy to fight.'",
    "Rather than a fight, Buford offers to play tag, and $opponent sighs, 'Fine, but if you tag me, I’m not playing anymore.'",
    "Buford offers $opponent a trampoline to jump on, and $opponent groans, 'Fine, I’ll jump, but I swear, if I fall, you’re in trouble.'",
    "Buford challenges $opponent to a puzzle, and $opponent reluctantly agrees, 'Alright, but if I lose, I’m not talking to you for a week.'",
    "Buford suggests a game of Pictionary, and $opponent sighs, 'Fine, but don’t expect me to draw anything good. No fighting, though.'",
    "Buford offers to share their favorite book, and $opponent grumbles, 'I’d rather punch you, but fine, I’ll read it.'",
    "Buford offers a giant peace hug, and $opponent hesitates, then reluctantly says, 'Okay, but this is a one-time thing, don’t get used to it.'"
]

Journey_Home = [
    "Buford began his long trek back home to prepare for a re-match with his adversary.",
    "His journey home started as Buford made his way back for a rematch with his foe.",
    "With determination, Buford set off on the road home, ready for a showdown with his enemy.",
    "Buford turned and began the long path back to face his rival again.",
    "The long road ahead led Buford home, where a rematch with his enemy awaited.",
    "Buford started his journey home, eager to confront his opponent once more.",
    "Though weary, Buford made his way back home to face his rival in a re-match.",
    "Buford set his sights on home, where he knew a rematch with his foe was imminent.",
    "His heart set on revenge, Buford began his journey home to face his foe again.",
    "Bruised but not beaten, Buford headed home to settle the score with his rival.",
    "Buford, his mind focused on victory, began his long journey back home to a re-match with his enemy.",
    "The battle was over, but Buford’s journey home was just beginning, toward a rematch with his adversary.",
    "With fire in his heart, Buford began his long trek home to face his enemy in a re-match.",
    "Buford’s eyes were set on the horizon as he started his journey home for a rematch with his foe.",
    "Buford turned his back on the battlefield and started his journey home to confront his rival.",
    "With each step, Buford drew closer to home, where a re-match with his foe awaited.",
    "Determined to settle things once and for all, Buford made his way home for a re-match with his adversary.",
    "Having fought hard, Buford began his long journey home to face his opponent in a rematch.",
    "Buford, battered but resolute, headed home to prepare for a rematch with his enemy.",
    "Buford started his journey home, knowing his rival was waiting for a re-match.",
    "Fueled by vengeance, Buford began his long trek back home to confront his foe.",
    "Buford began his long walk home, ready to meet his adversary in a re-match.",
    "Having fought valiantly, Buford now set out for home, where his foe awaited a rematch.",
    "Buford’s journey home began as he steeled himself for a re-match with his opponent.",
    "After the dust settled, Buford turned and began his trek home to face his foe once more.",
    "With a sense of purpose, Buford set off for home to prepare for a rematch with his enemy.",
    "Buford took his first step toward home, where a re-match with his adversary awaited.",
    "With a warrior’s resolve, Buford began his journey home to face his rival again.",
    "The long road home began for Buford, as he headed back to face his enemy in a re-match.",
    "Buford, determined to finish what he started, began his journey home to confront his foe.",
    "Without a second thought, Buford began his trek home to challenge his rival once again.",
    "With his goal clear, Buford headed home to face his adversary in a rematch.",
    "The battle had ended, but Buford's journey was far from over; he began his trek home to face his foe.",
    "Though exhausted, Buford began his long journey back home to settle things with his enemy.",
    "Buford, filled with resolve, set off for home to confront his opponent once more.",
    "Buford’s path was clear: home, and a re-match with his foe.",
    "After a hard-fought battle, Buford began his journey home, determined to face his rival again.",
    "Buford's heart set on a final showdown, he began his long trek home to a re-match with his foe.",
    "The long road to home called Buford, where a rematch with his enemy awaited.",
    "With eyes fixed on the horizon, Buford began his journey back home to face his rival.",
    "After the conflict, Buford began his journey home to prepare for a re-match with his foe.",
    "Buford, though weary, began his trek home, knowing a rematch awaited him with his rival.",
    "The journey home began for Buford as he set his sights on a re-match with his foe.",
    "Determined to face his rival again, Buford began his long journey home.",
    "Buford set out for home, knowing the re-match with his adversary was just ahead.",
    "Though battle-worn, Buford began his journey home for a re-match with his enemy.",
    "With a fierce determination, Buford set off home to face his foe in a rematch.",
    "Buford, with the sting of defeat fresh in his mind, began his journey home to settle the score.",
    "The road ahead seemed long, but Buford began his journey home, ready for the rematch.",
    "Buford's eyes burned with determination as he began his journey home to face his foe again.",
    "With each step, Buford’s resolve grew stronger as he journeyed home for a re-match with his rival.",
    "After a hard-fought clash, Buford began his long trek home to face his adversary again.",
    "Buford, his mission clear, began the long journey back home to a rematch with his foe.",
    "Buford’s heart burned with the desire for victory as he set off for home to face his enemy once more.",
    "Buford began his journey back to face his foe, his steps full of purpose.",
    "The long road home awaited Buford, and with it, a chance to finally face his adversary in a re-match.",
    "Buford, with fire in his belly, set off on the long journey home to meet his rival once again.",
    "The battle was over, but Buford’s journey was just beginning, as he headed home for a rematch.",
    "With the desire for retribution, Buford began his trek home to face his rival once more.",
    "With a fire in his heart, Buford started his journey home, determined to settle things with his foe.",
    "Buford, with a fierce resolve, began his long trek home to a re-match with his opponent.",
    "The fight was over, but Buford's journey had only begun, as he started the long trek home.",
    "Buford, though tired, began his journey home to face his foe in a rematch of epic proportions.",
    "With resolve in his eyes, Buford began his journey home to meet his rival once more.",
    "Buford began his journey home, determined to finish the battle he had started with his foe.",
    "The road was long, but Buford set off for home to face his adversary again in a rematch.",
    "With purpose in his heart, Buford began his journey back home to settle the score.",
    "Buford, steeled for the re-match, began his long trek home to face his opponent.",
    "Determined to settle the score, Buford began his long journey home to face his rival.",
    "Buford, with his eyes set on the challenge ahead, started his long trek home to face his foe.",
    "Buford began his journey back home, knowing that his rival was waiting for a rematch.",
    "The first step in Buford's journey home was taken, leading him toward a rematch with his adversary.",
    "Though worn from battle, Buford began his long journey home, ready for the rematch ahead.",
    "Buford set off toward home, his mind set on the inevitable re-match with his foe.",
    "Buford, with determination in his heart, began the long journey back home to face his enemy.",
    "Though exhausted, Buford knew the journey home would bring him face-to-face with his rival again.",
    "With each step toward home, Buford knew a rematch with his foe was waiting for him.",
    "Buford began his long journey home, ready to face his adversary again in a re-match.",
    "Buford, resolute in his mission, began his journey home to settle the score with his foe."
]

"""When moving through a block, we want detailed descriptions.  This gives the reader a narrative sense of the journey."""

# @title Block Descriptions
HOME = 'Home'
POSH = 'Posh'
SLUM = 'Slum'
PARK = 'Park'
BARS = 'Bars'
BOARDWALK = 'Boardwalk'
BORDER = 'End of the Road'

BLOCK_DESCRIPTIONS = {
    HOME: """Buford's home. A modest neighborhood, full of modest buildings, modest people and
    modest businesses. Even the vermin here were modest. The roaches never grew too large
    and the strays never betrayed any ambition to anything greater.  It wasn't much, but it
    was better than most and Buford was happy to call it home. But then one day, Biff
    moved into the neighborhood and took over, lowering the property values in the process. """,

    POSH: """Buford entered a posh neighborhood.  It was full of high rise apartment buildings and fancy
    cars.  Uniformed doormen looked down their noses at him as he walked by.  Some of them
    looked like tough customers.  There were also beefy men and women in black suits who
    looked to be private security.  They looked like killers.  Buford tried not to make eye
    contact to stay focused on his path.""",

    SLUM: """Buford walked through a broken down, filthy tenement.  This slum was as dank and
    depressing as it was menacing.  People dressed in rags looked at him; most looked ready to
    jump him for the sake of it.  Strange shapes blended into the shadows, and rats as big as
    cats scurried about.  Buford could have sworn their eyes glowed. """,

    PARK: """Buford strolled through a massive park. That was about the only thing it had going for it.  It had clearly
    seen better days. There was a large jung gym, which was completely dilapidated. To his
    left were see-saws, also dilapidated.  The pond was overgrown with algae and trash and
    somehow the trees seemed dilapidated.  Animals scurried through the underbrush; Buford
    couldn't see them clearly, but they seemed far too large to have any place in an
    urban area.""",

    BARS: """Buford entered the bar and club district.  It was a high
    end part of town, and still was.  People dressed in their finest and drove loud, fast
    cars.  Bouncers with inhumanly huge proportions crossed their arms and peered at him.
    This area may be fancy, but it still was the kind of place that could get one killed.
    Buford resolved not to be a statistic and kept it moving.""",

    BOARDWALK: """Buford arrived at the boardwalk. He remembered coming here as a child.  His mom would buy him cotton candy and hot
    dogs and they would ride the rides.  This was before the
    mutant Mafia took this place over and made it their own.  Mutants, disgusting and deadly.
    Buford was especially on high alert.  They moved without a sound and you never
    heard them coming.  You had to see them, and even then you only had the briefest
    of moments to respond.  A flash of green, maybe the bright red of a
    nose.  Then a second or two later, a beatdown came.""",

    BORDER: """Buford beheld a massive cinderblock wall with guard towers at the top. The guards
    didn't pay much attention to him; why should they?  The wall wasn't meant to keep him from
    getting out, but to keep what was beyond the walls from getting in.  For beyond the walls
    was something no one  dared lay eyes on, not even Biff.  Buford was at the end of his journey
    and could go no further."""
}

"""Now generate the world in which this novel takes place.  Since this is a journey on a road, it's a 1-dimensional array.  It's not randomly initialized, as enemies are tied to location and I want the journey to be such that the hero can build up stats, so things like ensuring weak enemies early on can help nudge the odds in that direction. The road ends at a fictionalized border to force a journey back."""

# @title Generate World
neighborhood_size = 25
road = [HOME]
road.extend([SLUM] * neighborhood_size)
road.extend([BARS] * neighborhood_size)
road.extend([PARK] * neighborhood_size)
road.extend([POSH] * neighborhood_size)
road.extend([BOARDWALK] * neighborhood_size)
road.append(BORDER)

"""Character interactions are driven by Markov Chain.  Each character has a Markov Chain which indicates how they will interact with the hero.  These chains get changed to represent improvements or diminishments due to winning, losing, etc...

Some states -- like fighting have self-loops with high transition probabilities.  This is meant to make such interactions likely to last over several rounds.
"""

# @title Define Enemies
encounter_states = ['Meet','Fight','Negotiate','Win','Lose','Peace']
ENEMIES = {
    HOME: ('Badass Biff', MarkovChain([
                            [0, 0.25, 0.75, 0, 0,    0],
                            [0, 0.9,  0.05, 0, 0.05, 0],
                            [0, 0.25, 0.75, 0, 0,    0],
                            [0, 0,    0,    1, 0,    0],
                            [0, 0,    0,    0, 1,    0],
                            [0, 0,    0,    0, 0,    1]],
                            encounter_states)),
    BOARDWALK: ('the mutant Mafia member', MarkovChain([
                                            [0, 0.25, 0.75, 0,     0,     0],
                                            [0, 0.9,  0.05, 0.025, 0.025, 0],
                                            [0, 0.24, 0.75, 0,     0,     0.01],
                                            [0, 0,    0,    1,     0,     0],
                                            [0, 0,    0,    0,     1,     0],
                                            [0, 0,    0,    0,     0,     1]],
                                            encounter_states)),
    POSH: ('the beefy bodyguard', MarkovChain([
                                    [0, 0.25, 0.75, 0, 0,    0   ],
                                    [0, 0.9,  0.05, 0, 0.05, 0   ],
                                    [0, 0.24, 0.75, 0, 0,    0.01],
                                    [0, 0,    0,    1, 0,    0   ],
                                    [0, 0,    0,    0, 1,    0   ],
                                    [0, 0,    0,    0, 0,    1   ]],
                                    encounter_states)),
    BARS: ('the bar bouncer', MarkovChain([
                                [0, 0.5,  0.5, 0, 0,    0  ],
                                [0, 0.75, 0.2, 0, 0.05, 0  ],
                                [0, 0.1,  0.4, 0, 0,    0.5],
                                [0, 0,    0,   1, 0,    0  ],
                                [0, 0,    0,   0, 1,    0  ],
                                [0, 0,    0,   0, 0,    1  ]],
                                encounter_states)),
    PARK: ('the mugger', MarkovChain([
                            [0, 0.5,  0.5, 0,    0,   0],
                            [0, 0.75, 0.1, 0.05, 0.1, 0],
                            [0, 0.5,  0.5, 0,    0,   0],
                            [0, 0,    0,   1,    0,   0],
                            [0, 0,    0,   0,    1,   0],
                            [0, 0,    0,   0,    0,   1]],
                            encounter_states)),
    SLUM: ('the jonesing junkie', MarkovChain([
                                    [0, 0.8,   0.2,  0,   0,    0    ],
                                    [0, 0.5,   0.01, 0.4, 0.09, 0    ],
                                    [0, 0.499, 0.5,  0,   0,    0.001],
                                    [0, 0,     0,    1,   0,    0    ],
                                    [0, 0,     0,    0,   1,    0    ],
                                    [0, 0,     0,    0,   0,    1    ]],
                                    encounter_states)),
    BORDER: ('the tower guard', MarkovChain([
                                    [0, 0.1,  0.9,  0,    0,    0   ],
                                    [0, 0.5,  0.01, 0.01, 0.48, 0   ],
                                    [0, 0.1,  0.4,  0,    0.1,  0.4 ],
                                    [0, 0,    0,    1,    0,    0   ],
                                    [0, 0,    0,    0,    1,    0   ],
                                    [0, 0,    0,    0,    0,    1   ]],
                                    encounter_states))
}

"""An initial contact with an enemy involves some sizing up and considerations of alternatives and how likely they are to succeed.  The transition probabailities give us a way of doing that."""

# @title Describing Likely Encounter Outcomes

def ratio(x:float, y:float) -> float:
    # If the denominator is 0, division is illegal, but it means that
    # x is infinitely higher.
    return float('inf') if y == 0 else x/y

def describe_character(book:Novel, name:str, x:MarkovChain) -> None:
    t1 = 1.25
    t2 = 0.75
    fight_vs_reason = ratio(x.p[0][1], x.p[0][2])
    if fight_vs_reason > t1:
        book.append(f"{name} looked aggressive, and unlikely to listen to reason. ")
    elif fight_vs_reason > t2:
        book.append(f"Buford couldn't tell if {name} would talk or throw a punch. ")
    else:
        book.append(f"{name} looked like someone who may listen to reason. ")

    win_vs_loss = ratio(x.p[1][3], x.p[1][4])
    if win_vs_loss > t1:
        book.append(f"Buford felt confident he could take {name}. ")
    elif win_vs_loss > t2:
        book.append(f"Buford and {name} seemed equally matched. ")
    else:
        book.append(f"Buford didn't like his chances. {name} looked like a tough customer. ")

    fight_length = x.p[1][1]
    if fight_length > 0.8:
        book.append("Either way, the fight was likely to be a long slog. ")
    else:
        book.append("If it went down, this was likely to be a short one. ")

"""Skills increasing or decreasing are represented by changes in the transition probabilities of Markov Chains.  Since the transition probabilities must sum to 1, this means increasing one probability means decreasing another to keep it balanced."""

# @title Updating Markov Chain
def update(row:int, col_increase:int, col_decrease:int) -> None:
    delta = 0.05
    for e in ENEMIES:
        (name,chain) = ENEMIES[e]
        probs = chain.p
        probs[row][col_increase] += delta
        probs[row][col_decrease] -= delta
        # We still want a stochastic element, so stop updating if we'll get to certainty
        if probs[row][col_increase] <= 0.95 and probs[row][col_decrease] >= 0.05:
            ENEMIES[e] = (name, MarkovChain(probs, encounter_states))

# We use this multiple times, so define it as a convenience function.
def improve_fighting(book:Novel) -> None:
     update(1,3,4)
     book.append("Buford felt his fighting skills get better. ")

"""The encounter/combat model consists of walking the chain until we hit an absorbing state, then updating the skills depending on the outcome, narrating it all the while."""

# @title Combat Model
def encounter(book:Novel, block:str) -> str | None:
    if block != HOME and randint(0,1) == 0:
        return None
    (name, enemy) = ENEMIES[block]
    last_state = None

    book.append(choice(Encounter_Start) + " It was " + name)

    describe_character(book, name, enemy)

    for state in walk(enemy, 'Meet'):
        description = globals()[state]
        template = Template(choice(description))
        book.append(template.substitute(opponent = name))
        last_state = state

    if last_state == 'Peace':
        book.append("This affirmed Buford's faith in the power of a hug instead of a bear hug, and he felt he was a better negotiator because of it. ")
        update(2,5,1)
        if randint(0,1) == 1:
            book.append(f"Buford was so charismatic that {name} even helped him train and improved his fighting! ")
            improve_fighting(book)
    elif last_state == 'Win':
        improve_fighting(book)
    elif last_state == 'Lose':
        book.append("Buford felt his confidence in his fighten skills waver. ")
        update(1,4,3)

    return last_state

"""Let's put it all together to create our novel.  We start at the hero's home in a battle the hero will lose (due to the Markov Chain for the villain).  Then have the hero journey forward and back again, where the story ends.  The story may end with the hero beating the villain, negotiating a peace or even losing.  But it's likely the hero will win, given the journey will update the chains to make victory more likely."""

# @title Create Novel & Show It
book = Novel()
book.append("Buford was a kind-hearted, reasonable guy who just wanted to live his life.")

FORWARD = 1
BACKWARD = -1
direction = FORWARD
block = ''
i = 0
while direction != BACKWARD or block != HOME:
    block = road[i]
    book.append(BLOCK_DESCRIPTIONS[block])
    outcome = encounter(book, block)
    if block == HOME:
        if outcome == 'Lose':
            book.append("Buford was ill-equipped for this battle.  He needed to learn more and prepare for a rematch.  He knew that out there was the secret, and so after dusting himself off, he began his long journey, not knowing where it would end.  ")
    elif block == BORDER:
        book.append("Buford learned all he could; it was time to turn back and face his nemesis")
    else:
        if outcome == 'Peace':
            book.append("Buford would have loved to spend more time with his newfound friend, his journey could not wait.")
        elif outcome == 'Win':
            book.append("Buford had no time to savor his victory, for he had much to learn if we was to win the war.  So he walked.")
        elif outcome == 'Lose':
            book.append("Later, Buford recovered from his humiliating loss and dusted himself off. He couldn't let this loss demoralize him.  He continued his journey. ")
    if block == BORDER:
        direction = BACKWARD
    i += direction

book.append("And so ends Buford's tale. ")
book.print()

Novel (Markov Chain Simulation).md