<jupyter_start><jupyter_text>Schritte<jupyter_code>sc = stepCounts[0]
figSteps7s, ax = plt.subplot_mosaic([["Boxplots Schritte"]], figsize=[
    20, 2.5], layout="constrained")
zeichneErrechnetenWert(ax["Boxplots Schritte"], "s", 7)
colorboxplot([sc], ax["Boxplots Schritte"], [""], [colors[0]])
ax["Boxplots Schritte"].set_title(
    prefix_graphics+"Spiellänge in Schritten für sieben Steine [{0:n} Spiele]".format(len(sc), grouping=True))
ax["Boxplots Schritte"].set_xlim((60, 300))
for txt in ax["Boxplots Schritte"].texts:
    if txt.get_position()[0] > 300:
        print(txt.get_text())
        txt.set_text(txt.get_text()+"→")
        txt.set_x(300)<jupyter_output>7<jupyter_text>typischer Spielverlauf<jupyter_code>gameIDAvg = rc.index(int(np.round(roundInfo["⌀"])))

print("ID für Spiel mit durchschnittlicher Länge:", ids[0][gameIDAvg])
gameAvg = getGameFromDB(ids[0][gameIDAvg], db_dir, db_filename)
print("Daten geladen")
figMovement = drawGame(gameAvg, gameSettings[0], figsize=[18, 9], prefix_graphics=prefix_graphics)
figMovement.suptitle("Spielverlaufsgraph", fontsize=16)<jupyter_output>ID für Spiel mit durchschnittlicher Länge: 7
Daten geladen<jupyter_text>Auswertung geworfen worden und verlorene Distanz<jupyter_code>throwCount = [0,0]
throwDistance = [0, 0]
for p_i,p in enumerate(gameAvg["stones"]):
    for s in gameAvg["stones"][p]:
        tc =sum([x < gameAvg["stones"][p][s][max([0, i-1])] for i, x in enumerate(gameAvg["stones"][p][s])])
        td = sum([(x < gameAvg["stones"][p][s][max([0, i-1])])*(x - gameAvg["stones"][p][s][max([0, i-1])]) for i, x in enumerate(gameAvg["stones"][p][s])])
        throwCount[p_i] += tc
        throwDistance[p_i] += td


print("Anzahl geworfen worden:\nSpieler 0: {}\nSpieler 1: {}\n\nverlorene Distanz: \nSpieler 0: {}\nSpieler 1: {}".format(*throwCount, *throwDistance))

throwCount = [0, 0]
throwDistance = [0, 0]
history = getHistoryFromDB(db_dir, db_filename)
print("History geladen")

throwCount = [0, 0]
throwDistance = [0, 0]
anfield = [0, 0]
afield = [0, 0]
drfield = [0, 0]
for game in history[:100000]:
    for p_i, p in enumerate(game["stones"]):
        for s in game["stones"][p]:
            tc = sum([x < game["stones"][p][s][max([0, i-1])] for i, x in enumerate(game["stones"][p][s])])
            td = sum([(x < game["stones"][p][s][max([0, i-1])])*(x - game["stones"][p][s][max([0, i-1])]) for i, x in enumerate(game["stones"][p][s])])
            af = sum([x == 8 for x in game["stones"][p][s]])
            afn = sum([(x != game["stones"][p][s][max([0, i-1])])*(x == 8) for i, x in enumerate(game["stones"][p][s])])
            dr = sum([(x != game["stones"][p][s][max([0, i-1])])*(x in [4, 8, 14]) for i, x in enumerate(game["stones"][p][s])])
            throwCount[p_i] += tc
            throwDistance[p_i] += td
            anfield[p_i] += afn
            afield[p_i] += af
            drfield[p_i] += dr


# print("Anzahl geworfen worden:\nSpieler 0: {:3.2f}\nSpieler 1: {:3.2f}\n\nverlorene Distanz: \nSpieler 0: {:3.2f}\nSpieler 1: {:3.2f}\n\n Stein liegt auf 8: \nSpieler 0: {:3.2f}\nSpieler 1: {:3.2f}\n\n 8 getroffen: \nSpieler 0: {:3.2f}\nSpieler 1: {:3.2f}\n\n Doubleroll getroffen: \nSpieler 0: {:3.2f}\nSpieler 1: {:3.2f}".format(
#     *[x/len(history[:100000]) for x in throwCount], *[x/len(history[:100000]) for x in throwDistance], *[x/len(history[:100000]) for x in afield], *[x/len(history[:100000]) for x in anfield], *[x/len(history[:100000]) for x in drfield]))
# print("Anzahl geworfen worden:&{:3.2f}&{:3.2f}\\\\verlorene Distanz: &{:3.2f}&{:3.2f}\\\\ Stein liegt auf 8: &{:3.2f}&{:3.2f}\\\\ 8 getroffen: &{:3.2f}&{:3.2f}\\\\ Doubleroll getroffen: &{:3.2f}&{:3.2f}".format(
#     *[x/len(history[:100000]) for x in throwCount], *[x/len(history[:100000]) for x in throwDistance], *[x/len(history[:100000]) for x in afield], *[x/len(history[:100000]) for x in anfield], *[x/len(history[:100000]) for x in drfield]))
print("& {: 3.4f} & {: 3.4f}\\\\\n & {: 3.4f} & {: 3.4f}\\\\\n & {: 3.4f} & {: 3.4f}\\\\\n & {: 3.4f} & {: 3.4f}\\\\\n & {: 3.4f} & {: 3.4f}".format(
    *[x/(len(history[:100000])*roundInfo["⌀"]) for x in throwCount], *[x/(len(history[:100000])*roundInfo["⌀"]) for x in throwDistance], *[x/(len(history[:100000])*roundInfo["⌀"]) for x in afield], *[x/(len(history[:100000])*roundInfo["⌀"]) for x in anfield], *[x/(len(history[:100000])*roundInfo["⌀"]) for x in drfield]))<jupyter_output>&  0.1416 &  0.0484\\
 & -1.0902 & -0.3534\\
 &  0.4526 &  0.0852\\
 &  0.0735 &  0.0683\\
 &  0.2161 &  0.2160<jupyter_text>Das kürzeste Spiel in der Simulation<jupyter_code>gameIDSpecial = rc.index(int(np.round(roundInfo["max"])))

