<jupyter_start><jupyter_text>The goblin problem<NAME>[MIT License](https://en.wikipedia.org/wiki/MIT_License)<jupyter_code>%matplotlib inline

import pandas as pd
import numpy as np

import matplotlib.pyplot as plt
import seaborn as sns
sns.set(style='white')

from thinkstats2 import Pmf, Cdf

import thinkstats2
import thinkplot

decorate = thinkplot.config<jupyter_output><empty_output><jupyter_text>The goblin problemIn Dungeons and Dragons, the amount of damage a goblin can withstand is the sum of two six-sided dice. The amount of damage you inflict with a short sword is determined by rolling one six-sided die.Suppose you are fighting a goblin and you have already inflicted 4 points of damage. What is your probability of defeating the goblin with your next successful attack?(Where "defeat" means that the goblin can withstand no more damage.)Note: You can solve this problem with paper and pencil or computationally; you can solve it using Bayes's Theorem, combinatorics, or using the Pmf class.<jupyter_code>d6 = Pmf(range(1,7))
d6.Print()
twice = d6 + d6
twice.Print()
twice[2] = 0
twice[3] = 0
twice[4] = 0
twice.Normalize()
twice.Print()
remaining = twice - 4
remaining.Print()
d6.ProbGreater(remaining) + d6.ProbEqual(remaining)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.0792156862745098, 'fraction_numerical': 0.01411764705882353, 'mean_word_length': 5.71578947368421, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '338719', 'license': 'MIT', 'n_tokens_mistral': 427, 'n_tokens_neox': 402, 'n_words': 151, 'path': 'DSC 530 - Data Exploration and Analysis/ThinkStats2/examples/goblin.ipynb', 'repo_name': 'Hakuna-Patata/BU_MSDS_PTW', 'size': '1281'}