print("ID für Spiel:", ids[0][gameIDSpecial])
gameSpecial = getGameFromDB(ids[0][gameIDSpecial], db_dir, db_filename)
print("Daten geladen")
figMovementFastest = drawGame(gameSpecial, gameSettings[0],figsize =[18,9])<jupyter_output>ID für Spiel: 613156
Daten geladen<jupyter_text>Wer gewinnt?<jupyter_code>def wer_gewinnt(winners, figsize=[15, 5]):

    player0 = [s.count(["p0"]) / len(s) * 100 for s in winners]
    player1 = [s.count(["p1"]) / len(s) * 100 for s in winners]
    no_one = [s.count([]) / len(s) * 100 for s in winners]
    # both = [s.count(["p0", "p1"]) / len(s) * 100 for s in winners]
    # print(player0)
    # print(player1)

    fig, ax = plt.subplots(figsize=figsize, layout="constrained")
    # hat_graph(ax, xlabels, [player0, player1], ['Player 0', 'Player 1'])

    p0 = ax.bar(
        labels,
        player0,
        label="Spieler 0",
        alpha=0.5,
        width=0.5,
        color=colors[0],
        hatch="///",
        edgecolor="dimgray",
    )
    p1 = ax.bar(
        labels,
        player1,
        label="Spieler 1",
        alpha=0.5,
        width=0.5,
        bottom=player0,
        color=colors,
        hatch="\\\\\\",
        edgecolor="dimgray",
    )
    ab = ax.bar(labels, no_one, label="Abbruch", alpha=.5, width=.5, color=colors,
                hatch="...", bottom=[sum(x) for x in zip(player0, player1)])
    # ev = ax.bar(labels, both, label="Unentschieden", alpha=.5, width=.5, color=colors,
    #             hatch="***", bottom=[sum(x) for x in zip(player0, player1, no_one)])

    ax.bar_label(p0, label_type="center", fmt="%3.5g%%", padding=5)
    ax.bar_label(p1, label_type="center", fmt="%3.5g%%", padding=5)
    ax.bar_label(ab, label_type='center', fmt=" "*30+"%3.5g%%", padding=5)
    # ax.bar_label(ev, label_type='center', fmt="%3.5g%%"+" "*30, padding=5)


    # Add some text for labels, title and custom x-axis tick labels, etc.
    ax.set_xlabel("Strategiepaarung (Strategie Spieler 0 vs Strategie Spieler 1)")
    ax.set_title("Wer gewinnt")
    # ax.legend( loc='lower center', ncol=2)
    ax.legend()
    ax.axhline(50, color=(0, 0, 0, 0.3), ls="--")

    fig.tight_layout()
    ax.set_yticks(np.linspace(0, 100, 11))

    ax.set_ylim(0,110)
    ax.yaxis.set_major_formatter(mt.PercentFormatter())
    ax.grid(axis="y", color=("gray"), alpha=0.3, ls="--")
    plt.show()

wer_gewinnt(winners,[5, 5])<jupyter_output>C:\Users\walli\AppData\Local\Temp/ipykernel_2336/1652222094.py:52: UserWarning: This figure was using constrained_layout, but that is incompatible with subplots_adjust and/or tight_layout; disabling constrained_layout.
  fig.tight_layout()<jupyter_text>Speichern der Grafiken<jupyter_code>figRounds7s.savefig("../../tex/game_ur_ba_thesis/img/Grafiken/Strategien/"+graphic_dir+"/rounds.png", dpi=300,)
figMovement.savefig( "../../tex/game_ur_ba_thesis/img/Grafiken/Strategien/"+graphic_dir+"/Spielverlauf.png", dpi=300,)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2113714135298763, 'fraction_numerical': 0.05567254540668597, 'mean_word_length': 4.113728129205922, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 21, 'https://': 0, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '284443', 'license': 'MIT', 'n_tokens_mistral': 3343, 'n_tokens_neox': 3055, 'n_words': 591, 'path': 'src/statistiken/Strategie_MoveFirst.ipynb', 'repo_name': 'LukasWallisch/game-ur-analysis', 'size': '7598'}