Compare commits
69
Commits
pages
..
a8a4b1901d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a8a4b1901d | ||
|
|
bd89a8941b | ||
|
|
3e21fd8992 | ||
|
|
7d74b6ab8c | ||
|
|
9610765b61 | ||
|
|
73a6f5d355 | ||
|
|
3b5c655d51 | ||
|
|
e5bcd13db2 | ||
|
|
93bdfcd4da | ||
|
|
b3fa6c4c5b | ||
|
|
f8e4f575f4 | ||
|
|
d01ec46fcc | ||
|
|
51842e1aa9 | ||
|
|
b56bab9165 | ||
|
|
ab3664f369 | ||
|
|
ee07ee143e | ||
|
|
4837332a7d | ||
|
|
614bfcda7c | ||
|
|
8713ccff1a | ||
|
|
8f1f0383fe | ||
|
|
64fd3af235 | ||
|
|
2271fe0976 | ||
|
|
c0355616b6 | ||
|
|
d37eaa3378 | ||
|
|
43066ad67f | ||
|
|
dd25dfaa32 | ||
|
|
5c49591dae | ||
|
|
19209a2ad6 | ||
|
|
9f1bb3d3b5 | ||
|
|
3b24a11f5a | ||
|
|
61bc50583c | ||
|
|
63b5d40e54 | ||
|
|
11b4a0398e | ||
|
|
d04b88e7b4 | ||
|
|
963b08c522 | ||
|
|
cc86343668 | ||
|
|
3536007ade | ||
|
|
432e04c2c7 | ||
|
|
dcd5117373 | ||
|
|
2b905b4a84 | ||
|
|
cfcbe54486 | ||
|
|
df103ae1fa | ||
|
|
0b025af0f0 | ||
|
|
83bc19521e | ||
|
|
c2dcaee16f | ||
|
|
5f66b9647a | ||
|
|
1646844fa6 | ||
|
|
68587a55f0 | ||
|
|
e8c177fc15 | ||
|
|
99f60282ed | ||
|
|
7366af2f7d | ||
|
|
0ac5dfd971 | ||
|
|
f0d9b80da8 | ||
|
|
efb54f3d7a | ||
|
|
3d1c09138d | ||
|
|
3b3622a08a | ||
|
|
754e4f1eb8 | ||
|
|
790b7e6f5e | ||
|
|
2eace69d7d | ||
|
|
1b0ef9a2c1 | ||
|
|
de80e99c74 | ||
|
|
bdf66afabc | ||
|
|
d2ffb84b5e | ||
|
|
46ee08a56b | ||
|
|
9c0e35423a | ||
|
|
21f3c8fd84 | ||
|
|
78baf9cec4 | ||
|
|
c3d067b88c | ||
|
|
0052d1a5fd |
@@ -0,0 +1,53 @@
|
||||
# The loop with the bot, every four hours: import the bot's new runs, refit the route model, rebuild the experiment
|
||||
# plan, hand the bot its files, and open a pull request with the new public data (it merges itself once CI passes).
|
||||
# Gitea Actions. Needs a runner on the machine that has the bot's folder (the runner label below), because the
|
||||
# bot's raw data (game prose, account names) never leaves that machine: only the anonymised runs are committed.
|
||||
#
|
||||
# Variables (repository Settings -> Actions -> Variables):
|
||||
# DRAGONKIND_BOT_DIR the bot's folder on the runner, e.g. /home/ken/DragonKind
|
||||
# ATLAS_DELIVER_DIR where the bot reads its files, e.g. /home/ken/DragonKind/vendor/threshing-atlas
|
||||
# Secrets:
|
||||
# DK_ACCOUNT_SALT the salt account names are hashed with (the same one every time)
|
||||
# ATLAS_BOT_TOKEN as in update-sources.yml
|
||||
name: Bot cycle
|
||||
on:
|
||||
schedule:
|
||||
- cron: "41 */4 * * *"
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
cycle:
|
||||
runs-on: bot-host # a runner on the bot's machine; change it to that runner's label
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.ATLAS_BOT_TOKEN }}
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- run: pip install -r requirements.txt
|
||||
- name: Import, refit, re-plan, deliver
|
||||
env:
|
||||
DK_ACCOUNT_SALT: ${{ secrets.DK_ACCOUNT_SALT }}
|
||||
run: python -m collection cycle --bot "${{ vars.DRAGONKIND_BOT_DIR }}" --deliver "${{ vars.ATLAS_DELIVER_DIR }}"
|
||||
- id: diff
|
||||
run: |
|
||||
git add -A data analysis/reports
|
||||
if git diff --cached --quiet; then echo "changed=false" >> "$GITHUB_OUTPUT"; else echo "changed=true" >> "$GITHUB_OUTPUT"; fi
|
||||
- name: Tests
|
||||
if: steps.diff.outputs.changed == 'true'
|
||||
run: npm test
|
||||
- name: Open a pull request with the new data (it merges itself once CI passes)
|
||||
if: steps.diff.outputs.changed == 'true'
|
||||
env:
|
||||
ATLAS_BOT_TOKEN: ${{ secrets.ATLAS_BOT_TOKEN }}
|
||||
run: |
|
||||
branch="data/bot-cycle-$(date -u +%Y%m%d-%H%M)"
|
||||
git config user.name "Atlas data bot"
|
||||
git config user.email "atlas-bot@noreply.localhost"
|
||||
git checkout -b "$branch"
|
||||
git commit -m "data: bot cycle (new runs, route model, experiment plan)"
|
||||
git push origin "$branch"
|
||||
python -m collection forge open-pr --head "$branch" --title "Bot cycle: new runs, route model and plan" --body-file exports/last-cycle.md --automerge
|
||||
@@ -0,0 +1,24 @@
|
||||
# Tests on every push and pull request (Gitea Actions; GitHub's copy is .github/workflows/ci.yml).
|
||||
# The branch rule for main (docs/REPO_SETTINGS.md) requires this check, named "CI / test".
|
||||
name: CI
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest # a runner label on the server (act_runner); change it if the server uses another
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- run: pip install -r requirements.txt
|
||||
- run: npm test
|
||||
- name: graph.json is up to date
|
||||
run: node analysis/network/build-graph.js && git diff --exit-code data/public/graph.json
|
||||
- name: the page builds
|
||||
run: node site/build.js
|
||||
@@ -0,0 +1,90 @@
|
||||
# Every day: check every source (collection/pipeline.yaml), and when something changed, rebuild the runs, the
|
||||
# graph, the route model and the statistics, run the tests and open a pull request that merges itself once CI
|
||||
# passes. A source that cannot be reached, or new answers the coding rules do not know, open an issue instead.
|
||||
# Gitea Actions; GitHub's copy (with GitHub Pages) is .github/workflows/update-sources.yml.
|
||||
#
|
||||
# Secrets (repository Settings -> Actions -> Secrets; docs/REPO_SETTINGS.md):
|
||||
# ATLAS_BOT_TOKEN a Gitea access token (repository: read and write; issue: read and write). Needed to push the
|
||||
# update branch and open the pull request; the built-in token cannot start the CI it needs.
|
||||
# RAW_ARCHIVE_KEY optional: encrypts the private raw store kept in the Actions cache between runs
|
||||
# REDDIT_CLIENT_ID, REDDIT_CLIENT_SECRET optional: read the megathreads through the Reddit API
|
||||
name: Check sources for new data
|
||||
on:
|
||||
schedule:
|
||||
- cron: "23 10 * * *" # daily
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest # a runner label on the server (act_runner)
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.ATLAS_BOT_TOKEN }}
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- run: pip install -r requirements.txt
|
||||
- name: Restore the private raw archive
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ${{ runner.temp }}/raw-archive
|
||||
key: raw-archive-none
|
||||
restore-keys: raw-archive-
|
||||
- name: Decrypt it
|
||||
env:
|
||||
RAW_ARCHIVE_KEY: ${{ secrets.RAW_ARCHIVE_KEY }}
|
||||
run: |
|
||||
f="$RUNNER_TEMP/raw-archive/raw.tgz.enc"
|
||||
if [ -n "$RAW_ARCHIVE_KEY" ] && [ -f "$f" ]; then
|
||||
openssl enc -d -aes-256-cbc -pbkdf2 -pass env:RAW_ARCHIVE_KEY -in "$f" | tar -xz -C data
|
||||
fi
|
||||
- id: check
|
||||
env:
|
||||
ATLAS_BOT_TOKEN: ${{ secrets.ATLAS_BOT_TOKEN }}
|
||||
REDDIT_CLIENT_ID: ${{ secrets.REDDIT_CLIENT_ID }}
|
||||
REDDIT_CLIENT_SECRET: ${{ secrets.REDDIT_CLIENT_SECRET }}
|
||||
run: python -m collection update --report "$RUNNER_TEMP/report.md"
|
||||
- name: Rebuild the analysis and run tests
|
||||
if: steps.check.outputs.changed == 'true'
|
||||
run: |
|
||||
python -m collection rebuild
|
||||
npm test
|
||||
- name: Encrypt the raw store
|
||||
id: archive
|
||||
env:
|
||||
RAW_ARCHIVE_KEY: ${{ secrets.RAW_ARCHIVE_KEY }}
|
||||
run: |
|
||||
if [ -n "$RAW_ARCHIVE_KEY" ] && [ -d data/raw ]; then
|
||||
mkdir -p "$RUNNER_TEMP/raw-archive"
|
||||
tar -czf - -C data raw | openssl enc -aes-256-cbc -pbkdf2 -salt -pass env:RAW_ARCHIVE_KEY -out "$RUNNER_TEMP/raw-archive/raw.tgz.enc"
|
||||
echo "save=true" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
- name: Save it (a new copy only when a raw file changed)
|
||||
if: steps.archive.outputs.save == 'true'
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: ${{ runner.temp }}/raw-archive
|
||||
key: raw-archive-${{ hashFiles('data/manifest.json') }}
|
||||
- name: Open a pull request with the new data (it merges itself once CI passes)
|
||||
if: steps.check.outputs.changed == 'true'
|
||||
env:
|
||||
ATLAS_BOT_TOKEN: ${{ secrets.ATLAS_BOT_TOKEN }}
|
||||
run: |
|
||||
# one branch per run: a second run on the same day (or a leftover branch) never blocks the push
|
||||
branch="data/source-update-$(date -u +%Y%m%d)-run${{ github.run_number }}"
|
||||
git config user.name "Atlas data bot"
|
||||
git config user.email "atlas-bot@noreply.localhost"
|
||||
git checkout -b "$branch"
|
||||
git add -A data analysis/reports core/graph.js .github/ISSUE_TEMPLATE
|
||||
git commit -m "data: update from community sources"
|
||||
git push origin "$branch"
|
||||
python -m collection forge open-pr --head "$branch" --title "New data from the community sources" --body-file "$RUNNER_TEMP/report.md" --automerge
|
||||
- name: Report a broken source or new answers
|
||||
if: steps.check.outputs.failed != ''
|
||||
env:
|
||||
ATLAS_BOT_TOKEN: ${{ secrets.ATLAS_BOT_TOKEN }}
|
||||
run: |
|
||||
python -m collection forge open-issue --title "Source check failed: ${{ steps.check.outputs.failed }}" --body-file "$RUNNER_TEMP/report.md"
|
||||
@@ -0,0 +1,217 @@
|
||||
# Written by collection/etl/report_form.py from collection/specs/report_form.yaml: edit that file, then run `python -m collection build`.
|
||||
name: Report a run
|
||||
description: Log one threshing run for the Threshing Atlas. Reports are public and become rows of runs_clean.csv.
|
||||
title: Run report
|
||||
labels:
|
||||
- run report
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for reporting a run! Answer what you remember; leave anything you're unsure of on "Not sure".
|
||||
Every answer here is visible to everyone who can see this repository (it is an issue) and goes into the Atlas's
|
||||
open data as source "reported".
|
||||
Please don't include your DragonKind account name or anything personal.
|
||||
You can also use the community [Threshing Routes form](https://forms.gle/DRpj9tG8gb5E4Hcu7) linked from the r/fourthwing megathread; please report each run only once.
|
||||
- type: dropdown
|
||||
id: goal
|
||||
attributes:
|
||||
label: Which dragon were you trying to bond?
|
||||
options:
|
||||
- Red
|
||||
- Green
|
||||
- Orange
|
||||
- Brown
|
||||
- Blue
|
||||
- Black
|
||||
- Any, just for fun
|
||||
- Not sure
|
||||
validations:
|
||||
required: false
|
||||
- type: input
|
||||
id: attempt
|
||||
attributes:
|
||||
label: Which attempt was this for your account? (a number; 1 = your first)
|
||||
placeholder: e.g. 3
|
||||
validations:
|
||||
required: false
|
||||
- type: dropdown
|
||||
id: company
|
||||
attributes:
|
||||
label: Who entered the valley with you?
|
||||
options:
|
||||
- Alone
|
||||
- One squadmate
|
||||
- Two squadmates
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: left_squadmates
|
||||
attributes:
|
||||
label: If you went with squadmates, did you leave them?
|
||||
options:
|
||||
- Yes, I left them
|
||||
- No, we stayed together
|
||||
- I went alone
|
||||
- Not sure
|
||||
validations:
|
||||
required: false
|
||||
- type: dropdown
|
||||
id: direction
|
||||
attributes:
|
||||
label: Which way did you go first?
|
||||
options:
|
||||
- East (toward the roar)
|
||||
- West (toward the scent)
|
||||
- Toward the forest centre
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: first_sighting
|
||||
attributes:
|
||||
label: Which dragon found you first?
|
||||
options:
|
||||
- Red
|
||||
- Brown
|
||||
- Green
|
||||
- Orange
|
||||
- Not sure
|
||||
validations:
|
||||
required: false
|
||||
- type: dropdown
|
||||
id: sighting_action
|
||||
attributes:
|
||||
label: What did you do when it found you?
|
||||
options:
|
||||
- Hold still
|
||||
- Lower your eyes in respect / turn to face it
|
||||
- Run
|
||||
- Hide
|
||||
- Draw a weapon
|
||||
- Meet its gaze
|
||||
- Protect your squadmate
|
||||
- Not sure
|
||||
validations:
|
||||
required: false
|
||||
- type: dropdown
|
||||
id: scream
|
||||
attributes:
|
||||
label: The scream
|
||||
options:
|
||||
- I died at the first dragon
|
||||
- Investigated, and helped my squadmate
|
||||
- Investigated, and walked away
|
||||
- Kept walking (ignored it)
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: combat_first
|
||||
attributes:
|
||||
label: 'If you helped: your first move in the fight'
|
||||
options:
|
||||
- Pause to assess
|
||||
- Charge the smaller cadet
|
||||
- Charge between the bigger cadet and your squadmate
|
||||
- Not sure
|
||||
validations:
|
||||
required: false
|
||||
- type: dropdown
|
||||
id: combat_second
|
||||
attributes:
|
||||
label: 'If you paused to assess: the smaller cadet''s dagger'
|
||||
options:
|
||||
- Engage the smaller cadet
|
||||
- Charge the bigger cadet anyway
|
||||
- Not sure
|
||||
validations:
|
||||
required: false
|
||||
- type: dropdown
|
||||
id: resolution
|
||||
attributes:
|
||||
label: How did the cadet encounter end?
|
||||
options:
|
||||
- I died in the fight
|
||||
- 'Bullies: killed them myself'
|
||||
- 'Bullies: my squadmate''s revenge'
|
||||
- 'Bullies: left them to the dragons'
|
||||
- 'Wounded cadet: tourniquet'
|
||||
- 'Wounded cadet: left them'
|
||||
- 'Wounded cadet: took their weapons'
|
||||
- I walked away from the clearing
|
||||
- Not sure
|
||||
validations:
|
||||
required: false
|
||||
- type: dropdown
|
||||
id: post_path
|
||||
attributes:
|
||||
label: 'After the fight: which way did you walk?'
|
||||
options:
|
||||
- Deeper into the forest
|
||||
- West
|
||||
- East
|
||||
- There was no fork
|
||||
- Not sure
|
||||
validations:
|
||||
required: false
|
||||
- type: dropdown
|
||||
id: hour
|
||||
attributes:
|
||||
label: After an hour's walk
|
||||
options:
|
||||
- Climbed the tallest tree
|
||||
- Went to the valley centre
|
||||
- I died before the hour
|
||||
- Not sure
|
||||
validations:
|
||||
required: false
|
||||
- type: dropdown
|
||||
id: branch
|
||||
attributes:
|
||||
label: Which bonding encounter did you reach?
|
||||
options:
|
||||
- 'Tree: the shadow (Blue or Black)'
|
||||
- 'Tree: climbed down quickly, jumped on the Red'
|
||||
- 'Tree: climbed down quickly, let the Red pass'
|
||||
- 'Tree: climbed down slowly to the two Greens'
|
||||
- 'Valley: faced the Red'
|
||||
- 'Valley: passed the Red, the meadow'
|
||||
- Not sure
|
||||
validations:
|
||||
required: false
|
||||
- type: dropdown
|
||||
id: outcome
|
||||
attributes:
|
||||
label: How did the run end?
|
||||
options:
|
||||
- Bonded
|
||||
- Incinerated at a bonding encounter
|
||||
- Died before the hour
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: outcome_color
|
||||
attributes:
|
||||
label: Which dragon bonded you (or incinerated you)?
|
||||
options:
|
||||
- Red
|
||||
- Green
|
||||
- Orange
|
||||
- Brown
|
||||
- Blue
|
||||
- Black
|
||||
- Not sure
|
||||
validations:
|
||||
required: false
|
||||
- type: dropdown
|
||||
id: tail
|
||||
attributes:
|
||||
label: 'If you bonded: the dragon''s tail'
|
||||
options:
|
||||
- Clubtail
|
||||
- Daggertail
|
||||
- Morningstartail
|
||||
- Scorpiontail
|
||||
- Swordtail
|
||||
- Not sure
|
||||
validations:
|
||||
required: false
|
||||
@@ -0,0 +1,21 @@
|
||||
name: CI
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- run: pip install -r requirements.txt
|
||||
- run: npm test
|
||||
- name: graph.json is up to date
|
||||
run: node analysis/network/build-graph.js && git diff --exit-code data/public/graph.json
|
||||
- run: npm run build
|
||||
@@ -0,0 +1,30 @@
|
||||
name: Deploy Atlas to GitHub Pages
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
concurrency:
|
||||
group: pages
|
||||
cancel-in-progress: true
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- run: npm run build
|
||||
- uses: actions/configure-pages@v5
|
||||
- uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: dist
|
||||
- id: deployment
|
||||
uses: actions/deploy-pages@v4
|
||||
@@ -0,0 +1,99 @@
|
||||
name: Check sources for new data
|
||||
on:
|
||||
schedule:
|
||||
- cron: "23 10 * * *" # daily
|
||||
workflow_dispatch:
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
issues: write
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
# secrets cannot be tested in `if:` directly
|
||||
HAS_BOT_TOKEN: ${{ secrets.ATLAS_BOT_TOKEN != '' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- run: pip install -r requirements.txt
|
||||
# The raw store (data/raw: the current and previous raw file of each source) is never committed. Between runs
|
||||
# it lives in the Actions cache, encrypted with the RAW_ARCHIVE_KEY secret, so only the previous version is
|
||||
# kept and nobody without the key can read it (the register has rider names). Without the secret there is no
|
||||
# archive: each run starts from the manifest alone.
|
||||
- name: Restore the private raw archive
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ${{ runner.temp }}/raw-archive
|
||||
key: raw-archive-none
|
||||
restore-keys: raw-archive-
|
||||
- name: Decrypt it
|
||||
env:
|
||||
RAW_ARCHIVE_KEY: ${{ secrets.RAW_ARCHIVE_KEY }}
|
||||
run: |
|
||||
f="$RUNNER_TEMP/raw-archive/raw.tgz.enc"
|
||||
if [ -n "$RAW_ARCHIVE_KEY" ] && [ -f "$f" ]; then
|
||||
openssl enc -d -aes-256-cbc -pbkdf2 -pass env:RAW_ARCHIVE_KEY -in "$f" | tar -xz -C data
|
||||
fi
|
||||
# extract -> transform -> load for every source, then the combined runs (collection/pipeline.yaml)
|
||||
- id: check
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
REDDIT_CLIENT_ID: ${{ secrets.REDDIT_CLIENT_ID }}
|
||||
REDDIT_CLIENT_SECRET: ${{ secrets.REDDIT_CLIENT_SECRET }}
|
||||
run: python -m collection update --report "$RUNNER_TEMP/report.md"
|
||||
- name: Rebuild the analysis and run tests
|
||||
if: steps.check.outputs.changed == 'true'
|
||||
run: |
|
||||
python -m collection rebuild
|
||||
npm test
|
||||
- name: Encrypt the raw store
|
||||
id: archive
|
||||
env:
|
||||
RAW_ARCHIVE_KEY: ${{ secrets.RAW_ARCHIVE_KEY }}
|
||||
run: |
|
||||
if [ -n "$RAW_ARCHIVE_KEY" ] && [ -d data/raw ]; then
|
||||
mkdir -p "$RUNNER_TEMP/raw-archive"
|
||||
tar -czf - -C data raw | openssl enc -aes-256-cbc -pbkdf2 -salt -pass env:RAW_ARCHIVE_KEY -out "$RUNNER_TEMP/raw-archive/raw.tgz.enc"
|
||||
echo "save=true" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
- name: Save it (a new copy only when a raw file changed)
|
||||
if: steps.archive.outputs.save == 'true'
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: ${{ runner.temp }}/raw-archive
|
||||
key: raw-archive-${{ hashFiles('data/manifest.json') }}
|
||||
# The PR is opened with ATLAS_BOT_TOKEN (a fine-grained token, see docs/REPO_SETTINGS.md) when it is set:
|
||||
# changes made with the built-in GITHUB_TOKEN do not start other workflows, so its merge would not
|
||||
# redeploy the site. Without the secret it falls back to GITHUB_TOKEN and the PR waits for a manual merge.
|
||||
- name: Open a pull request with the new data
|
||||
id: pr
|
||||
if: steps.check.outputs.changed == 'true'
|
||||
uses: peter-evans/create-pull-request@v6
|
||||
with:
|
||||
token: ${{ secrets.ATLAS_BOT_TOKEN || github.token }}
|
||||
branch: data/source-update
|
||||
delete-branch: true
|
||||
commit-message: "data: update from community sources"
|
||||
title: "New data from the community sources"
|
||||
body-path: ${{ runner.temp }}/report.md
|
||||
labels: data
|
||||
- name: Merge it automatically once CI passes
|
||||
if: steps.pr.outputs.pull-request-number != '' && env.HAS_BOT_TOKEN == 'true'
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.ATLAS_BOT_TOKEN }}
|
||||
run: gh pr merge "${{ steps.pr.outputs.pull-request-number }}" --auto --squash
|
||||
- name: Report a broken source link
|
||||
if: steps.check.outputs.failed != ''
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
title="Source check failed: ${{ steps.check.outputs.failed }}"
|
||||
if ! gh issue list --state open --search "$title in:title" --json number --jq '.[0].number' | grep -q .; then
|
||||
gh issue create --title "$title" --body-file "$RUNNER_TEMP/report.md"
|
||||
fi
|
||||
+243
@@ -0,0 +1,243 @@
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[codz]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py.cover
|
||||
*.lcov
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
# Pipfile.lock
|
||||
|
||||
# uv
|
||||
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
# uv.lock
|
||||
|
||||
# poetry
|
||||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||
# poetry.lock
|
||||
# poetry.toml
|
||||
|
||||
# pdm
|
||||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
||||
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
||||
# pdm.lock
|
||||
# pdm.toml
|
||||
.pdm-python
|
||||
.pdm-build/
|
||||
|
||||
# pixi
|
||||
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
||||
# pixi.lock
|
||||
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
||||
# in the .venv directory. It is recommended not to include this directory in version control.
|
||||
.pixi/*
|
||||
!.pixi/config.toml
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule*
|
||||
celerybeat.pid
|
||||
|
||||
# Redis
|
||||
*.rdb
|
||||
*.aof
|
||||
*.pid
|
||||
|
||||
# RabbitMQ
|
||||
mnesia/
|
||||
rabbitmq/
|
||||
rabbitmq-data/
|
||||
|
||||
# ActiveMQ
|
||||
activemq-data/
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.envrc
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs/Zensical documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
|
||||
# PyCharm
|
||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
# .idea/
|
||||
|
||||
# Abstra
|
||||
# Abstra is an AI-powered process automation framework.
|
||||
# Ignore directories containing user credentials, local state, and settings.
|
||||
# Learn more at https://abstra.io/docs
|
||||
.abstra/
|
||||
|
||||
# Visual Studio Code
|
||||
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore that
|
||||
# can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
||||
# and can be added to the global gitignore or merged into this file. However, if you prefer, you
|
||||
# could uncomment the following to ignore the entire vscode folder
|
||||
# .vscode/
|
||||
# Temporary file for partial code execution
|
||||
tempCodeRunnerFile.py
|
||||
|
||||
# Ruff stuff:
|
||||
.ruff_cache/
|
||||
|
||||
# PyPI configuration file
|
||||
.pypirc
|
||||
|
||||
# Marimo
|
||||
marimo/_static/
|
||||
marimo/_lsp/
|
||||
__marimo__/
|
||||
|
||||
# Streamlit
|
||||
.streamlit/secrets.toml
|
||||
|
||||
# --- Threshing Atlas ---
|
||||
node_modules/
|
||||
dist/
|
||||
tests/out/
|
||||
__pycache__/
|
||||
*.pyc
|
||||
.env
|
||||
.DS_Store
|
||||
# The raw store (collection/pipeline.yaml): current and previous raw files of every source. Never published: the
|
||||
# register has rider names, the bot's data has game prose and account ids, the PDF is not ours to redistribute.
|
||||
data/raw/
|
||||
# Third-party guide PDF: link to it, do not redistribute
|
||||
*.pdf
|
||||
|
||||
# QA screenshots
|
||||
undefined/
|
||||
# hand-off zips and local reports (python -m collection export-bot-kit / refresh)
|
||||
exports/
|
||||
inbox/
|
||||
|
||||
# PyCharm
|
||||
.idea/
|
||||
@@ -0,0 +1,21 @@
|
||||
# Data licence
|
||||
|
||||
The data this project produces (coded runs in `data/derived/`, the route graph, `policy.json`,
|
||||
`experiments.json`, and bot exports in `data/bot/`) are licensed under
|
||||
**Creative Commons Attribution 4.0 International (CC BY 4.0)**:
|
||||
https://creativecommons.org/licenses/by/4.0/
|
||||
|
||||
Credit: "Threshing Atlas contributors", with a link to this repository.
|
||||
|
||||
## Third-party sources
|
||||
|
||||
Some inputs belong to others. They keep their own terms, and CC BY 4.0 does not apply to them:
|
||||
|
||||
- `data/raw/form/` and `data/public/form_responses.json`: responses to the community
|
||||
"Threshing Routes" Google Form compiled by u/ClumsyBadger. Included unmodified so results can be
|
||||
reproduced. Credit the form and its respondents.
|
||||
- `data/public/register.json`: derived from the community "Unofficial Dragon Register". Rider names
|
||||
and photos are removed. The raw export is not committed.
|
||||
- The community route PDF is not redistributed. See `data/SOURCES.md` for where to find it.
|
||||
|
||||
Dragonkind and Fourth Wing belong to their respective owners. This is an unofficial fan project.
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 ekcSchiano
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,11 @@
|
||||
# analysis
|
||||
|
||||
Making sense of the data.
|
||||
|
||||
| Folder | What it does |
|
||||
|---|---|
|
||||
| `stats/measures.yaml` | **Declarative.** What the site measures: outcomes and their denominators, route targets and comparison groups, the bonding-encounter contexts, the route map's stages, the filter presets and the route thresholds. |
|
||||
| `stats/site_stats.py` | Computes every number the Atlas page shows for every preset and writes `data/public/stats.json`; the page computes nothing itself. |
|
||||
| `stats/stats_core.py` | The statistics themselves: rates with Wilson intervals, odds ratios with Fisher's test and Benjamini–Hochberg, Mantel–Haenszel, ridge logistic models that adjust for data source and chase goal. Tested against known answers (`tests/core/test_stats.py`). |
|
||||
| `network/` | `build-graph.js` combines every source into `data/public/graph.json` (the decision-variable graph and the bot's scene graph). CI fails if the committed graph is out of date. |
|
||||
| `reports/` | Generated reports. `POLICY.md` is written by `planner/policy_report.py`; do not edit it by hand. |
|
||||
@@ -0,0 +1,272 @@
|
||||
"""What the runs say about the Black dragon: analysis/reports/BLACK.md.
|
||||
|
||||
python analysis/black/evidence.py [--check]
|
||||
|
||||
Every number in the report is computed here from data/public/runs_clean.csv (and the bot's anonymised
|
||||
trajectories), so it can be re-run after every import. Nothing is fitted: these are counts. The developer's
|
||||
statements they are read against are in planner/knowledge.yaml.
|
||||
"""
|
||||
import argparse
|
||||
import collections
|
||||
import glob
|
||||
import json
|
||||
import math
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
sys.path.insert(0, str(ROOT / "core"))
|
||||
from atlas import runs as runs_io # noqa: E402
|
||||
|
||||
OUT = ROOT / "analysis/reports/BLACK.md"
|
||||
OUT_JSON = ROOT / "data/public/black.json" # the same numbers, for the page
|
||||
ROUTE = ["company", "direction", "combat_first", "combat_second", "resolution", "post_path"]
|
||||
ROUTE_NAMES = "company, first direction, first move in the fight, the dagger, the bullies' fate, the fork"
|
||||
|
||||
|
||||
def gated_tree(r):
|
||||
"""A run that passed both known gates (investigated, helped, climbed the tree) and says whether the shadow showed."""
|
||||
return r["scream"] == "Investigate & help" and r["hour"] == "Tree" and r["saw_shadow"] is not None
|
||||
|
||||
|
||||
def group(r):
|
||||
if r["source"] == "bot":
|
||||
return "bot"
|
||||
if r["source"] == "reddit spreadsheet":
|
||||
return "form" if r["entry"] == "Form" else "bulk logs"
|
||||
return "other"
|
||||
|
||||
|
||||
def tally(rows, key):
|
||||
d = collections.OrderedDict()
|
||||
for r in rows:
|
||||
c = d.setdefault(key(r), [0, 0])
|
||||
c[0] += bool(r["saw_shadow"])
|
||||
c[1] += 1
|
||||
return d
|
||||
|
||||
|
||||
def frac(y, n):
|
||||
return f"{y} / {n}" + (f" ({100 * y / n:.1f}%)" if n else "")
|
||||
|
||||
|
||||
def upper(n, conf=0.95):
|
||||
"""The rate that zero in n runs rules out (one-sided)."""
|
||||
return 1 - (1 - conf) ** (1 / n) if n else 1.0
|
||||
|
||||
|
||||
def mantel_haenszel(strata):
|
||||
"""strata: [(y1, n1, y0, n0)]. Odds ratio and z of group 1 against group 0, within strata."""
|
||||
num = den = obs = exp = var = 0.0
|
||||
for y1, n1, y0, n0 in strata:
|
||||
N = n1 + n0
|
||||
if not n1 or not n0:
|
||||
continue
|
||||
num += y1 * (n0 - y0) / N
|
||||
den += y0 * (n1 - y1) / N
|
||||
m = y1 + y0
|
||||
obs += y1
|
||||
exp += n1 * m / N
|
||||
if N > 1:
|
||||
var += n1 * n0 * m * (N - m) / (N * N * (N - 1))
|
||||
return (num / den if den else float("inf")), obs, exp, ((obs - exp) / math.sqrt(var) if var else 0.0)
|
||||
|
||||
|
||||
def last_answer(note):
|
||||
"""The answer given to the Black, from a rider's free-text note (keywords only; the note is never published).
|
||||
Riders lower their eyes to the Blue earlier in the same sequence, so only the last thing a note says counts, and
|
||||
only once the note has reached the Black (or is too short to be about anything else)."""
|
||||
t = re.sub(r"instead of low\w+[^.>,;]*", "", (note or "").lower())
|
||||
marks = [m.end() for m in re.finditer(r"threat|branch|south|black", t)]
|
||||
scope = t if len(t) < 45 else (t[marks[-1]:] if marks else "")
|
||||
found = [(m.start(), k) for k, pat in (("held its gaze", r"gaze|glare|eye contact"), ("lowered eyes", r"lower"),
|
||||
("ignored the sound", r"ignore"))
|
||||
for m in re.finditer(pat, scope)]
|
||||
if not found: # a long note that never names the Black's moment: use the whole note, gaze only
|
||||
return "held its gaze" if re.search(r"(hold|held|meet|met)\w* (its|it's|the black'?s?|his|her) (gaze|glare)", t) else None
|
||||
return max(found)[1]
|
||||
|
||||
|
||||
def blue_mistake(note):
|
||||
t = (note or "").lower()
|
||||
if "approach" in t:
|
||||
return "approached the Blue"
|
||||
if "warn" in t or "interven" in t:
|
||||
return "warned the other cadet / intervened"
|
||||
return None
|
||||
|
||||
|
||||
def build():
|
||||
"""(the report as Markdown, its key numbers as a dict for the page)."""
|
||||
runs = runs_io.read()
|
||||
G = [r for r in runs if gated_tree(r)]
|
||||
facts = {"schema": 1, "by_attempt": {}}
|
||||
L = ["# The Black dragon: what the runs show", "",
|
||||
"Written by `analysis/black/evidence.py` from `data/public/runs_clean.csv`. Counts only; nothing is fitted. "
|
||||
"\"Gated tree runs\" investigated the scream, helped the squadmate and climbed the tree, the two gates the "
|
||||
"developer has confirmed (`planner/knowledge.yaml`). Form submissions over-report the shadow, so their "
|
||||
"percentages are too high; comparisons inside the form (first attempt against later, one route against "
|
||||
"another) are still fair if the over-reporting is the same on both sides.", ""]
|
||||
|
||||
# 1. by attempt
|
||||
L += ["## 1. The shadow by attempt number", "", "| Attempt | Form submissions | Bulk logs | Bot |", "|---|---|---|---|"]
|
||||
bands = [("1", 1, 1), ("2", 2, 2), ("3", 3, 3), ("4-10", 4, 10), ("11-30", 11, 30), ("31 or more", 31, 10 ** 9)]
|
||||
for name, lo, hi in bands:
|
||||
cells = []
|
||||
for g in ("form", "bulk logs", "bot"):
|
||||
rs = [r for r in G if group(r) == g and r["attempt"] and lo <= r["attempt"] <= hi]
|
||||
cells.append(frac(sum(bool(r["saw_shadow"]) for r in rs), len(rs)))
|
||||
facts["by_attempt"].setdefault(g, {})[name] = [sum(bool(r["saw_shadow"]) for r in rs), len(rs)]
|
||||
L.append(f"| {name} | " + " | ".join(cells) + " |")
|
||||
cells = []
|
||||
for g in ("form", "bulk logs", "bot"):
|
||||
rs = [r for r in G if group(r) == g and not r["attempt"]]
|
||||
cells.append(frac(sum(bool(r["saw_shadow"]) for r in rs), len(rs)))
|
||||
L.append("| not given | " + " | ".join(cells) + " |")
|
||||
complete_first = [r for r in G if group(r) in ("bot", "bulk logs") and r["attempt"] == 1]
|
||||
complete_later = [r for r in G if group(r) in ("bot", "bulk logs") and r["attempt"] and r["attempt"] > 1]
|
||||
L += ["", f"Complete logs (bot and bulk) have {len(complete_first)} first attempts at the tree and "
|
||||
f"{len(complete_later)} later ones, with {sum(bool(r['saw_shadow']) for r in complete_first + complete_later)} shadows. "
|
||||
f"Zero in {len(complete_later)} later attempts rules out a rate above {100 * upper(len(complete_later)):.1f}% for them; "
|
||||
f"zero in {len(complete_first)} first attempts only rules out more than {100 * upper(len(complete_first)):.0f}%.", ""]
|
||||
|
||||
# 2. the same route, first against later
|
||||
F = [r for r in G if group(r) == "form" and r["attempt"]]
|
||||
by = collections.defaultdict(lambda: [0, 0, 0, 0])
|
||||
for r in F:
|
||||
c = by[tuple(r[k] for k in ROUTE)]
|
||||
i = 0 if r["attempt"] == 1 else 2
|
||||
c[i] += bool(r["saw_shadow"])
|
||||
c[i + 1] += 1
|
||||
orr, obs, exp, z = mantel_haenszel(by.values())
|
||||
facts["same_route"] = {"routes": len(by), "first_shadows": round(obs), "expected": round(exp, 1),
|
||||
"odds_ratio": round(orr, 1), "z": round(z, 1)}
|
||||
facts["form_first"] = [sum(c[0] for c in by.values()), sum(c[1] for c in by.values())]
|
||||
facts["form_later"] = [sum(c[2] for c in by.values()), sum(c[3] for c in by.values())]
|
||||
L += ["## 2. The same route on a first attempt and on a later one", "",
|
||||
f"If the shadow depended only on the choices the form records ({ROUTE_NAMES}), a route would do as well on a "
|
||||
"later attempt as on a first. It does not.", "",
|
||||
"| Route | First attempt | Later attempts |", "|---|---|---|"]
|
||||
top = sorted(by.items(), key=lambda kv: -(kv[1][1] + kv[1][3]))[:8]
|
||||
for key, (y1, n1, y0, n0) in top:
|
||||
L.append(f"| {' / '.join(key)} | {frac(y1, n1)} | {frac(y0, n0)} |")
|
||||
L += ["", f"Across all {len(by)} recorded routes, comparing first and later attempts on the same route: "
|
||||
f"{obs:.0f} first-attempt shadows where {exp:.1f} would be expected if the attempt did not matter "
|
||||
f"(odds ratio {orr:.1f}, z = {z:.1f}). First and later attempts choose almost the same routes, so the "
|
||||
"difference is not in the recorded choices: it is something about the account, or a choice the form does "
|
||||
"not record.", ""]
|
||||
|
||||
# 3. is it decided by route + cadet assignment?
|
||||
best_key, best = max(((k, v) for k, v in by.items() if v[1] >= 20), key=lambda kv: kv[1][0] / kv[1][1])
|
||||
facts["best_route"] = {"route": list(best_key), "first": [best[0], best[1]], "later": [best[2], best[3]]}
|
||||
B = [r for r in F if r["attempt"] == 1 and tuple(r[k] for k in ROUTE) == best_key]
|
||||
cells = tally(B, lambda r: (r["wing"], r["section"], r["squad"]))
|
||||
multi = {k: v for k, v in cells.items() if v[1] >= 2}
|
||||
mixed = sum(1 for y, n in multi.values() if 0 < y < n)
|
||||
L += ["## 3. On one route, is the shadow decided by the cadet's wing, section and squad?", "",
|
||||
f"The developer says the Black is decided by choices and by what the site knows about the account, with no "
|
||||
f"dice. If the recorded route and the cadet assignment were all of it, every first attempt with the same "
|
||||
f"route and assignment would agree. On the best-recorded route ({' / '.join(best_key)}; {frac(best[0], best[1])} "
|
||||
f"on first attempts), {len(multi)} assignments have two or more runs and {mixed} of them disagree (some runs "
|
||||
"with the shadow, some without). So something else decides it: a choice the form does not record, or a fact "
|
||||
"about the account other than its assignment. No wing, section or squad stands out:", "",
|
||||
"| | " + " | ".join(["shadow / runs"]) + " |", "|---|---|"]
|
||||
for col in ("wing", "section", "squad", "first_sighting", "sighting_action"):
|
||||
t = tally(B, lambda r, col=col: r[col] or "(blank)")
|
||||
L.append(f"| {col} | " + ", ".join(f"{k}: {y}/{n}" for k, (y, n) in sorted(t.items(), key=lambda kv: -kv[1][1]) if n >= 3) + " |")
|
||||
L.append("")
|
||||
|
||||
# 4. no single route
|
||||
S1 = [r for r in G if group(r) == "form" and r["saw_shadow"]]
|
||||
L += ["## 4. There is no single route", "",
|
||||
f"The {len(S1)} form runs with a shadow (all attempts) took {len({tuple(r[k] for k in ROUTE) for r in S1})} "
|
||||
"different recorded routes:", ""]
|
||||
for col, label in (("company", "Company"), ("direction", "First direction"), ("combat_first", "First move in the fight"),
|
||||
("combat_second", "The dagger"), ("resolution", "The bullies' fate"), ("post_path", "The fork")):
|
||||
t = collections.Counter(r[col] for r in S1)
|
||||
L.append(f"- **{label}:** " + ", ".join(f"{k} {v}" for k, v in t.most_common()))
|
||||
outside = [r for r in runs if r["saw_shadow"] and not (r["scream"] == "Investigate & help" and r["hour"] == "Tree")]
|
||||
facts["shadow_routes"] = {"runs": len(S1), "routes": len({tuple(r[k] for k in ROUTE) for r in S1}), "off_gate": len(outside)}
|
||||
L += ["", f"Shadows reported without both gates: {len(outside)} (likely mis-entered).", ""]
|
||||
|
||||
# 5. after the shadow
|
||||
SH = [r for r in runs if r["saw_shadow"]]
|
||||
black = [r for r in SH if r["enc_Black"]]
|
||||
ans = collections.defaultdict(lambda: [0, 0])
|
||||
for r in black:
|
||||
a = last_answer((r["bond_note"] or "") + " " + (r["death_note"] or ""))
|
||||
if a:
|
||||
ans[a][0] += r["outcome"] == "Bonded"
|
||||
ans[a][1] += 1
|
||||
blue_dead = [r for r in SH if r["enc_Blue"] == "Incinerated"]
|
||||
facts["after_shadow"] = {"reached_black": len(black), "bonded_black": sum(r["outcome"] == "Bonded" for r in black),
|
||||
"died_at_blue": len(blue_dead),
|
||||
"answers": {k: [y, n] for k, (y, n) in sorted(ans.items(), key=lambda kv: -kv[1][1])}}
|
||||
mis = collections.Counter(blue_mistake((r["bond_note"] or "") + " " + (r["death_note"] or "")) for r in blue_dead)
|
||||
L += ["## 5. After the shadow: the Blue, then the Black", "",
|
||||
"The riders' notes describe one sequence: follow the shadow, a Blue lands and burns another cadet, the Blue "
|
||||
"leaves, then the Black appears. The Blue is a trial on the way, not an alternative to the Black.", "",
|
||||
f"- Runs that reached the Black: {len(black)}, bonded {sum(r['outcome'] == 'Bonded' for r in black)}.",
|
||||
f"- Runs that died at the Blue: {len(blue_dead)}. What their notes say they did: "
|
||||
+ ", ".join(f"{k} {v}" for k, v in mis.most_common() if k) + ".",
|
||||
"- The answer given to the Black, where the note says (bonded / runs): "
|
||||
+ "; ".join(f"{k} {y}/{n}" for k, (y, n) in sorted(ans.items(), key=lambda kv: -kv[1][1])) + ".", "",
|
||||
"Holding its gaze is the only answer recorded with a bond, and it still fails about a quarter of the time. "
|
||||
"The developer says a rider who knows the system bonds with certainty, so those failures are not explained "
|
||||
"yet: the notes of the riders who died are too short to show what else they did differently.", ""]
|
||||
|
||||
# 6. what the bot has tried
|
||||
L += ["## 6. What the bot has tried", ""]
|
||||
files = sorted(f for f in glob.glob(str(ROOT / "data/bot/trajectories-*.jsonl")) if "sample" not in f)
|
||||
seen, acc, order = set(), collections.defaultdict(list), collections.defaultdict(list)
|
||||
for f in files:
|
||||
for line in open(f, encoding="utf-8"):
|
||||
t = json.loads(line)
|
||||
if t["id"] not in seen:
|
||||
seen.add(t["id"])
|
||||
acc[t["meta"].get("accountKey")].append(t["meta"].get("attempt") or 0)
|
||||
order[t["meta"].get("accountKey")].append((t["meta"].get("attempt") or 0, t["id"]))
|
||||
by_id = {r["run_id"]: r for r in runs_io.read(sources=["bot"], drop=())}
|
||||
streak = 0 # the longest run of consecutive attempts on one account with the same gated tree route
|
||||
for v in order.values():
|
||||
cur, prev = 0, None
|
||||
for _, i in sorted(v):
|
||||
r = by_id.get(i)
|
||||
s = tuple(r[k] for k in ROUTE + ["sighting_action"]) if r and gated_tree(r) else None
|
||||
cur = cur + 1 if s is not None and s == prev else (1 if s is not None else 0)
|
||||
prev, streak = s, max(streak, cur)
|
||||
botg = [r for r in G if group(r) == "bot"]
|
||||
facts["bot"] = {"attempts": len(seen), "accounts": len(acc), "gated_tree": len(botg),
|
||||
"shadows": sum(bool(r["saw_shadow"]) for r in botg),
|
||||
"earliest_attempt": min((min(v) for v in acc.values() if v), default=0)}
|
||||
routes = collections.Counter(tuple(r[k] for k in ROUTE) for r in botg)
|
||||
L += [f"{len(seen)} attempts on {len(acc)} accounts; the earliest attempt logged on any account is number "
|
||||
f"{min((min(v) for v in acc.values() if v), default=0)}. Gated tree runs: {len(botg)}, shadows "
|
||||
f"{sum(bool(r['saw_shadow']) for r in botg)}, on {len(routes)} recorded routes "
|
||||
f"(the commonest {routes.most_common(1)[0][1] if routes else 0} times). The bot has not played a first attempt, "
|
||||
"so it has not yet tested the one situation where riders report the shadow. The most times any account has "
|
||||
f"repeated one route in a row is {streak}.", ""]
|
||||
return "\n".join(L) + "\n", facts
|
||||
|
||||
|
||||
def main(argv=None):
|
||||
ap = argparse.ArgumentParser(description=__doc__)
|
||||
ap.add_argument("--check", action="store_true")
|
||||
a = ap.parse_args(argv)
|
||||
text, facts = build()
|
||||
data = json.dumps(facts, ensure_ascii=False, indent=1) + "\n"
|
||||
if a.check:
|
||||
for path, want in ((OUT, text), (OUT_JSON, data)):
|
||||
if not path.exists() or path.read_text(encoding="utf-8") != want:
|
||||
print(f"{path} is out of date (run python analysis/black/evidence.py)", file=sys.stderr)
|
||||
return 1
|
||||
return 0
|
||||
OUT.write_text(text, encoding="utf-8")
|
||||
OUT_JSON.write_text(data, encoding="utf-8")
|
||||
print(f"wrote {OUT.relative_to(ROOT)} and {OUT_JSON.relative_to(ROOT)}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,46 @@
|
||||
// Build data/public/graph.json from every run in data/public/runs_clean.csv (every source), plus the bot's scene graph.
|
||||
// node analysis/network/build-graph.js
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const G = require("../../core/graph.js");
|
||||
const root = path.resolve(__dirname, "../..");
|
||||
const rel = (p) => path.join(root, p);
|
||||
|
||||
/** The coded runs of every source, written by `python -m collection build`. */
|
||||
function readCSV(file) {
|
||||
const text = fs.readFileSync(file, "utf8"), rows = [];
|
||||
let row = [], cell = "", q = false;
|
||||
for (let i = 0; i < text.length; i++) {
|
||||
const ch = text[i];
|
||||
if (q) {
|
||||
if (ch === '"' && text[i + 1] === '"') { cell += '"'; i++; }
|
||||
else if (ch === '"') q = false;
|
||||
else cell += ch;
|
||||
} else if (ch === '"') q = true;
|
||||
else if (ch === ",") { row.push(cell); cell = ""; }
|
||||
else if (ch === "\n") { row.push(cell); rows.push(row); row = []; cell = ""; }
|
||||
else if (ch !== "\r") cell += ch;
|
||||
}
|
||||
if (cell || row.length) { row.push(cell); rows.push(row); }
|
||||
const [head, ...body] = rows;
|
||||
return body.map((r) => Object.fromEntries(head.map((h, i) => [h, r[i] === "" || r[i] === undefined ? null : r[i]])));
|
||||
}
|
||||
const runs = readCSV(rel("data/public/runs_clean.csv"));
|
||||
// spreadsheet runs keep the split between form submissions and bulk logs
|
||||
const sourceKey = (r) => (r.source === "reddit spreadsheet" ? (r.entry === "Form" ? "form" : "form-bulk") : r.source);
|
||||
const records = runs.map((r) => ({ source: sourceKey(r), vars: G.formRunVariables(r) }));
|
||||
|
||||
const botDir = rel("data/bot");
|
||||
const scenes = fs.existsSync(path.join(botDir, "scenes.json")) ? JSON.parse(fs.readFileSync(path.join(botDir, "scenes.json"), "utf8")) : {};
|
||||
const trajs = [];
|
||||
for (const f of fs.readdirSync(botDir).filter((f) => /^trajectories-.*\.jsonl$/.test(f)).sort()) {
|
||||
for (const line of fs.readFileSync(path.join(botDir, f), "utf8").split("\n")) if (line.trim()) trajs.push(JSON.parse(line));
|
||||
}
|
||||
|
||||
const graph = {
|
||||
sources: records.reduce((m, r) => ((m[r.source] = (m[r.source] || 0) + 1), m), {}),
|
||||
variables: G.buildVariableGraph(records),
|
||||
scenes: G.buildSceneGraph(scenes, trajs)
|
||||
};
|
||||
fs.writeFileSync(rel("data/public/graph.json"), JSON.stringify(graph));
|
||||
console.log(`graph.json: ${JSON.stringify(graph.sources)}, ${Object.keys(graph.variables.nodes).length} variable nodes, ${Object.keys(graph.scenes).length} scenes`);
|
||||
@@ -0,0 +1,74 @@
|
||||
# The Black dragon: what the runs show
|
||||
|
||||
Written by `analysis/black/evidence.py` from `data/public/runs_clean.csv`. Counts only; nothing is fitted. "Gated tree runs" investigated the scream, helped the squadmate and climbed the tree, the two gates the developer has confirmed (`planner/knowledge.yaml`). Form submissions over-report the shadow, so their percentages are too high; comparisons inside the form (first attempt against later, one route against another) are still fair if the over-reporting is the same on both sides.
|
||||
|
||||
## 1. The shadow by attempt number
|
||||
|
||||
| Attempt | Form submissions | Bulk logs | Bot |
|
||||
|---|---|---|---|
|
||||
| 1 | 90 / 892 (10.1%) | 0 / 28 (0.0%) | 0 / 0 |
|
||||
| 2 | 0 / 290 (0.0%) | 0 / 21 (0.0%) | 0 / 4 (0.0%) |
|
||||
| 3 | 0 / 187 (0.0%) | 0 / 14 (0.0%) | 0 / 5 (0.0%) |
|
||||
| 4-10 | 0 / 510 (0.0%) | 0 / 102 (0.0%) | 0 / 36 (0.0%) |
|
||||
| 11-30 | 0 / 574 (0.0%) | 0 / 57 (0.0%) | 0 / 137 (0.0%) |
|
||||
| 31 or more | 1 / 621 (0.2%) | 0 / 0 | 0 / 54 (0.0%) |
|
||||
| not given | 3 / 1522 (0.2%) | 0 / 112 (0.0%) | 0 / 0 |
|
||||
|
||||
Complete logs (bot and bulk) have 28 first attempts at the tree and 430 later ones, with 0 shadows. Zero in 430 later attempts rules out a rate above 0.7% for them; zero in 28 first attempts only rules out more than 10%.
|
||||
|
||||
## 2. The same route on a first attempt and on a later one
|
||||
|
||||
If the shadow depended only on the choices the form records (company, first direction, first move in the fight, the dagger, the bullies' fate, the fork), a route would do as well on a later attempt as on a first. It does not.
|
||||
|
||||
| Route | First attempt | Later attempts |
|
||||
|---|---|---|
|
||||
| Alone / West / Assess the situation / Engage the smaller cadet / Squadmate's revenge / West | 22 / 92 (23.9%) | 0 / 90 (0.0%) |
|
||||
| Alone / West / Assess the situation / Engage the smaller cadet / Squadmate's revenge / Forest | 5 / 29 (17.2%) | 0 / 93 (0.0%) |
|
||||
| Alone / Center / Assess the situation / Engage the smaller cadet / Squadmate's revenge / Forest | 4 / 28 (14.3%) | 0 / 76 (0.0%) |
|
||||
| 1 Squadmate / East / Assess the situation / Engage the smaller cadet / Squadmate's revenge / East | 2 / 32 (6.2%) | 0 / 64 (0.0%) |
|
||||
| Alone / Center / Assess the situation / Daggers or not (protect squadmate) / Left bullies to the dragons / Forest | 1 / 28 (3.6%) | 0 / 64 (0.0%) |
|
||||
| Alone / Center / Assess the situation / Engage the smaller cadet / Squadmate's revenge / West | 1 / 8 (12.5%) | 1 / 82 (1.2%) |
|
||||
| 2 Squadmates / East / Assess the situation / Engage the smaller cadet / Squadmate's revenge / East | 2 / 43 (4.7%) | 0 / 45 (0.0%) |
|
||||
| Alone / East / Assess the situation / Engage the smaller cadet / Squadmate's revenge / East | 1 / 33 (3.0%) | 0 / 53 (0.0%) |
|
||||
|
||||
Across all 325 recorded routes, comparing first and later attempts on the same route: 86 first-attempt shadows where 36.5 would be expected if the attempt did not matter (odds ratio 637.7, z = 12.0). First and later attempts choose almost the same routes, so the difference is not in the recorded choices: it is something about the account, or a choice the form does not record.
|
||||
|
||||
## 3. On one route, is the shadow decided by the cadet's wing, section and squad?
|
||||
|
||||
The developer says the Black is decided by choices and by what the site knows about the account, with no dice. If the recorded route and the cadet assignment were all of it, every first attempt with the same route and assignment would agree. On the best-recorded route (Alone / West / Assess the situation / Engage the smaller cadet / Squadmate's revenge / West; 22 / 92 (23.9%) on first attempts), 25 assignments have two or more runs and 11 of them disagree (some runs with the shadow, some without). So something else decides it: a choice the form does not record, or a fact about the account other than its assignment. No wing, section or squad stands out:
|
||||
|
||||
| | shadow / runs |
|
||||
|---|---|
|
||||
| wing | Fourth: 5/28, Third: 7/27, First: 6/21, Second: 3/13 |
|
||||
| section | Claw: 9/31, Flame: 5/30, Tail: 7/28, (blank): 1/3 |
|
||||
| squad | Second: 11/34, First: 6/29, Third: 4/27 |
|
||||
| first_sighting | Brown: 11/48, Green: 9/42 |
|
||||
| sighting_action | Hold still: 10/50, Respect / face it: 4/21, Unknown: 8/14, Weapon: 0/5 |
|
||||
|
||||
## 4. There is no single route
|
||||
|
||||
The 94 form runs with a shadow (all attempts) took 45 different recorded routes:
|
||||
|
||||
- **Company:** Alone 70, 1 Squadmate 12, 2 Squadmates 12
|
||||
- **First direction:** West 59, Center 20, East 15
|
||||
- **First move in the fight:** Assess the situation 83, (not recorded) 9, Even the numbers (smaller cadet) 2
|
||||
- **The dagger:** Engage the smaller cadet 61, (not recorded) 22, Daggers or not (protect squadmate) 11
|
||||
- **The bullies' fate:** Squadmate's revenge 59, Left bullies to the dragons 24, Killed the bullies yourself 9, Unknown 2
|
||||
- **The fork:** West 45, Forest 36, East 12, Unknown 1
|
||||
|
||||
Shadows reported without both gates: 3 (likely mis-entered).
|
||||
|
||||
## 5. After the shadow: the Blue, then the Black
|
||||
|
||||
The riders' notes describe one sequence: follow the shadow, a Blue lands and burns another cadet, the Blue leaves, then the Black appears. The Blue is a trial on the way, not an alternative to the Black.
|
||||
|
||||
- Runs that reached the Black: 77, bonded 55.
|
||||
- Runs that died at the Blue: 15. What their notes say they did: approached the Blue 10, warned the other cadet / intervened 4.
|
||||
- The answer given to the Black, where the note says (bonded / runs): held its gaze 30/42; lowered eyes 0/7; ignored the sound 0/1.
|
||||
|
||||
Holding its gaze is the only answer recorded with a bond, and it still fails about a quarter of the time. The developer says a rider who knows the system bonds with certainty, so those failures are not explained yet: the notes of the riders who died are too short to show what else they did differently.
|
||||
|
||||
## 6. What the bot has tried
|
||||
|
||||
415 attempts on 14 accounts; the earliest attempt logged on any account is number 2. Gated tree runs: 236, shadows 0, on 6 recorded routes (the commonest 70 times). The bot has not played a first attempt, so it has not yet tested the one situation where riders report the shadow. The most times any account has repeated one route in a row is 11.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,122 @@
|
||||
# The screen tree
|
||||
|
||||
Written by `analysis/tree/build_tree.py` from the bot's logs: 421 runs, 5576 played steps (91 picks the bot logged and then overrode are left out). Machine-readable: `data/public/tree.json`.
|
||||
|
||||
## Coverage
|
||||
|
||||
- Screens seen: 45. Options on them: 116, of which 69 have been played and 47 never have.
|
||||
- Played options that are dice (led to more than one place): 11. Always the same place so far: 58, of which 21 have been played often enough (59 times or more) that a hidden 1-in-20 branch would very likely have shown.
|
||||
- Endings reached: BONDED:Blue, BONDED:Green, DIED.
|
||||
|
||||
A screen only appears here once the bot has stood on it, so screens behind untested options are missing altogether: the tree is a floor on the size of the game, not its size.
|
||||
|
||||
## The dice
|
||||
|
||||
Every option that has led to more than one place, most played first (90% range).
|
||||
|
||||
| Screen | Option | Played | Led to |
|
||||
|---|---|---|---|
|
||||
| Valley edge: choose direction | Head toward the center of the forest | 165 | First sighting: Red (forest centre) 55.1% (48.8%-61.4%); First sighting: Brown (forest centre) 44.9% (38.6%-51.2%) |
|
||||
| Valley edge: choose direction | Head west toward the scent | 143 | First sighting: Brown (forest centre) 51.0% (44.2%-57.8%); ENTER_THRESHING · green 48.9% (42.2%-55.8%) |
|
||||
| FORK_IN_FOREST · red #01c3 | There’s no way this is your dragon and you need to get out o | 140 | FORK_IN_FOREST #0905 88.6% (83.4%-92.3%); FORK_IN_FOREST #900d 11.4% (7.7%-16.6%) |
|
||||
| MEADOW_ENCOUNTER · orange #5b27 | On second thought, a nice brown sounds great | 124 | MEADOW_ENCOUNTER · orange #4f4a 54.0% (46.7%-61.2%); DIED 46.0% (38.8%-53.3%) |
|
||||
| ENTER_THRESHING #bbc8 | Head toward the center of the forest | 85 | First sighting: Brown (forest centre) 60.0% (51.1%-68.3%); First sighting: Red (forest centre) 40.0% (31.7%-48.9%) |
|
||||
| MEADOW_ENCOUNTER · brown #792f | Immediately throw your body weight onto the tail and hold on | 35 | MEADOW_ENCOUNTER · brown #3f5d 88.6% (76.8%-94.8%); DIED 11.4% (5.2%-23.2%) |
|
||||
| TARGET_BONDING · blue #848f | Absolutely. My whole life hinges on this moment | 16 | TARGET_BONDING · blue #4118 81.2% (61.2%-92.2%); DIED 18.8% (7.8%-38.8%) |
|
||||
| Valley edge: choose direction | Head east toward the roar | 14 | ENTER_THRESHING · orange 92.9% (73.4%-98.4%); First sighting: Red (forest centre) 7.1% (1.6%-26.6%) |
|
||||
| TARGET_BONDING · blue #4118 | Hold the blue’s glare and advance | 13 | TARGET_BONDING · blue #afc4 76.9% (54.2%-90.4%); DIED 23.1% (9.6%-45.8%) |
|
||||
| TARGET_BONDING · blue #afc4 | Do nothing | 10 | TARGET_BONDING · blue #ea99 60.0% (35.2%-80.6%); DIED 40.0% (19.4%-64.8%) |
|
||||
| TARGET_BONDING · blue #ea99 | Hold the dragon’s glare and watch as it crushes the cadet to | 6 | TARGET_BONDING · blue #5dda 50.0% (22.1%-77.9%); DIED 50.0% (22.1%-77.9%) |
|
||||
|
||||
## Best known chance of each colour
|
||||
|
||||
From the first screen, taking the best tested option on every screen. Untested options count as zero, so these are what is known to be achievable, not limits; a colour the bot has never bonded shows 0. "As observed" multiplies the rates seen. "Cautious" adds one unseen failure to every step, which is what the picks are chosen on: a chain of steps each played once is worth little.
|
||||
|
||||
| Colour | As observed | Cautious | Weakest step on the way | These picks end in |
|
||||
|---|---|---|---|---|
|
||||
| Red | 0.0% | 0.0% | no bond logged | |
|
||||
| Orange | 0.0% | 0.0% | no bond logged | |
|
||||
| Brown | 0.0% | 0.0% | no bond logged | |
|
||||
| Green | 100.0% | 3.2% | Let the Red pass: two Greens in the clearing: "Lower your eyes and turn your body toward the left", played 1 times | BONDED:Green 100.0% |
|
||||
| Blue | 2.1% | 0.4% | TARGET_BONDING · blue #5dda: "Straighten your spine and wait for it to speak", played 3 times | DIED 97.9%, BONDED:Blue 2.1% |
|
||||
| Black | 0.0% | 0.0% | no bond logged | |
|
||||
|
||||
### The picks for Blue
|
||||
|
||||
| Screen | Pick | Played | Chance of the bond from here |
|
||||
|---|---|---|---|
|
||||
| Start: choose company | Enter the valley alone | 321 | 2.1% |
|
||||
| Valley edge: choose direction | Head toward the center of the forest | 165 | 2.1% |
|
||||
| First sighting: Red (forest centre) | Lower your eyes in respect | 126 | 2.1% |
|
||||
| Survived the first sighting | Head deeper into the forest | 407 | 2.1% |
|
||||
| Deeper in the forest: a scream | Investigate the scream | 380 | 2.1% |
|
||||
| Clearing: squadmate vs two bullies | Help your squadmate | 368 | 2.1% |
|
||||
| Bully fight: first move | Pause to assess the situation even though it may risk your squadmate’s | 368 | 2.1% |
|
||||
| Bully fight: smaller cadet has a dagger | Engage the smaller cadet | 293 | 2.1% |
|
||||
| Beat the smaller cadet: bullies’ fate | End the lives of the bullies yourself | 190 | 2.1% |
|
||||
| After the fight: choose a direction | Walk farther into the forest | 227 | 2.1% |
|
||||
| An hour later: valley or tree | Continue toward the center of the valley | 142 | 2.1% |
|
||||
| FORK_IN_FOREST · red #01c3 | There’s no way this is your dragon and you need to get out of here | 140 | 2.1% |
|
||||
| FORK_IN_FOREST #900d | Approach the blue dragon | 16 | 18.7% |
|
||||
| TARGET_BONDING · blue #848f | Absolutely. My whole life hinges on this moment | 16 | 18.7% |
|
||||
| TARGET_BONDING · blue #4118 | Hold the blue’s glare and advance | 13 | 23.1% |
|
||||
| TARGET_BONDING · blue #afc4 | Do nothing | 10 | 30.0% |
|
||||
| TARGET_BONDING · blue #ea99 | Hold the dragon’s glare and watch as it crushes the cadet to death | 6 | 50.0% |
|
||||
| TARGET_BONDING · blue #5dda | Straighten your spine and wait for it to speak | 3 | 100.0% |
|
||||
| TARGET_BONDING · blue #959e | Launch yourself to the right, taking cover behind a boulder | 3 | 100.0% |
|
||||
| TARGET_BONDING · blue #f8b8 | I want to bring down an empire | 3 | 100.0% |
|
||||
| TARGET_BONDING · blue #b98a | Move forward slowly, waiting for an invitation | 3 | 100.0% |
|
||||
|
||||
## Untested options
|
||||
|
||||
On the screens the bot reaches most often first: the cheapest gaps to fill.
|
||||
|
||||
| Screen | Times on this screen | Option never played |
|
||||
|---|---|---|
|
||||
| Bully fight: first move | 368 | Charge the other cadet to even out the numbers |
|
||||
| Bully fight: first move | 368 | Unsheathe your weapon and charge between the bigger cadet and your squadmate |
|
||||
| Descended slowly: two Greens in the clearing | 261 | Lower your eyes and turn your body toward the right |
|
||||
| Descended slowly: two Greens in the clearing | 261 | Lower your eyes and turn your body toward the left |
|
||||
| First sighting: Brown (forest centre) | 198 | Run and hope it didn’t see you |
|
||||
| First sighting: Red (forest centre) | 126 | Hide behind a tree |
|
||||
| First sighting: Red (forest centre) | 126 | Show your bravery by meeting its gaze |
|
||||
| MEADOW_ENCOUNTER · orange #5b27 | 124 | Absolutely. I have a feeling this is my dragon |
|
||||
| ENTER_THRESHING #bbc8 | 85 | Head west toward the scent |
|
||||
| ENTER_THRESHING #bbc8 | 85 | Head east toward the roar |
|
||||
| ENTER_THRESHING · green | 70 | Approach from the left |
|
||||
| ENTER_THRESHING · green | 70 | Stare at the ground and drop the weapon |
|
||||
| ENTER_THRESHING #ab2d | 48 | Convince them to head west instead |
|
||||
| ENTER_THRESHING #ab2d | 48 | Go east with your squad |
|
||||
| ENTER_THRESHING #5455 | 37 | Go west with your squadmate |
|
||||
| ENTER_THRESHING #5455 | 37 | Convince them to head east instead |
|
||||
| MEADOW_ENCOUNTER · brown #3f5d | 31 | You point out that it’s already talking to you, so clearly you’re on the right track |
|
||||
| MEADOW_ENCOUNTER · brown #3f5d | 31 | You’ll convince it with charm |
|
||||
| SCREAM_AND_CADETS | 27 | Take the cadet’s weapons and continue along your way. Good steel shouldn’t go to waste |
|
||||
| SCREAM_AND_CADETS | 27 | Keep going. Clearly they’ve been found lacking and weak riders threaten the wing |
|
||||
| FORK_IN_FOREST #900d | 16 | Approach the orange dragon |
|
||||
| FORK_IN_FOREST #900d | 16 | Approach the brown dragon |
|
||||
| TARGET_BONDING · blue #848f | 16 | Nope. I’d rather live bonded to a brown than die pursuing a blue |
|
||||
| TARGET_BONDING · blue #848f | 16 | No. I have better odds with the orange |
|
||||
| ENTER_THRESHING · orange | 13 | Approach with confidence |
|
||||
| ENTER_THRESHING · orange | 13 | Duck behind a boulder |
|
||||
| TARGET_BONDING · blue #4118 | 13 | Halt your approach and lower your eyes |
|
||||
| TARGET_BONDING · blue #4118 | 13 | Keep moving forward with your eyes lowered |
|
||||
| TARGET_BONDING · blue #afc4 | 10 | Intervene and help |
|
||||
| TARGET_BONDING · blue #ea99 | 6 | Lower your eyes for the cadet’s dignity |
|
||||
| TARGET_BONDING · blue #ea99 | 6 | Show your honor by helping the cadet |
|
||||
| TARGET_BONDING · blue #f8b8 | 3 | I seek revenge |
|
||||
| TARGET_BONDING · blue #f8b8 | 3 | You already know |
|
||||
| TARGET_BONDING · blue #f8b8 | 3 | I want to defend the helpless |
|
||||
| TARGET_BONDING · blue #b98a | 3 | Stand strong, waiting for an invitation |
|
||||
| TARGET_BONDING · blue #b98a | 3 | Seize the opportunity to mount |
|
||||
| TARGET_BONDING · blue #959e | 3 | Hold steady, fear will get you killed |
|
||||
| TARGET_BONDING · blue #5dda | 3 | Speak first, claiming the dragon as yours |
|
||||
| TARGET_BONDING · blue #5dda | 3 | Do nothing. It’s worked so far |
|
||||
| Let the Red pass: two Greens in the clearing | 2 | Lower your eyes and turn your body toward the right |
|
||||
| FORK_IN_FOREST · red #f0fc | 1 | Continue your approach. You’re certain this is your path |
|
||||
| FORK_IN_FOREST · green #f0fb | 1 | Take a single step back. Getting speared won’t get you bonded |
|
||||
| FORK_IN_FOREST · green #b7e1 | 1 | Your lack of flaws is a flaw itself |
|
||||
| FORK_IN_FOREST · green #b7e1 | 1 | Your struggle with your temper |
|
||||
| FORK_IN_FOREST · green #b7e1 | 1 | You’re pretty certain you’re always right… even when you’re wrong |
|
||||
| FORK_IN_FOREST · green #9dc9 | 1 | Glance over at the dragon on the right, keeping situational awareness |
|
||||
| FORK_IN_FOREST · brown #78af | 1 | You’re sure. The heart doesn’t lie, and it’s set on that brown |
|
||||
@@ -6,12 +6,10 @@
|
||||
# (not blank), {any: [condition, ...]} (at least one). Several fields in one condition must all hold.
|
||||
version: 1
|
||||
|
||||
# Which runs of data/public/runs_clean.csv the statistics use (its `source` column): every source that records the
|
||||
# route (the community form, "Report a run", the Reddit megathread comments, the DragonKind bot). The Reddit result
|
||||
# pages and the register record only the end, so they stay out. The bot plays to a strategy and burns on purpose at
|
||||
# encounters it is not chasing: like every rider's deliberate death (`_deliberate`, the route model's rule), those
|
||||
# burns are left out of the bond rates, never counted as failed bonds.
|
||||
sources: [reddit spreadsheet, reported, reddit comment, bot]
|
||||
# Which runs of data/public/runs_clean.csv the statistics use (its `source` column). Runs from the other sources
|
||||
# (reported, bot, Reddit result pages) are in the published file but not in these statistics yet: they are coded
|
||||
# from different questions, and the bot follows a strategy, so pooling them needs its own review.
|
||||
sources: [reddit spreadsheet]
|
||||
|
||||
colours: [Red, Green, Orange, Brown, Blue, Black]
|
||||
|
||||
@@ -27,7 +25,7 @@ outcomes:
|
||||
event: { saw_shadow: true }
|
||||
bond_blue_meadow:
|
||||
label: Bond, given you approached the meadow Blue
|
||||
denom: { branch: "Passed the Red: meadow", enc_Blue: { in: ["Bonded!", "Incinerated"] }, _deliberate: { not: true } }
|
||||
denom: { branch: "Passed the Red: meadow", enc_Blue: { in: ["Bonded!", "Incinerated"] } }
|
||||
event: { enc_Blue: "Bonded!" }
|
||||
reach_hour:
|
||||
label: Survive to the hour (tree/valley choice)
|
||||
@@ -36,7 +34,7 @@ outcomes:
|
||||
# one more outcome per colour: "Run ends bonded to <colour>", among runs that reached the hour
|
||||
bonded_outcome:
|
||||
label: Run ends bonded to {colour}
|
||||
denom: { hour: { in: [Tree, Valley] }, _deliberate: { not: true } }
|
||||
denom: { hour: { in: [Tree, Valley] } }
|
||||
event: { outcome: Bonded, outcome_color: "{colour}" }
|
||||
|
||||
# Factors compared in the factor tables (each answer against the other answers to the same question)
|
||||
@@ -45,15 +43,15 @@ factors: [company, direction, first_sighting, scream, resolution, combat_first,
|
||||
|
||||
# Route targets: the outcome (event) and which runs could have reached it at all (pool)
|
||||
targets:
|
||||
bond_Blue: { label: Bond Blue, colour: Blue, event: { outcome: Bonded, outcome_color: Blue }, pool: { hour: Valley, _deliberate: { not: true } } }
|
||||
bond_Black: { label: Bond Black, colour: Black, event: { outcome: Bonded, outcome_color: Black }, pool: { hour: Tree, _deliberate: { not: true } } }
|
||||
bond_Blue: { label: Bond Blue, colour: Blue, event: { outcome: Bonded, outcome_color: Blue }, pool: { hour: Valley } }
|
||||
bond_Black: { label: Bond Black, colour: Black, event: { outcome: Bonded, outcome_color: Black }, pool: { hour: Tree } }
|
||||
see_Blue: { label: Meet a Blue (meadow), colour: Blue, event: { saw_blue_meadow: true }, pool: { branch: "Passed the Red: meadow" } }
|
||||
see_shadow: { label: Get the tree shadow, colour: Black, event: { saw_shadow: true }, pool: { hour: Tree, branch: { exists: true } } }
|
||||
bond_Red: { label: Bond Red, colour: Red, event: { outcome: Bonded, outcome_color: Red }, pool: { hour: { in: [Tree, Valley] }, _deliberate: { not: true } } }
|
||||
bond_Green: { label: Bond Green, colour: Green, event: { outcome: Bonded, outcome_color: Green }, pool: { hour: Tree, _deliberate: { not: true } } }
|
||||
bond_Orange: { label: Bond Orange, colour: Orange, event: { outcome: Bonded, outcome_color: Orange }, pool: { hour: { in: [Tree, Valley] }, _deliberate: { not: true } } }
|
||||
bond_Brown: { label: Bond Brown, colour: Brown, event: { outcome: Bonded, outcome_color: Brown }, pool: { hour: { in: [Tree, Valley] }, _deliberate: { not: true } } }
|
||||
bond_any: { label: Bond any dragon, colour: null, event: { outcome: Bonded }, pool: { hour: { in: [Tree, Valley] }, _deliberate: { not: true } } }
|
||||
bond_Red: { label: Bond Red, colour: Red, event: { outcome: Bonded, outcome_color: Red }, pool: { hour: { in: [Tree, Valley] } } }
|
||||
bond_Green: { label: Bond Green, colour: Green, event: { outcome: Bonded, outcome_color: Green }, pool: { hour: Tree } }
|
||||
bond_Orange: { label: Bond Orange, colour: Orange, event: { outcome: Bonded, outcome_color: Orange }, pool: { hour: { in: [Tree, Valley] } } }
|
||||
bond_Brown: { label: Bond Brown, colour: Brown, event: { outcome: Bonded, outcome_color: Brown }, pool: { hour: { in: [Tree, Valley] } } }
|
||||
bond_any: { label: Bond any dragon, colour: null, event: { outcome: Bonded }, pool: { hour: { in: [Tree, Valley] } } }
|
||||
|
||||
# Bonding encounters: which recorded attempt (column) belongs to which in-game encounter (where)
|
||||
encounters:
|
||||
@@ -82,8 +80,6 @@ presets:
|
||||
all: { label: All runs, filters: { source: all, goal: all, excludeFlagged: false } }
|
||||
form: { label: Form submissions only, filters: { source: form, goal: all, excludeFlagged: false } }
|
||||
bulk: { label: Bulk logs only (imports), filters: { source: bulk, goal: all, excludeFlagged: false } }
|
||||
reddit: { label: Reddit comments only, filters: { source: reddit, goal: all, excludeFlagged: false } }
|
||||
bot: { label: DragonKind bot only, filters: { source: bot, goal: all, excludeFlagged: false } }
|
||||
not_chasing: { label: Not chasing Blue/Black, filters: { source: all, goal: exclude_rare, excludeFlagged: false } }
|
||||
chasing: { label: Chasing Blue/Black, filters: { source: all, goal: only_rare, excludeFlagged: false } }
|
||||
unflagged: { label: Rows without data-quality flags, filters: { source: all, goal: all, excludeFlagged: true } }
|
||||
@@ -92,17 +88,3 @@ presets:
|
||||
route_thresholds: [5, 10, 20, 30]
|
||||
|
||||
rare_goals: [Blue, Black, Blue or Black]
|
||||
|
||||
# "Show the paths of all riders" on the valley map (site/atlas/explorer.js): one layer per source that records a
|
||||
# route, each with its own switch. Unlike everything above, the layers use every source of runs_clean.csv. Within a
|
||||
# layer the runs are split by how they ended, drawn as line styles in the layer's colour: solid (did not die), dashed
|
||||
# (chose to die: burned at an encounter the rider did not genuinely attempt, the route model's rule) and dotted
|
||||
# (failed: every other death). Discord has no runs yet: its layer is ready for when it is imported.
|
||||
path_layers:
|
||||
- { key: sheet, label: "Google Sheet", sources: [reddit spreadsheet] }
|
||||
- { key: reported, label: "Reported on the Atlas", sources: [reported] }
|
||||
- { key: reddit, label: "Reddit megathread comments", sources: [reddit comment] }
|
||||
- { key: bot, label: "DragonKind bot", sources: [bot] }
|
||||
- { key: discord, label: "Discord", sources: [discord] }
|
||||
# sources that record which dragon bonded but not the route: counted on the map, not drawn
|
||||
path_unrouted: [reddit thread, register]
|
||||
@@ -95,18 +95,7 @@ def is_rare(goal):
|
||||
return goal in M["rare_goals"]
|
||||
|
||||
|
||||
# sources other than the community spreadsheet: their own group wherever runs are split by where they came from
|
||||
SOURCE_LABEL = {"reddit comment": "Reddit comments", "bot": "DragonKind bot", "reported": "Reported on the Atlas"}
|
||||
|
||||
|
||||
def entry_group(r):
|
||||
"""Where a run came from: the spreadsheet's entry type (Form, Data Import, ...) or the source's own label."""
|
||||
return SOURCE_LABEL.get(r["source"]) or r["entry"]
|
||||
|
||||
|
||||
def stratum(r):
|
||||
if r["source"] in SOURCE_LABEL:
|
||||
return SOURCE_LABEL[r["source"]]
|
||||
if r["entry"] != "Form":
|
||||
return "Bulk logs (imports)"
|
||||
g = r["goal"]
|
||||
@@ -119,14 +108,9 @@ def goal2(r):
|
||||
|
||||
def apply_filters(runs, f):
|
||||
def ok(r):
|
||||
sheet = r["source"] == "reddit spreadsheet"
|
||||
if f.get("source") == "form" and not (sheet and r["entry"] == "Form"):
|
||||
if f.get("source") == "form" and r["entry"] != "Form":
|
||||
return False
|
||||
if f.get("source") == "bulk" and not (sheet and r["entry"] != "Form"):
|
||||
return False
|
||||
if f.get("source") == "reddit" and r["source"] != "reddit comment":
|
||||
return False
|
||||
if f.get("source") == "bot" and r["source"] != "bot":
|
||||
if f.get("source") == "bulk" and r["entry"] == "Form":
|
||||
return False
|
||||
if f.get("goal") == "exclude_rare" and is_rare(r["goal"]):
|
||||
return False
|
||||
@@ -213,7 +197,7 @@ def analyse(all_runs, filters):
|
||||
dates = sorted(r["date"] for r in runs if r.get("date"))
|
||||
outs = group_by(runs, lambda r: r["outcome"] + (" " + r["outcome_color"] if r.get("outcome_color") else ""))
|
||||
res["meta"] = {
|
||||
"sources": {k: len(v) for k, v in group_by(runs, entry_group).items()},
|
||||
"sources": {k: len(v) for k, v in group_by(runs, "entry").items()},
|
||||
"date_min": dates[0] if dates else None, "date_max": dates[-1] if dates else None,
|
||||
"n_flagged": sum(1 for r in runs if r["data_flags"]), "flag_counts": flag_counts,
|
||||
"outcomes": {k: len(v) for k, v in outs.items()},
|
||||
@@ -236,14 +220,13 @@ def analyse(all_runs, filters):
|
||||
res["encounters"] = []
|
||||
for e in M["encounters"]:
|
||||
col, colour = e["column"], e["colour"]
|
||||
# a rider who chose to burn here (chasing another colour) did not fail this encounter
|
||||
A = [r for r in runs if match(r, e["where"]) and r.get(col) in ("Bonded!", "Incinerated") and not r.get("_deliberate")]
|
||||
A = [r for r in runs if match(r, e["where"]) and r.get(col) in ("Bonded!", "Incinerated")]
|
||||
win = lambda r, col=col: r.get(col) == "Bonded!" # noqa: E731
|
||||
intent = [r for r in A if r["goal"] == colour or r["goal"].startswith("Any") or (r["goal"] == "Blue or Black" and colour in ("Blue", "Black"))]
|
||||
res["encounters"].append({"context": e["context"], "color": colour, "overall": rate(A, win), "intent_matched": rate(intent, win),
|
||||
"by_stratum": {s: rate(g, win) for s, g in sorted(group_by(A, stratum).items())}})
|
||||
greens_where = next(e["where"] for e in M["encounters"] if e["colour"] == "Green")
|
||||
greens = [r for r in runs if match(r, greens_where) and r.get("enc_Green") and not r.get("_deliberate")]
|
||||
greens = [r for r in runs if match(r, greens_where) and r.get("enc_Green")]
|
||||
g = {"green_encounters": len(greens),
|
||||
"bonded_green": sum(1 for r in greens if r["enc_Green"] == "Bonded!"),
|
||||
"rescued_orange": sum(1 for r in greens if r["rescued"] and r.get("outcome_color") == "Orange"),
|
||||
@@ -257,7 +240,7 @@ def analyse(all_runs, filters):
|
||||
|
||||
first2 = lambda r: r["first_sighting"] if r["first_sighting"] in ("Red", "Brown", "Orange", "Green") else None # noqa: E731
|
||||
known = lambda f: (lambda r: None if is_missing(r.get(f)) else r[f]) # noqa: E731
|
||||
src2 = lambda r: SOURCE_LABEL.get(r["source"]) or ("Form submission" if r["entry"] == "Form" else "Bulk log (import)") # noqa: E731
|
||||
src2 = lambda r: "Form submission" if r["entry"] == "Form" else "Bulk log (import)" # noqa: E731
|
||||
res["models"] = {
|
||||
"blue_meadow": fit_model(runs, "blue_meadow", {"source": src2, "goal": goal2, "direction": known("direction"),
|
||||
"first_sighting": first2, "resolution": known("resolution"), "company": known("company")}),
|
||||
@@ -274,7 +257,7 @@ def analyse(all_runs, filters):
|
||||
"blue": W(bk, len(m)), "shadow": W(sk, len(t))})
|
||||
|
||||
res["source_rates"] = {key: {s: rate([r for r in g if match(r, OUTCOMES[key]["denom"])], lambda r, k=key: match(r, OUTCOMES[k]["event"]))
|
||||
for s, g in group_by(runs, entry_group).items()} for key in ("blue_meadow", "shadow")}
|
||||
for s, g in group_by(runs, "entry").items()} for key in ("blue_meadow", "shadow")}
|
||||
return res
|
||||
|
||||
|
||||
@@ -319,11 +302,9 @@ def route_map(runs):
|
||||
"""The route map: nodes and links with run counts, and for every target the hits and their Wilson interval."""
|
||||
nodes, links = {}, {}
|
||||
hits = {t: {} for t in TARGETS}
|
||||
tries = {t: {} for t in TARGETS} # runs that count for the target (no deliberate deaths for a bond)
|
||||
for r in runs:
|
||||
prev = None
|
||||
hit = {t: match(r, T["event"]) for t, T in TARGETS.items()}
|
||||
counts = {t: not (r.get("_deliberate") and t.startswith("bond_")) for t in TARGETS}
|
||||
for si, s in enumerate(STAGES):
|
||||
v = stage_value(r, s["key"])
|
||||
if v is None:
|
||||
@@ -333,18 +314,15 @@ def route_map(runs):
|
||||
nd["n"] += 1
|
||||
for t in TARGETS:
|
||||
hits[t][nid] = hits[t].get(nid, 0) + hit[t]
|
||||
tries[t][nid] = tries[t].get(nid, 0) + counts[t]
|
||||
if prev:
|
||||
lid = prev + "→" + nid
|
||||
ln = links.setdefault(lid, {"id": lid, "source": prev, "target": nid, "n": 0, "chance": bool(s.get("chance"))})
|
||||
ln["n"] += 1
|
||||
for t in TARGETS:
|
||||
hits[t][lid] = hits[t].get(lid, 0) + hit[t]
|
||||
tries[t][lid] = tries[t].get(lid, 0) + counts[t]
|
||||
prev = nid
|
||||
nl, ll = list(nodes.values()), list(links.values())
|
||||
by_target = {t: {"nodes": [W(hits[t][n["id"]], tries[t][n["id"]]) for n in nl],
|
||||
"links": [W(hits[t][l["id"]], tries[t][l["id"]]) for l in ll]} for t in TARGETS}
|
||||
by_target = {t: {"nodes": [W(hits[t][n["id"]], n["n"]) for n in nl], "links": [W(hits[t][l["id"]], l["n"]) for l in ll]} for t in TARGETS}
|
||||
return {"nodes": nl, "links": ll, "by_target": by_target}
|
||||
|
||||
|
||||
@@ -421,7 +399,7 @@ def place_path(r):
|
||||
s.append("bully")
|
||||
if "res:" + r["resolution"] in L:
|
||||
s.append("res:" + r["resolution"])
|
||||
if (r.get("resolution") or "").startswith("DIED"):
|
||||
if r["resolution"].startswith("DIED"):
|
||||
return s
|
||||
if r.get("post_path") in ("Forest", "West", "East"):
|
||||
s.append("fork:" + r["post_path"])
|
||||
@@ -474,51 +452,17 @@ def valley(runs):
|
||||
return {"counts": counts, "edges": [[*k.split(">"), n] for k, n in sorted(edges.items(), key=lambda kv: -kv[1])]}
|
||||
|
||||
|
||||
DEATHS = ("Incinerated", "Died before the hour")
|
||||
|
||||
|
||||
def deliberate(r):
|
||||
"""A deliberate death: burned at a bonding encounter the rider did not genuinely attempt (chasing another colour,
|
||||
choosing to die and try again). The route model's own rule."""
|
||||
if r["outcome"] != "Incinerated":
|
||||
return False
|
||||
try:
|
||||
v = model.prepare_run(r)
|
||||
return bool(v.get("encCtx")) and not model.genuine_attempt(r, v["encCtx"])
|
||||
except (KeyError, TypeError, ValueError): # a source coded from other questions (e.g. the bot): not known
|
||||
return False
|
||||
|
||||
|
||||
def path_layers(runs):
|
||||
"""'Show the paths of all riders' on the valley map: for every layer in measures.yaml path_layers (one source or
|
||||
more), how many runs went from each place to the next (like valley()), split by how the runs ended: `lived` (did
|
||||
not die), `chose` (a deliberate death) and `failed` (every other death), plus where the deaths happened. Every
|
||||
source is used here, not only the statistics' sources. Sources that record no route are counted only."""
|
||||
out = []
|
||||
for layer in M["path_layers"]:
|
||||
sel = [r for r in runs if r["source"] in layer["sources"]]
|
||||
kinds = {"lived": [], "chose": [], "failed": []}
|
||||
for r in sel:
|
||||
kinds["lived" if r["outcome"] not in DEATHS else "chose" if deliberate(r) else "failed"].append(r)
|
||||
ends = {}
|
||||
for k in ("chose", "failed"):
|
||||
e = {}
|
||||
for r in kinds[k]:
|
||||
seq = place_path(r)
|
||||
if seq:
|
||||
e[seq[-1]] = e.get(seq[-1], 0) + 1
|
||||
ends[k] = dict(sorted(e.items(), key=lambda kv: -kv[1]))
|
||||
out.append({"key": layer["key"], "label": layer["label"], "runs": len(sel),
|
||||
"counts": {k: len(v) for k, v in kinds.items()},
|
||||
"lines": {k: valley(v)["edges"] for k, v in kinds.items()}, "ends": ends})
|
||||
unrouted = {s: sum(1 for r in runs if r["source"] == s) for s in M.get("path_unrouted", [])}
|
||||
return {"layers": out, "unrouted": unrouted}
|
||||
|
||||
|
||||
def overview(runs):
|
||||
"""The Odds' summary cards: cadets who went in and either bonded or died. Deliberate deaths (burned at an
|
||||
encounter the rider did not genuinely attempt) and runs with no recorded outcome are left out."""
|
||||
ended = [r for r in runs if r["outcome"] in ("Bonded", "Incinerated", "Died before the hour")]
|
||||
|
||||
def deliberate(r):
|
||||
if r["outcome"] != "Incinerated":
|
||||
return False
|
||||
v = model.prepare_run(r)
|
||||
return bool(v.get("encCtx")) and not model.genuine_attempt(r, v["encCtx"])
|
||||
|
||||
cadets = [r for r in ended if not deliberate(r)]
|
||||
bonded = sum(1 for r in cadets if r["outcome"] == "Bonded")
|
||||
return {"cadets": len(cadets), "bonded": bonded, "dead": len(cadets) - bonded, "deliberate": len(ended) - len(cadets),
|
||||
@@ -539,7 +483,7 @@ def clean(o):
|
||||
return o
|
||||
|
||||
|
||||
def build(runs, rows, exported=None, every_run=None):
|
||||
def build(runs, rows, exported=None):
|
||||
global PLACES
|
||||
PLACES = place_ids()
|
||||
th = M["route_thresholds"]
|
||||
@@ -562,8 +506,6 @@ def build(runs, rows, exported=None, every_run=None):
|
||||
"routes": {t: rank_routes(sub, t, th) for t in TARGETS},
|
||||
"map": route_map(sub), "valley": valley(sub), "overview": overview(sub),
|
||||
}
|
||||
if every_run is not None:
|
||||
out["paths"] = path_layers(every_run)
|
||||
return clean(out)
|
||||
|
||||
|
||||
@@ -572,12 +514,8 @@ def main(argv=None):
|
||||
ap.add_argument("--data", default=str(runs_io.PATH))
|
||||
ap.add_argument("--out", default=str(ROOT / "data/public/stats.json"))
|
||||
a = ap.parse_args(argv)
|
||||
# a run that cannot have happened as recorded (core/spec/form.yaml impossible_flags) is left out, as in the model
|
||||
runs = [r for r in runs_io.read(a.data, sources=M["sources"]) if not runs_io.impossible(r)]
|
||||
for r in runs:
|
||||
r["_deliberate"] = deliberate(r)
|
||||
every = [r for r in runs_io.read(a.data) if not runs_io.impossible(r)]
|
||||
out = build(runs, len(runs), exported(), every_run=every)
|
||||
runs = runs_io.read(a.data, sources=M["sources"])
|
||||
out = build(runs, len(runs), exported())
|
||||
Path(a.out).write_text(json.dumps(out, separators=(",", ":"), ensure_ascii=False), encoding="utf-8")
|
||||
print(f"{a.out}: {len(runs)} runs, {len(out['presets'])} presets, {Path(a.out).stat().st_size / 1e6:.1f} MB")
|
||||
|
||||
@@ -0,0 +1,319 @@
|
||||
"""The screen tree: every screen the bot has seen, every option on it, and where each option led.
|
||||
|
||||
python analysis/tree/build_tree.py [--check] -> data/public/tree.json, analysis/reports/TREE.md
|
||||
|
||||
Built from the bot's logs only (data/bot/), because only the bot records every screen and every pick; the community
|
||||
form records a summary of a run. For each option on each screen:
|
||||
|
||||
n how many times it was played
|
||||
to where it led, with counts and a 90% range for each destination
|
||||
kind untested never played
|
||||
fixed always led to the same place so far
|
||||
dice led to more than one place (the game's seeded draws)
|
||||
missed for a fixed option: the chance that a second destination with odds of 1 in 20 or better has simply not
|
||||
come up yet (0.95 ** n). The developer has said no single event is rarer than 1 in 20
|
||||
(planner/knowledge.yaml), so this is how sure "fixed" is.
|
||||
|
||||
Then, treating a screen's odds as the same whatever came before it (true for the seeded draws; NOT true for the
|
||||
shadow, which is a guard on earlier choices), the tree gives for every screen the best known chance of bonding each
|
||||
colour and the picks that get it, and for any set of picks where the run ends and how often.
|
||||
|
||||
What counts as played: a pick the bot logged and then overrode on the same screen is dropped (collection/etl/runs.py
|
||||
`played`). A deliberate burn is a real pick with a real result, so it is counted. An aborted run counts up to its
|
||||
last screen.
|
||||
"""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import math
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
sys.path.insert(0, str(ROOT))
|
||||
from collection.etl.runs import played # noqa: E402
|
||||
|
||||
BOT = ROOT / "data/bot"
|
||||
OUT = ROOT / "data/public/tree.json"
|
||||
REPORT = ROOT / "analysis/reports/TREE.md"
|
||||
FLOOR = 0.05 # no single event is rarer than 1 in 20
|
||||
DIED = "DIED"
|
||||
COLOURS = ["Red", "Orange", "Brown", "Green", "Blue", "Black"]
|
||||
|
||||
|
||||
def wilson(y, n, z=1.645):
|
||||
"""A 90% range for a rate (Wilson score)."""
|
||||
if not n:
|
||||
return None, None
|
||||
p = y / n
|
||||
d = 1 + z * z / n
|
||||
c = (p + z * z / (2 * n)) / d
|
||||
h = z * math.sqrt(p * (1 - p) / n + z * z / (4 * n * n)) / d
|
||||
return max(0.0, c - h), min(1.0, c + h)
|
||||
|
||||
|
||||
def trajectories(bot_dir=BOT):
|
||||
seen, out = set(), []
|
||||
for f in sorted(Path(bot_dir).glob("trajectories-*.jsonl")):
|
||||
for line in open(f, encoding="utf-8"):
|
||||
t = json.loads(line)
|
||||
if t["id"] not in seen:
|
||||
seen.add(t["id"])
|
||||
out.append(t)
|
||||
return out
|
||||
|
||||
|
||||
def destination(step, nxt, outcome):
|
||||
"""Where a played step led: the next screen, or how the run ended there. None: not known (an aborted run)."""
|
||||
if nxt is not None:
|
||||
return nxt["scene"]
|
||||
to = step.get("to")
|
||||
if to and to not in ("BURNED",) and not str(to).startswith("BONDED"):
|
||||
return to # the bot saw the next screen but the run was not finished
|
||||
kind = (outcome or {}).get("type")
|
||||
if kind == "BONDED" or str(to).startswith("BONDED"):
|
||||
colour = (outcome or {}).get("colour") or str(to).split(":")[-1]
|
||||
return "BONDED:" + str(colour).capitalize()
|
||||
if kind == "BURNED" or to == "BURNED":
|
||||
return DIED
|
||||
return None
|
||||
|
||||
|
||||
def build(trajs=None, scenes=None):
|
||||
trajs = trajectories() if trajs is None else trajs
|
||||
scenes = json.loads((BOT / "scenes.json").read_text(encoding="utf-8")) if scenes is None else scenes
|
||||
screens = {}
|
||||
|
||||
def screen(sid, step=None):
|
||||
if sid not in screens:
|
||||
s = scenes.get(sid, {})
|
||||
screens[sid] = {"label": s.get("label") or (step or {}).get("stage") or sid, "stage": s.get("stage") or (step or {}).get("stage"),
|
||||
"tint": s.get("tint"), "visits": 0, "options": {}}
|
||||
for o in s.get("options", []):
|
||||
screens[sid]["options"][o["id"]] = {"text": o["text"], "n": 0, "deliberate": 0, "to": {}}
|
||||
return screens[sid]
|
||||
|
||||
for sid in scenes:
|
||||
screen(sid)
|
||||
stats = {"runs": 0, "steps": 0, "overridden": 0, "unknownEnd": 0, "noSteps": 0}
|
||||
starts = {}
|
||||
for t in trajs:
|
||||
steps = played(t["steps"])
|
||||
stats["runs"] += 1
|
||||
stats["overridden"] += len(t["steps"]) - len(steps)
|
||||
if not steps:
|
||||
stats["noSteps"] += 1
|
||||
continue
|
||||
starts[steps[0]["scene"]] = starts.get(steps[0]["scene"], 0) + 1
|
||||
for i, s in enumerate(steps):
|
||||
sc = screen(s["scene"], s)
|
||||
sc["visits"] += 1
|
||||
o = sc["options"].setdefault(s["option"], {"text": s.get("optionText"), "n": 0, "deliberate": 0, "to": {}})
|
||||
dest = destination(s, steps[i + 1] if i + 1 < len(steps) else None, t.get("outcome"))
|
||||
if dest is None:
|
||||
stats["unknownEnd"] += 1
|
||||
continue
|
||||
stats["steps"] += 1
|
||||
o["n"] += 1
|
||||
o["deliberate"] += s.get("stage") == "INTENTIONAL_BURN"
|
||||
o["to"][dest] = o["to"].get(dest, 0) + 1
|
||||
|
||||
for sc in screens.values():
|
||||
for o in sc["options"].values():
|
||||
n = o["n"]
|
||||
o["kind"] = "untested" if not n else "fixed" if len(o["to"]) == 1 else "dice"
|
||||
if o["kind"] == "fixed":
|
||||
o["missed"] = round((1 - FLOOR) ** n, 4)
|
||||
o["to"] = {d: {"n": k, "p": round(k / n, 4), "lo": round(wilson(k, n)[0], 4), "hi": round(wilson(k, n)[1], 4)}
|
||||
for d, k in sorted(o["to"].items(), key=lambda kv: (-kv[1], kv[0]))}
|
||||
if not o["deliberate"]:
|
||||
del o["deliberate"]
|
||||
|
||||
# screens the bot's own labels do not tell apart get the start of their id
|
||||
names = {}
|
||||
for sid, sc in screens.items():
|
||||
names.setdefault(sc["label"], []).append(sid)
|
||||
for label, ids in names.items():
|
||||
if len(ids) > 1:
|
||||
for sid in ids:
|
||||
screens[sid]["label"] = f"{label} #{sid[:4]}"
|
||||
|
||||
tree = {"schema": 1, "floor": FLOOR, "start": max(starts, key=starts.get) if starts else None, "builtFrom": stats,
|
||||
"screens": {k: screens[k] for k in sorted(screens)}}
|
||||
tree["best"] = {c: best(tree, c) for c in COLOURS}
|
||||
tree["coverage"] = coverage(tree)
|
||||
tree["id"] = hashlib.sha1(json.dumps(tree, sort_keys=True, separators=(",", ":")).encode()).hexdigest()[:12]
|
||||
return tree
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- reading the tree
|
||||
|
||||
def value(tree, colour, picks=None, cautious=False):
|
||||
"""For every screen: the chance of bonding `colour` from there, and the pick that gives it. picks: {screen:
|
||||
option id} to follow fixed picks (any screen not in it takes its best tested option). Untested options, and
|
||||
screens nobody has played, count as zero: these are chances known so far, not upper limits.
|
||||
cautious: every option is given one extra, unseen run that failed (k / (n + 1)), so a step played once counts
|
||||
for half and a step played 400 times loses almost nothing. Without it, the best "route" is whichever chain of
|
||||
lucky single runs happens to exist."""
|
||||
S, memo, choice = tree["screens"], {}, {}
|
||||
target = "BONDED:" + colour
|
||||
|
||||
def v(sid, stack=()):
|
||||
if sid == target:
|
||||
return 1.0
|
||||
if sid == DIED or sid.startswith("BONDED:") or sid not in S or sid in stack:
|
||||
return 0.0
|
||||
if sid in memo:
|
||||
return memo[sid]
|
||||
top, arg = 0.0, None
|
||||
for oid, o in S[sid]["options"].items():
|
||||
if not o["n"] or (picks and sid in picks and picks[sid] != oid):
|
||||
continue
|
||||
x = sum((d["n"] / (o["n"] + 1) if cautious else d["p"]) * v(dest, stack + (sid,)) for dest, d in o["to"].items())
|
||||
if arg is None or x > top + 1e-12:
|
||||
top, arg = x, oid
|
||||
memo[sid], choice[sid] = top, arg
|
||||
return top
|
||||
|
||||
for sid in S:
|
||||
v(sid)
|
||||
return memo, choice
|
||||
|
||||
|
||||
def best(tree, colour):
|
||||
"""The best known chance of bonding a colour from the start, and the picks on the way (following the likeliest
|
||||
result of every dice step that can still reach the colour)."""
|
||||
if not tree["start"]:
|
||||
return {"p": 0.0, "picks": []}
|
||||
careful, choice = value(tree, colour, cautious=True) # choose on the cautious numbers,
|
||||
val, _ = value(tree, colour, picks=choice) # report the observed ones for those picks
|
||||
S, picks, sid, seen = tree["screens"], [], tree["start"], set()
|
||||
while sid in S and sid not in seen and choice.get(sid) and val.get(sid, 0) > 0:
|
||||
seen.add(sid)
|
||||
o = S[sid]["options"][choice[sid]]
|
||||
picks.append({"screen": sid, "label": S[sid]["label"], "option": choice[sid], "text": o["text"], "n": o["n"],
|
||||
"kind": o["kind"], "p": round(val[sid], 6)})
|
||||
nxt = [d for d in o["to"] if d == "BONDED:" + colour or val.get(d, 0) > 0]
|
||||
if not nxt:
|
||||
break
|
||||
sid = max(nxt, key=lambda d: (d == "BONDED:" + colour, o["to"][d]["p"] * (1 if d.startswith("BONDED") else val.get(d, 0))))
|
||||
return {"p": round(val.get(tree["start"], 0.0), 6), "pCautious": round(careful.get(tree["start"], 0.0), 6),
|
||||
"picks": picks, "ends": outcomes(tree, choice)}
|
||||
|
||||
|
||||
def outcomes(tree, picks):
|
||||
"""Where a run ends when these picks are followed: {ending: chance}. picks: {screen: option id}; a screen
|
||||
without one takes the option played most. "not mapped" is the share that reaches an untested option or a
|
||||
screen nobody has played."""
|
||||
S, out = tree["screens"], {}
|
||||
|
||||
def walk(sid, p, depth=0):
|
||||
if sid == DIED or sid.startswith("BONDED:"):
|
||||
out[sid] = out.get(sid, 0) + p
|
||||
return
|
||||
sc = S.get(sid)
|
||||
oid = (picks or {}).get(sid) if sc else None
|
||||
if sc and oid is None:
|
||||
tried = [k for k, o in sc["options"].items() if o["n"]]
|
||||
oid = max(tried, key=lambda k: sc["options"][k]["n"]) if tried else None
|
||||
if not sc or oid not in sc["options"] or not sc["options"][oid]["n"] or depth > 200:
|
||||
out["not mapped"] = out.get("not mapped", 0) + p
|
||||
return
|
||||
for dest, d in sc["options"][oid]["to"].items():
|
||||
walk(dest, p * d["p"], depth + 1)
|
||||
|
||||
if tree["start"]:
|
||||
walk(tree["start"], 1.0)
|
||||
return {k: round(v, 6) for k, v in sorted(out.items(), key=lambda kv: -kv[1])}
|
||||
|
||||
|
||||
def coverage(tree):
|
||||
S = tree["screens"]
|
||||
opts = [(sid, oid, o) for sid, sc in S.items() for oid, o in sc["options"].items()]
|
||||
dests = {d for _, _, o in opts for d in o["to"]}
|
||||
untested = sorted(((S[sid]["visits"], sid, oid) for sid, oid, o in opts if not o["n"]), reverse=True)
|
||||
return {"screens": len(S), "options": len(opts), "tested": sum(1 for _, _, o in opts if o["n"]),
|
||||
"fixed": sum(1 for _, _, o in opts if o["kind"] == "fixed"), "dice": sum(1 for _, _, o in opts if o["kind"] == "dice"),
|
||||
"fixedSure": sum(1 for _, _, o in opts if o["kind"] == "fixed" and o["missed"] <= 0.05),
|
||||
"endings": sorted(d for d in dests if d == DIED or d.startswith("BONDED:")),
|
||||
# the cheapest gaps to fill first: untested options on the screens the bot reaches most often
|
||||
"untested": [{"screen": sid, "label": S[sid]["label"], "option": oid, "text": S[sid]["options"][oid]["text"],
|
||||
"screenVisits": v} for v, sid, oid in untested]}
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- the report
|
||||
|
||||
def pct(p):
|
||||
return f"{100 * p:.1f}%" if p >= 0.001 or p == 0 else f"{100 * p:.2f}%"
|
||||
|
||||
|
||||
def report(tree):
|
||||
S, cov, b = tree["screens"], tree["coverage"], tree["builtFrom"]
|
||||
L = ["# The screen tree", "",
|
||||
f"Written by `analysis/tree/build_tree.py` from the bot's logs: {b['runs']} runs, {b['steps']} played steps "
|
||||
f"({b['overridden']} picks the bot logged and then overrode are left out). Machine-readable: "
|
||||
"`data/public/tree.json`.", "",
|
||||
"## Coverage", "",
|
||||
f"- Screens seen: {cov['screens']}. Options on them: {cov['options']}, of which {cov['tested']} have been played "
|
||||
f"and {cov['options'] - cov['tested']} never have.",
|
||||
f"- Played options that are dice (led to more than one place): {cov['dice']}. Always the same place so far: "
|
||||
f"{cov['fixed']}, of which {cov['fixedSure']} have been played often enough (59 times or more) that a hidden "
|
||||
"1-in-20 branch would very likely have shown.",
|
||||
f"- Endings reached: {', '.join(cov['endings'])}.", "",
|
||||
"A screen only appears here once the bot has stood on it, so screens behind untested options are missing "
|
||||
"altogether: the tree is a floor on the size of the game, not its size.", "",
|
||||
"## The dice", "", "Every option that has led to more than one place, most played first (90% range).", "",
|
||||
"| Screen | Option | Played | Led to |", "|---|---|---|---|"]
|
||||
lab = lambda d: d if d == DIED or d.startswith("BONDED:") else S[d]["label"] if d in S else d # noqa: E731
|
||||
dice = sorted(((o["n"], sid, oid) for sid, sc in S.items() for oid, o in sc["options"].items() if o["kind"] == "dice"), reverse=True)
|
||||
for n, sid, oid in dice:
|
||||
o = S[sid]["options"][oid]
|
||||
L.append(f"| {S[sid]['label']} | {o['text'][:60]} | {n} | "
|
||||
+ "; ".join(f"{lab(d)} {pct(x['p'])} ({pct(x['lo'])}-{pct(x['hi'])})" for d, x in o["to"].items()) + " |")
|
||||
L += ["", "## Best known chance of each colour", "",
|
||||
"From the first screen, taking the best tested option on every screen. Untested options count as zero, so "
|
||||
"these are what is known to be achievable, not limits; a colour the bot has never bonded shows 0. "
|
||||
"\"As observed\" multiplies the rates seen. \"Cautious\" adds one unseen failure to every step, which is what "
|
||||
"the picks are chosen on: a chain of steps each played once is worth little.", "",
|
||||
"| Colour | As observed | Cautious | Weakest step on the way | These picks end in |", "|---|---|---|---|---|"]
|
||||
for c in COLOURS:
|
||||
r = tree["best"][c]
|
||||
weak = min(r["picks"], key=lambda k: k["n"]) if r["picks"] else None
|
||||
L.append(f"| {c} | {pct(r['p'])} | {pct(r['pCautious'])} | "
|
||||
+ (f"{weak['label']}: \"{weak['text'][:50]}\", played {weak['n']} times" if weak else "no bond logged") + " | "
|
||||
+ (", ".join(f"{k} {pct(v)}" for k, v in r["ends"].items()) if weak else "") + " |")
|
||||
for c in ("Blue",):
|
||||
r = tree["best"][c]
|
||||
if r["picks"]:
|
||||
L += ["", f"### The picks for {c}", "", "| Screen | Pick | Played | Chance of the bond from here |", "|---|---|---|---|"]
|
||||
L += [f"| {k['label']} | {k['text'][:70]} | {k['n']} | {pct(k['p'])} |" for k in r["picks"]]
|
||||
L += ["", "## Untested options", "", "On the screens the bot reaches most often first: the cheapest gaps to fill.", "",
|
||||
"| Screen | Times on this screen | Option never played |", "|---|---|---|"]
|
||||
L += [f"| {u['label']} | {u['screenVisits']} | {u['text'][:90]} |" for u in cov["untested"]]
|
||||
return "\n".join(L) + "\n"
|
||||
|
||||
|
||||
def render(tree):
|
||||
return json.dumps(tree, indent=1, ensure_ascii=False) + "\n"
|
||||
|
||||
|
||||
def main(argv=None):
|
||||
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
ap.add_argument("--check", action="store_true", help="write nothing; exit 1 if the files are out of date")
|
||||
a = ap.parse_args(argv)
|
||||
tree = build()
|
||||
files = {OUT: render(tree), REPORT: report(tree)}
|
||||
if a.check:
|
||||
stale = [str(p.relative_to(ROOT)) for p, text in files.items() if not p.exists() or p.read_text(encoding="utf-8") != text]
|
||||
if stale:
|
||||
print("out of date (run python analysis/tree/build_tree.py): " + ", ".join(stale), file=sys.stderr)
|
||||
return 1 if stale else 0
|
||||
for p, text in files.items():
|
||||
p.write_text(text, encoding="utf-8")
|
||||
c = tree["coverage"]
|
||||
print(f"tree {tree['id']}: {c['screens']} screens, {c['tested']} of {c['options']} options played, {c['dice']} dice")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,56 @@
|
||||
# collection
|
||||
|
||||
Getting data in, as a strict **extract → transform → load** pipeline. Every source is declared in
|
||||
[`pipeline.yaml`](pipeline.yaml); the code only carries those declarations out.
|
||||
|
||||
```
|
||||
python -m collection update # every source: extract, then transform + load if it changed; then build
|
||||
python -m collection update --source reported --source register
|
||||
python -m collection update --file reddit_spreadsheet=~/Downloads/export.xlsx # a local file instead of the download
|
||||
python -m collection build # code every public source file into data/public/runs_clean.csv
|
||||
python -m collection build --check # nothing written; exit 1 if anything is out of date (CI runs this)
|
||||
```
|
||||
|
||||
## The stages
|
||||
|
||||
| Stage | Does | Never does |
|
||||
|---|---|---|
|
||||
| **extract** (`etl/extract.py`) | Fetches the source as it is now into `data/raw/<source>/current.<ext>`. The version it replaces becomes `previous.<ext>`; nothing older is kept. `data/manifest.json` records the current raw file's sha256 and the day it last changed. | Change the data. |
|
||||
| **transform** (`etl/transform/`) | Turns the raw file into the public source file, applying the source's privacy rules. A pure function of the raw file: no network, no clock. | Write files. |
|
||||
| **validate** (`etl/validate.py`) | Checks the combined runs against `data/dictionary.yaml` (types, every value listed, unique ids). A failure stops the load and is reported. | Fix anything silently. |
|
||||
| **load** (`etl/load.py`) | The only stage that writes public files. Byte-stable: the same input always gives the same bytes, and a file is only rewritten when its bytes change. | Publish anything raw. |
|
||||
|
||||
`build` then codes every public source file into one run per row (`etl/runs.py`, one coder per source) and writes
|
||||
`data/public/runs_clean.csv`, plus the files generated from the specs: the "Report a run" issue form, the bot
|
||||
crosswalk inside `core/graph.js`, and `data/croissant.json`. Every input to `build` is committed, so CI rebuilds
|
||||
it exactly.
|
||||
|
||||
## The sources
|
||||
|
||||
| `source` in runs_clean.csv | Pipeline source | Extract | Public source file |
|
||||
|---|---|---|---|
|
||||
| reddit spreadsheet | `reddit_spreadsheet`: u/ClumsyBadger's Threshing Routes form and spreadsheet, linked from the megathreads | the sheet's .xlsx export | `data/public/form_responses.json` (emails redacted), coded by `core/spec/form.yaml` |
|
||||
| reddit thread | `reddit_thread`: dragonkind.com result pages posted in the r/fourthwing megathreads | the threads, through the official Reddit API (needs `REDDIT_CLIENT_ID` / `REDDIT_CLIENT_SECRET`) | `manual/reddit_results.yaml`, checked by hand; the extract lists result links not in it yet |
|
||||
| reported | `reported`: the Atlas's "Report a run" form (a GitHub issue form, `specs/report_form.yaml`) | issues labelled `run report`, through the GitHub API | `data/public/reports.json` (answers only, no usernames) |
|
||||
| bot | `bot`: Ken's DragonKind bot | a local copy of the bot's private repo (`DRAGONKIND_BOT_DIR`) | `data/bot/scenes.json`, `data/bot/trajectories-<date>.jsonl` (no prose, accounts hashed with `DK_ACCOUNT_SALT`; `specs/bot.yaml`) |
|
||||
| reddit pdf | `reddit_pdf`: the community route PDF | the PDF | `data/derived/pdf_fingerprint.json` only: hashes, never the text |
|
||||
| — | `register`: the Unofficial Dragon Register | the sheet's .xlsx export | `data/public/register.json` (rider names and photos dropped) |
|
||||
|
||||
The route PDF is a flowchart of the choices, not a log of runs, so it adds no rows to `runs_clean.csv`; its
|
||||
fingerprint tells us when the routes it documents change. The register lists bonded dragons without the route that
|
||||
led there, so it adds no rows either.
|
||||
|
||||
## Raw files and privacy
|
||||
|
||||
`data/raw/` is git-ignored and never published. It holds the current raw file of each source and the one before
|
||||
it; older versions are not kept. The daily workflow keeps that store between runs in the Actions cache, encrypted
|
||||
with the `RAW_ARCHIVE_KEY` secret (see `docs/REPO_SETTINGS.md`). Privacy rules sit with each source in
|
||||
`pipeline.yaml`: emails redacted, register names and photos dropped, the bot's fields refused if they look like
|
||||
prose or account ids, GitHub and Reddit usernames never kept.
|
||||
|
||||
## Adding a source
|
||||
|
||||
1. Add a block to `pipeline.yaml` (extract kind, transform, privacy, load target, and `run_source` / `runs` if it
|
||||
has runs).
|
||||
2. If it needs a new transform or coder, add one module to `etl/transform/` and one function to `etl/runs.py`.
|
||||
3. Add its `source` value to `data/dictionary.yaml`, then `python -m collection build` and `npm test`.
|
||||
@@ -0,0 +1,3 @@
|
||||
from collection.run import main
|
||||
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,42 @@
|
||||
"""Files written from the declarative specs, so each rule has one source of truth:
|
||||
.github/ISSUE_TEMPLATE/report-a-run.yml from collection/specs/report_form.yaml (report_form.render)
|
||||
the CROSSWALK block of core/graph.js from collection/specs/bot.yaml (Ken's bot uses it at run time)
|
||||
"""
|
||||
import json
|
||||
|
||||
from . import forge
|
||||
from .common import path, read_yaml
|
||||
|
||||
LINKS = "data/public/links.json"
|
||||
|
||||
|
||||
def links():
|
||||
"""The links the page shows, from forge.yaml and pipeline.yaml (site/build.js fills them into the page)."""
|
||||
f = forge.config()
|
||||
src = read_yaml("collection/pipeline.yaml")["sources"]
|
||||
host = f["url"].split("://", 1)[-1].rstrip("/")
|
||||
return {
|
||||
"repo": forge.repo_url(f), "repo_label": f"{host}/{f['repo']}", "host": host, "kind": f["kind"],
|
||||
"visibility": f.get("visibility", "public"),
|
||||
"report": forge.new_issue_url(".github/ISSUE_TEMPLATE/report-a-run.yml", f),
|
||||
"form": src["reddit_spreadsheet"]["links"]["form"], "sheet": src["reddit_spreadsheet"]["links"]["sheet"],
|
||||
}
|
||||
|
||||
GRAPH_JS = "core/graph.js"
|
||||
BEGIN = " // BEGIN CROSSWALK"
|
||||
END = " // END CROSSWALK\n"
|
||||
|
||||
|
||||
def graph_js():
|
||||
"""core/graph.js with its CROSSWALK block rewritten from the bot spec."""
|
||||
text = path(GRAPH_JS).read_text(encoding="utf-8")
|
||||
a = text.index(BEGIN)
|
||||
a = text.index("\n", a) + 1
|
||||
b = text.index(END, a)
|
||||
rules = read_yaml("collection/specs/bot.yaml")["crosswalk"]
|
||||
lines = [" const CROSSWALK = ["]
|
||||
for i, (rx, col, val) in enumerate(rules):
|
||||
sep = "," if i < len(rules) - 1 else ""
|
||||
lines.append(f" [/{rx.replace('/', chr(92) + '/')}/, {json.dumps(col)}, {json.dumps(val, ensure_ascii=False)}]{sep}")
|
||||
lines.append(" ];")
|
||||
return text[:a] + "\n".join(lines) + "\n" + text[b:]
|
||||
@@ -0,0 +1,76 @@
|
||||
"""Paths, the pipeline spec, and byte-stable writers shared by every stage."""
|
||||
import hashlib
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import yaml
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
if str(ROOT / "core") not in sys.path:
|
||||
sys.path.insert(0, str(ROOT / "core"))
|
||||
|
||||
|
||||
def path(p):
|
||||
return ROOT / p
|
||||
|
||||
|
||||
def read_yaml(p):
|
||||
with open(path(p), encoding="utf-8") as f:
|
||||
return yaml.safe_load(f)
|
||||
|
||||
|
||||
def pipeline():
|
||||
return read_yaml("collection/pipeline.yaml")
|
||||
|
||||
|
||||
def sha256_bytes(data):
|
||||
return hashlib.sha256(data).hexdigest()
|
||||
|
||||
|
||||
def sha256_file(p):
|
||||
h = hashlib.sha256()
|
||||
with open(p, "rb") as f:
|
||||
for block in iter(lambda: f.read(1 << 20), b""):
|
||||
h.update(block)
|
||||
return h.hexdigest()
|
||||
|
||||
|
||||
def json_bytes(obj, compact=True):
|
||||
if compact:
|
||||
return (json.dumps(obj, ensure_ascii=False, separators=(",", ":"))).encode("utf-8")
|
||||
return (json.dumps(obj, ensure_ascii=False, indent=1) + "\n").encode("utf-8")
|
||||
|
||||
|
||||
def jsonl_bytes(rows):
|
||||
return "".join(json.dumps(r, ensure_ascii=False, separators=(",", ":")) + "\n" for r in rows).encode("utf-8")
|
||||
|
||||
|
||||
def read_jsonl(p):
|
||||
p = Path(p)
|
||||
if not p.exists():
|
||||
return []
|
||||
out = []
|
||||
for line in p.read_text(encoding="utf-8").splitlines():
|
||||
if line.strip():
|
||||
try:
|
||||
out.append(json.loads(line))
|
||||
except json.JSONDecodeError:
|
||||
pass
|
||||
return out
|
||||
|
||||
|
||||
class Report:
|
||||
"""What a pipeline run did, as Markdown lines (the daily pull request's body)."""
|
||||
|
||||
def __init__(self):
|
||||
self.lines = []
|
||||
self.changed = False
|
||||
self.failed = []
|
||||
|
||||
def add(self, line):
|
||||
self.lines.append(line)
|
||||
print(line)
|
||||
|
||||
def text(self, title):
|
||||
return "\n".join([f"## {title}", ""] + self.lines) + "\n"
|
||||
@@ -0,0 +1,153 @@
|
||||
"""Extract: fetch each source as it is now into the raw store. No transformation happens here.
|
||||
|
||||
The raw store is data/raw/<source>/ (git-ignored, never published):
|
||||
current.<ext> the latest version
|
||||
previous.<ext> the version before it (kept only in case it is needed; the daily workflow keeps it in an
|
||||
encrypted, private cache). Nothing older is kept and old versions are not hashed.
|
||||
data/manifest.json records, for each source, the sha256 of the current raw file and the date it last changed.
|
||||
|
||||
Each extractor returns the raw bytes, or raises Skip when the source cannot be reached from here (a missing
|
||||
secret, the bot's private repo not on this machine).
|
||||
"""
|
||||
import base64
|
||||
import fnmatch
|
||||
import glob
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
import zipfile
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
|
||||
from .common import path, sha256_bytes
|
||||
|
||||
USER_AGENT = "threshing-atlas-collector/1.0 (+https://github.com/ekcSchiano/threshing-atlas)"
|
||||
RAW_DIR = path("data/raw")
|
||||
|
||||
|
||||
class Skip(Exception):
|
||||
"""The source cannot be extracted here; not an error."""
|
||||
|
||||
|
||||
def _get(url, headers=None, data=None, timeout=60):
|
||||
req = urllib.request.Request(url, data=data, headers={"User-Agent": USER_AGENT, **(headers or {})})
|
||||
with urllib.request.urlopen(req, timeout=timeout) as r:
|
||||
return r.read()
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- extractors, by `kind`
|
||||
|
||||
def http(spec, env):
|
||||
data = _get(spec["url"])
|
||||
head = data[:15].lower()
|
||||
if head.startswith(b"<!doctype html") or head.startswith(b"<html"):
|
||||
raise RuntimeError(f"{spec['url']} returned a web page, not a file (is the link still shared publicly?)")
|
||||
return data
|
||||
|
||||
|
||||
def reddit(spec, env):
|
||||
"""The threads' comments through the official Reddit API (app-only OAuth: a "script" app's id and secret)."""
|
||||
cid, secret = (env.get(k) for k in spec["secrets"])
|
||||
if not (cid and secret):
|
||||
raise Skip(f"set the {' and '.join(spec['secrets'])} secrets to read the threads through the Reddit API")
|
||||
auth = base64.b64encode(f"{cid}:{secret}".encode()).decode()
|
||||
token = json.loads(_get("https://www.reddit.com/api/v1/access_token",
|
||||
headers={"Authorization": f"Basic {auth}"},
|
||||
data=b"grant_type=client_credentials"))["access_token"]
|
||||
threads = {}
|
||||
for tid in spec["threads"]:
|
||||
threads[tid] = json.loads(_get(f"https://oauth.reddit.com/comments/{tid}?limit=500&depth=10&raw_json=1",
|
||||
headers={"Authorization": f"Bearer {token}"}))
|
||||
return json.dumps(threads, ensure_ascii=False, sort_keys=True).encode("utf-8")
|
||||
|
||||
|
||||
def forge_issues(spec, env):
|
||||
"""Every issue with the label (open and closed), from the repository's host (forge.yaml: Gitea or GitHub)."""
|
||||
from . import forge
|
||||
issues = forge.list_issues(spec["label"], env)
|
||||
return json.dumps(issues, ensure_ascii=False, sort_keys=True).encode("utf-8")
|
||||
|
||||
|
||||
def local_dir(spec, env):
|
||||
"""The bot's files, from a local copy of its private repo (DRAGONKIND_BOT_DIR), packed as one JSON."""
|
||||
root = env.get(spec["env"])
|
||||
if not root:
|
||||
raise Skip(f"the bot's repo is private: set {spec['env']} to a local copy to import it")
|
||||
files = {}
|
||||
for pattern in spec["files"]: # a pattern may have * for one folder level (one folder per bot account)
|
||||
hits = sorted(glob.glob(os.path.join(root, pattern)))
|
||||
for p in hits:
|
||||
files[os.path.relpath(p, root).replace(os.sep, "/")] = Path(p).read_text(encoding="utf-8")
|
||||
if not hits and "*" not in pattern:
|
||||
files[pattern] = None
|
||||
return json.dumps(files, ensure_ascii=False, sort_keys=True).encode("utf-8")
|
||||
|
||||
|
||||
def pack_local(spec, src):
|
||||
"""The bot's files from a folder (a copy of the bot repo) or a .zip someone sent (the files may sit under any
|
||||
top folder inside it), packed as one JSON like local_dir."""
|
||||
src = Path(src).expanduser()
|
||||
if src.is_dir():
|
||||
return local_dir(spec, {spec["env"]: str(src)})
|
||||
files = {rel: None for rel in spec["files"] if "*" not in rel}
|
||||
with zipfile.ZipFile(src) as z:
|
||||
names = [n for n in z.namelist() if not n.endswith("/") and "__MACOSX" not in n]
|
||||
for pattern in spec["files"]:
|
||||
for n in names:
|
||||
# the files may sit under a top folder (a zipped repo): match the pattern on the end of the name
|
||||
parts = n.split("/")
|
||||
rel = next(("/".join(parts[i:]) for i in range(len(parts)) if fnmatch.fnmatchcase("/".join(parts[i:]), pattern)), None)
|
||||
if rel and files.get(rel) is None:
|
||||
files[rel] = z.read(n).decode("utf-8")
|
||||
if not any(files.values()):
|
||||
raise RuntimeError(f"{src.name}: none of {', '.join(spec['files'])} found inside")
|
||||
return json.dumps(files, ensure_ascii=False, sort_keys=True).encode("utf-8")
|
||||
|
||||
|
||||
EXTRACTORS = {"http": http, "reddit": reddit, "forge_issues": forge_issues, "local_dir": local_dir}
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- the raw store
|
||||
|
||||
def raw_paths(name, ext):
|
||||
d = RAW_DIR / name
|
||||
return d / f"current.{ext}", d / f"previous.{ext}"
|
||||
|
||||
|
||||
def store(name, ext, data, manifest, today=None):
|
||||
"""Keep `data` as the current raw file. Returns True when it differs from the last one seen."""
|
||||
current, previous = raw_paths(name, ext)
|
||||
digest = sha256_bytes(data)
|
||||
entry = manifest.get(name) or {}
|
||||
changed = entry.get("sha256") != digest
|
||||
current.parent.mkdir(parents=True, exist_ok=True)
|
||||
on_disk = sha256_bytes(current.read_bytes()) if current.exists() else None
|
||||
if on_disk and on_disk != digest:
|
||||
shutil.copyfile(current, previous) # keep one previous version; anything older is gone
|
||||
if on_disk != digest:
|
||||
fd, tmp = tempfile.mkstemp(dir=current.parent)
|
||||
with os.fdopen(fd, "wb") as f:
|
||||
f.write(data)
|
||||
os.replace(tmp, current)
|
||||
if changed:
|
||||
manifest[name] = {"sha256": digest, "bytes": len(data),
|
||||
"changed": today or datetime.now(timezone.utc).strftime("%Y-%m-%d")}
|
||||
return changed
|
||||
|
||||
|
||||
def extract(name, spec, manifest, env=None, local_file=None):
|
||||
"""Fetch one source (or take a local file) into the raw store. Returns (raw path, changed)."""
|
||||
env = os.environ if env is None else env
|
||||
ext = spec["extract"].get("ext") or "json"
|
||||
kind = spec["extract"]["kind"]
|
||||
if local_file and kind == "local_dir":
|
||||
data = pack_local(spec["extract"], local_file) # a bot folder or a .zip someone sent
|
||||
elif local_file:
|
||||
data = Path(local_file).expanduser().read_bytes()
|
||||
else:
|
||||
data = EXTRACTORS[kind](spec["extract"], env)
|
||||
changed = store(name, ext, data, manifest)
|
||||
return raw_paths(name, ext)[0], changed
|
||||
@@ -0,0 +1,163 @@
|
||||
"""The repository host (forge.yaml): links, and the few API calls the pipeline makes, for Gitea and GitHub.
|
||||
|
||||
python -m collection forge open-pr --head BRANCH --title T --body-file F [--automerge]
|
||||
python -m collection forge open-issue --title T --body-file F (skipped if an open issue has that title)
|
||||
python -m collection forge ensure-label --name N --color HEX
|
||||
|
||||
The token comes from ATLAS_BOT_TOKEN, then GITEA_TOKEN / GITHUB_TOKEN / GH_TOKEN.
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
|
||||
from .common import read_yaml
|
||||
|
||||
USER_AGENT = "threshing-atlas-collector/1.0"
|
||||
|
||||
|
||||
def config():
|
||||
return read_yaml("forge.yaml")
|
||||
|
||||
|
||||
def repo_url(f=None):
|
||||
f = f or config()
|
||||
return f"{f['url'].rstrip('/')}/{f['repo']}"
|
||||
|
||||
|
||||
def file_url(path, f=None, raw=True):
|
||||
"""A file in the repository on its main branch (raw content, or the page that shows it)."""
|
||||
f = f or config()
|
||||
if f["kind"] == "github":
|
||||
if raw:
|
||||
return f"https://raw.githubusercontent.com/{f['repo']}/{f['branch']}/{path}"
|
||||
return f"{repo_url(f)}/blob/{f['branch']}/{path}"
|
||||
return f"{repo_url(f)}/{'raw' if raw else 'src'}/branch/{f['branch']}/{path}"
|
||||
|
||||
|
||||
def new_issue_url(template, f=None):
|
||||
"""The "new issue" page for an issue form in .github/ISSUE_TEMPLATE/."""
|
||||
f = f or config()
|
||||
if f["kind"] == "github":
|
||||
return f"{repo_url(f)}/issues/new?template={os.path.basename(template)}"
|
||||
return f"{repo_url(f)}/issues/new?template={urllib.parse.quote(template)}"
|
||||
|
||||
|
||||
def api_base(f=None):
|
||||
f = f or config()
|
||||
if f["kind"] == "github":
|
||||
return f"https://api.github.com/repos/{f['repo']}"
|
||||
return f"{f['url'].rstrip('/')}/api/v1/repos/{f['repo']}"
|
||||
|
||||
|
||||
def token(env=None):
|
||||
env = os.environ if env is None else env
|
||||
for k in ("ATLAS_BOT_TOKEN", "GITEA_TOKEN", "GITHUB_TOKEN", "GH_TOKEN"):
|
||||
if env.get(k):
|
||||
return env[k]
|
||||
return None
|
||||
|
||||
|
||||
def _call(method, url, body=None, tok=None, f=None):
|
||||
f = f or config()
|
||||
headers = {"User-Agent": USER_AGENT, "Accept": "application/json"}
|
||||
if tok:
|
||||
headers["Authorization"] = f"{'Bearer' if f['kind'] == 'github' else 'token'} {tok}"
|
||||
data = None
|
||||
if body is not None:
|
||||
data = json.dumps(body).encode("utf-8")
|
||||
headers["Content-Type"] = "application/json"
|
||||
req = urllib.request.Request(url, data=data, method=method, headers=headers)
|
||||
with urllib.request.urlopen(req, timeout=60) as r:
|
||||
text = r.read().decode("utf-8")
|
||||
return json.loads(text) if text.strip() else None
|
||||
|
||||
|
||||
def list_issues(label, env=None, f=None):
|
||||
"""Every issue (open and closed, no pull requests) with the label, oldest first, in GitHub's field names
|
||||
(number, body, labels, state, state_reason, created_at), which both hosts share."""
|
||||
f = f or config()
|
||||
tok = token(env)
|
||||
lab = urllib.parse.quote(label)
|
||||
out, page = [], 1
|
||||
while True:
|
||||
if f["kind"] == "github":
|
||||
url = f"{api_base(f)}/issues?labels={lab}&state=all&per_page=100&page={page}"
|
||||
else:
|
||||
url = f"{api_base(f)}/issues?labels={lab}&state=all&type=issues&limit=50&page={page}"
|
||||
batch = _call("GET", url, tok=tok, f=f) or []
|
||||
out += [i for i in batch if "pull_request" not in i or not i["pull_request"]]
|
||||
if len(batch) < (100 if f["kind"] == "github" else 50):
|
||||
break
|
||||
page += 1
|
||||
for i in out:
|
||||
i.setdefault("state_reason", None) # Gitea has no close reason: reports are rejected with labels
|
||||
return sorted(out, key=lambda i: i["number"])
|
||||
|
||||
|
||||
def open_pr(head, title, body, automerge=False, env=None, f=None):
|
||||
f = f or config()
|
||||
tok = token(env)
|
||||
pr = _call("POST", f"{api_base(f)}/pulls", {"head": head, "base": f["branch"], "title": title, "body": body}, tok, f)
|
||||
n = pr["number"]
|
||||
if automerge:
|
||||
if f["kind"] == "github":
|
||||
# GitHub's auto-merge needs GraphQL; the repo's auto-merge setting merges it when checks pass
|
||||
print(f"opened #{n}; turn on auto-merge in the pull request page if it is not on by default")
|
||||
else:
|
||||
_call("POST", f"{api_base(f)}/pulls/{n}/merge",
|
||||
{"Do": "squash", "merge_when_checks_succeed": True, "delete_branch_after_merge": True}, tok, f)
|
||||
return n
|
||||
|
||||
|
||||
def open_issue(title, body, env=None, f=None):
|
||||
f = f or config()
|
||||
tok = token(env)
|
||||
q = urllib.parse.quote(title)
|
||||
found = _call("GET", f"{api_base(f)}/issues?state=open&type=issues&q={q}" if f["kind"] == "gitea"
|
||||
else f"{api_base(f)}/issues?state=open&per_page=100", tok=tok, f=f) or []
|
||||
if any(i.get("title") == title for i in found):
|
||||
return None
|
||||
return _call("POST", f"{api_base(f)}/issues", {"title": title, "body": body}, tok, f)["number"]
|
||||
|
||||
|
||||
def ensure_label(name, color, env=None, f=None):
|
||||
f = f or config()
|
||||
tok = token(env)
|
||||
labels = _call("GET", f"{api_base(f)}/labels?limit=50&per_page=100", tok=tok, f=f) or []
|
||||
if any(lb["name"] == name for lb in labels):
|
||||
return False
|
||||
_call("POST", f"{api_base(f)}/labels", {"name": name, "color": ("#" if f["kind"] == "gitea" else "") + color.lstrip("#")}, tok, f)
|
||||
return True
|
||||
|
||||
|
||||
def main(argv):
|
||||
import argparse
|
||||
ap = argparse.ArgumentParser(prog="python -m collection forge")
|
||||
sub = ap.add_subparsers(dest="cmd", required=True)
|
||||
p = sub.add_parser("open-pr")
|
||||
p.add_argument("--head", required=True)
|
||||
p.add_argument("--title", required=True)
|
||||
p.add_argument("--body-file", required=True)
|
||||
p.add_argument("--automerge", action="store_true")
|
||||
i = sub.add_parser("open-issue")
|
||||
i.add_argument("--title", required=True)
|
||||
i.add_argument("--body-file", required=True)
|
||||
lb = sub.add_parser("ensure-label")
|
||||
lb.add_argument("--name", required=True)
|
||||
lb.add_argument("--color", default="e8b07e")
|
||||
a = ap.parse_args(argv)
|
||||
if a.cmd == "open-pr":
|
||||
body = open(a.body_file, encoding="utf-8").read()
|
||||
print(f"pull request #{open_pr(a.head, a.title, body, a.automerge)}")
|
||||
elif a.cmd == "open-issue":
|
||||
n = open_issue(a.title, open(a.body_file, encoding="utf-8").read())
|
||||
print(f"issue #{n}" if n else "an open issue with that title exists already")
|
||||
elif a.cmd == "ensure-label":
|
||||
print("created" if ensure_label(a.name, a.color) else "exists")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main(sys.argv[1:]))
|
||||
@@ -0,0 +1,198 @@
|
||||
"""Hand-offs without GitHub: the zip of atlas files for the bot, and the local equivalent of the daily workflow.
|
||||
|
||||
python -m collection export-bot-kit -> exports/atlas-for-bot-<date>-<policy id>.zip
|
||||
policy.json, experiments.json, solver.js and graph.js (what the bot vendors into vendor/threshing-atlas/), plus a README and
|
||||
checksums. Send it to the bot's maintainer; they unzip it into vendor/threshing-atlas/.
|
||||
python -m collection refresh [--bot PATH ...]
|
||||
Every source (and any bot folders or zips given), then the graph, the route model, the statistics and the
|
||||
build: what .github/workflows/update-sources.yml does every day.
|
||||
python -m collection cycle --bot PATH [--deliver DIR] [--community] [--force]
|
||||
The loop with the bot, in one command and safe to run on a timer: import the bot's new runs, refit the
|
||||
route model, rebuild the experiment plan, and put the bot's files where it reads them. Does nothing but
|
||||
deliver when the bot has no new runs.
|
||||
"""
|
||||
import hashlib
|
||||
import json
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import zipfile
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
|
||||
from .common import ROOT, path
|
||||
|
||||
KIT = {"policy.json": "data/public/policy.json", "experiments.json": "data/public/experiments.json",
|
||||
"tree.json": "data/public/tree.json",
|
||||
"solver.js": "core/solver.js", "graph.js": "core/graph.js"}
|
||||
|
||||
README = """Threshing Atlas files for the DragonKind bot
|
||||
============================================
|
||||
|
||||
Policy id: {policy}
|
||||
Made: {made}
|
||||
|
||||
Unzip these five files into the bot's vendor/threshing-atlas/ folder, replacing the old ones, and keep them
|
||||
together: solver.js reads the game from this policy.json.
|
||||
|
||||
policy.json the route model (the game, the counts behind every roll, the best routes per colour)
|
||||
experiments.json the experiment plan: what each attempt of each account is for (read it with assign())
|
||||
tree.json the screen tree: every screen, every option, where each led (read it with screenPick())
|
||||
solver.js the advisor: advisor(), recommendOption(), solverHistory(), assign(), screenPick()
|
||||
graph.js trajectoryVariables(): the bot's steps -> the community form's variables
|
||||
|
||||
How the bot uses them: docs/BOT_INTEGRATION.md in the atlas repo. Log the policy id above as policyId on each run,
|
||||
and the plan's id as planId.
|
||||
|
||||
Checksums (sha256):
|
||||
{sums}
|
||||
|
||||
To send runs back: zip the bot's data/runs.jsonl, data/knowledge.json and logs/encounters.jsonl (keep the folder
|
||||
names) and send the zip. It is imported with `python -m collection refresh --bot <the zip>`; only anonymised
|
||||
steps and outcomes are kept (no game prose, no account names).
|
||||
"""
|
||||
|
||||
|
||||
def export_bot_kit(out_dir="exports"):
|
||||
policy = json.loads(path(KIT["policy.json"]).read_text(encoding="utf-8"))
|
||||
pid = str(policy.get("id", "unknown"))[:12]
|
||||
made = datetime.now(timezone.utc).strftime("%Y-%m-%d")
|
||||
sums = "\n".join(f" {hashlib.sha256(path(src).read_bytes()).hexdigest()} {name}" for name, src in KIT.items())
|
||||
out = path(out_dir)
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
zpath = out / f"atlas-for-bot-{made}-{pid}.zip"
|
||||
with zipfile.ZipFile(zpath, "w", zipfile.ZIP_DEFLATED) as z:
|
||||
for name, src in KIT.items():
|
||||
z.writestr(zipfile.ZipInfo(name, (2026, 1, 1, 0, 0, 0)), path(src).read_bytes(), zipfile.ZIP_DEFLATED)
|
||||
z.writestr(zipfile.ZipInfo("README.txt", (2026, 1, 1, 0, 0, 0)), README.format(policy=pid, made=made, sums=sums))
|
||||
return zpath
|
||||
|
||||
|
||||
def _step(label, cmd):
|
||||
print(f"\n== {label}: {' '.join(cmd)}", flush=True)
|
||||
subprocess.run(cmd, cwd=ROOT, check=True)
|
||||
|
||||
|
||||
def rebuild():
|
||||
"""Everything built from the runs, in order. The one list the local refresh, the bot cycle and the daily
|
||||
workflows all use (`python -m collection rebuild`), so a new report only needs adding here."""
|
||||
py = sys.executable
|
||||
# the runs first: if they do not match data/dictionary.yaml, stop here rather than model yesterday's runs
|
||||
_step("runs, checked against the dictionary", [py, "-m", "collection", "build"])
|
||||
if shutil.which("node"):
|
||||
_step("route graph", ["node", "analysis/network/build-graph.js"])
|
||||
else:
|
||||
print("\n(node is not installed: data/public/graph.json is not rebuilt; everything else is)")
|
||||
_step("route model (a few minutes)", [py, "planner/build_policy.py"])
|
||||
_step("experiment plan", [py, "planner/build_experiments.py"])
|
||||
_step("what the runs show about the Black", [py, "analysis/black/evidence.py"])
|
||||
_step("screen tree", [py, "analysis/tree/build_tree.py"])
|
||||
try:
|
||||
import scipy # noqa: F401
|
||||
_step("statistics", [py, "analysis/stats/site_stats.py"])
|
||||
except ImportError:
|
||||
print("\n(scipy is not installed: data/public/stats.json is not rebuilt)")
|
||||
_step("runs, generated files and metadata", [py, "-m", "collection", "build"])
|
||||
return 0
|
||||
|
||||
|
||||
def refresh(update_main, bots=()):
|
||||
"""update -> (graph, policy, stats, build) when something changed. Returns 0 on success."""
|
||||
py = sys.executable
|
||||
args = ["update", "--report", str(path("exports/last-report.md"))]
|
||||
path("exports").mkdir(exist_ok=True)
|
||||
rc = update_main(args)
|
||||
for i, b in enumerate(bots):
|
||||
rc |= update_main(["update", "--source", "bot", "--file", f"bot={b}", "--report", str(path(f"exports/last-report-bot{i + 1}.md"))])
|
||||
rebuild()
|
||||
print(f"\nDone. What changed: exports/last-report.md. Send the bot its files with: {py} -m collection export-bot-kit")
|
||||
return rc
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- the automated cycle with the bot
|
||||
|
||||
def _fingerprint():
|
||||
"""What the route model and the plan are built from: the coded runs and the bot's anonymised files."""
|
||||
h = hashlib.sha256()
|
||||
for p in [path("data/public/runs_clean.csv"), *sorted(path("data/bot").glob("*.json*")), path("planner/knowledge.yaml"),
|
||||
path("planner/policy.yaml"), path("planner/experiments.yaml"), path("core/spec/game.yaml")]:
|
||||
if p.exists():
|
||||
h.update(p.name.encode())
|
||||
h.update(p.read_bytes())
|
||||
return h.hexdigest()
|
||||
|
||||
|
||||
def _headline():
|
||||
"""The numbers a person checks after a cycle: {label: value}."""
|
||||
out = {}
|
||||
try:
|
||||
pol = json.loads(path("data/public/policy.json").read_text(encoding="utf-8"))
|
||||
out["policy id"] = pol["id"]
|
||||
t = pol["samples"]["all"]["targets"]
|
||||
pct = lambda d: f"{100 * d['mean']:.2f}% ({100 * d['lo']:.2f}-{100 * d['hi']:.2f})" # noqa: E731
|
||||
out["Black, first attempt"] = pct(t["Black"]["firstAttempt"]["thisAttempt"]["pX"])
|
||||
out["Black, later attempt"] = pct(t["Black"]["thisAttempt"]["pX"])
|
||||
out["Blue, per attempt"] = pct(t["Blue"]["thisAttempt"]["pX"])
|
||||
out["runs the model learns from"] = pol["source"]["runs"]
|
||||
out["bot runs"] = pol["source"]["by_source"].get("bot", 0)
|
||||
except (OSError, KeyError, ValueError):
|
||||
pass
|
||||
try:
|
||||
plan = json.loads(path("data/public/experiments.json").read_text(encoding="utf-8"))
|
||||
out["plan id"] = plan["id"]
|
||||
for e in plan["experiments"]:
|
||||
p = e["progress"]
|
||||
out[f"experiment {e['id']}"] = f"{e['status']}: {p['observed']} observed, {p['rare']} rare" + (f" [{e['note']}]" if e.get("note") else "")
|
||||
except (OSError, KeyError, ValueError):
|
||||
pass
|
||||
return out
|
||||
|
||||
|
||||
def deliver(dest):
|
||||
"""Copy the bot's files (KIT) into a folder, each one whole (written beside it, then renamed), with a manifest
|
||||
the bot can check before an attempt: atlas-kit.json = {policyId, planId, made, sha256: {file: sum}}."""
|
||||
dest = Path(dest).expanduser()
|
||||
dest = dest if dest.is_absolute() else path(str(dest))
|
||||
dest.mkdir(parents=True, exist_ok=True)
|
||||
sums = {}
|
||||
for name, src in KIT.items():
|
||||
data = path(src).read_bytes()
|
||||
sums[name] = hashlib.sha256(data).hexdigest()
|
||||
tmp = dest / (name + ".incoming")
|
||||
tmp.write_bytes(data)
|
||||
tmp.replace(dest / name)
|
||||
head = _headline()
|
||||
manifest = {"policyId": head.get("policy id"), "planId": head.get("plan id"),
|
||||
"made": datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ"), "sha256": sums}
|
||||
tmp = dest / "atlas-kit.json.incoming"
|
||||
tmp.write_text(json.dumps(manifest, indent=1) + "\n", encoding="utf-8")
|
||||
tmp.replace(dest / "atlas-kit.json") # last: a kit whose manifest matches its files is complete
|
||||
return dest
|
||||
|
||||
|
||||
def cycle(update_main, bots, deliver_to=None, community=False, force=False):
|
||||
"""Import the bot's runs -> refit -> re-plan -> deliver. Returns 0 on success. Writes exports/last-cycle.md."""
|
||||
py = sys.executable
|
||||
path("exports").mkdir(exist_ok=True)
|
||||
before, was = _fingerprint(), _headline()
|
||||
rc = 0
|
||||
if community:
|
||||
rc |= update_main(["update", "--report", str(path("exports/last-report.md"))])
|
||||
for i, b in enumerate(bots):
|
||||
rc |= update_main(["update", "--source", "bot", "--file", f"bot={b}", "--report", str(path(f"exports/last-report-bot{i + 1}.md"))])
|
||||
built = all(path(src).exists() for src in KIT.values())
|
||||
changed = force or not built or _fingerprint() != before
|
||||
if changed:
|
||||
rebuild()
|
||||
else:
|
||||
print("\nNo new runs: the route model and the plan are unchanged.")
|
||||
now = _headline()
|
||||
lines = [f"# Bot cycle, {datetime.now(timezone.utc).strftime('%Y-%m-%d %H:%M')} UTC", "",
|
||||
"The model and the plan were rebuilt." if changed else "No new runs: nothing was rebuilt.", "",
|
||||
"| | Before | Now |", "|---|---|---|"]
|
||||
lines += [f"| {k} | {was.get(k, '-')} | {v} |" for k, v in now.items()]
|
||||
if deliver_to:
|
||||
lines += ["", f"Delivered to `{deliver(deliver_to)}`."]
|
||||
path("exports/last-cycle.md").write_text("\n".join(lines) + "\n", encoding="utf-8")
|
||||
print("\n" + "\n".join(lines))
|
||||
return rc
|
||||
@@ -0,0 +1,54 @@
|
||||
"""Load: the only stage that writes public files. Writes are byte-stable (the same table gives the same bytes)
|
||||
and only happen when the bytes change, so git shows exactly what changed."""
|
||||
import csv
|
||||
import io
|
||||
import json
|
||||
|
||||
from .common import json_bytes, jsonl_bytes, path
|
||||
|
||||
|
||||
def public(obj):
|
||||
"""Drop transient keys (those starting with "_"), which are for the report only."""
|
||||
if isinstance(obj, dict):
|
||||
return {k: public(v) for k, v in obj.items() if not str(k).startswith("_")}
|
||||
if isinstance(obj, list):
|
||||
return [public(v) for v in obj]
|
||||
return obj
|
||||
|
||||
|
||||
def read_json(rel):
|
||||
p = path(rel)
|
||||
return json.loads(p.read_text(encoding="utf-8")) if p.exists() else None
|
||||
|
||||
|
||||
def write_bytes(rel, data, check=False):
|
||||
"""Write when different. Returns True when the file changed (or, with check, would change)."""
|
||||
p = path(rel)
|
||||
if p.exists() and p.read_bytes() == data:
|
||||
return False
|
||||
if not check:
|
||||
p.parent.mkdir(parents=True, exist_ok=True)
|
||||
p.write_bytes(data)
|
||||
return True
|
||||
|
||||
|
||||
def json_file(rel, obj, check=False, compact=True):
|
||||
return write_bytes(rel, json_bytes(public(obj), compact), check)
|
||||
|
||||
|
||||
def jsonl_file(rel, rows, check=False):
|
||||
return write_bytes(rel, jsonl_bytes(rows), check)
|
||||
|
||||
|
||||
def csv_bytes(rows, columns):
|
||||
"""True/False for booleans, empty for missing, everything else as text."""
|
||||
buf = io.StringIO()
|
||||
w = csv.writer(buf, lineterminator="\n")
|
||||
w.writerow(columns)
|
||||
for r in rows:
|
||||
w.writerow(["" if r.get(c) is None else r[c] for c in columns])
|
||||
return buf.getvalue().encode("utf-8")
|
||||
|
||||
|
||||
def csv_file(rel, rows, columns, check=False):
|
||||
return write_bytes(rel, csv_bytes(rows, columns), check)
|
||||
@@ -0,0 +1,135 @@
|
||||
"""Write data/croissant.json (Croissant 1.0 JSON-LD) from data/dictionary.yaml.
|
||||
|
||||
Croissant is the MLCommons metadata format for datasets: it says what each file is, its checksum, and what each
|
||||
column means, so tools (and people) can load and cite the data without reading this repo's code.
|
||||
|
||||
Written by `python -m collection build` (a test checks it is up to date).
|
||||
"""
|
||||
import json
|
||||
|
||||
from . import forge
|
||||
from .common import ROOT, pipeline, read_yaml, sha256_file
|
||||
|
||||
OUT = "data/croissant.json"
|
||||
|
||||
CONTEXT = {
|
||||
"@language": "en",
|
||||
"@vocab": "https://schema.org/",
|
||||
"citeAs": "cr:citeAs",
|
||||
"column": "cr:column",
|
||||
"conformsTo": "dct:conformsTo",
|
||||
"cr": "http://mlcommons.org/croissant/",
|
||||
"data": {"@id": "cr:data", "@type": "@json"},
|
||||
"dataType": {"@id": "cr:dataType", "@type": "@vocab"},
|
||||
"dct": "http://purl.org/dc/terms/",
|
||||
"examples": {"@id": "cr:examples", "@type": "@json"},
|
||||
"extract": "cr:extract",
|
||||
"field": "cr:field",
|
||||
"fileObject": "cr:fileObject",
|
||||
"fileProperty": "cr:fileProperty",
|
||||
"format": "cr:format",
|
||||
"includes": "cr:includes",
|
||||
"isLiveDataset": "cr:isLiveDataset",
|
||||
"jsonPath": "cr:jsonPath",
|
||||
"key": "cr:key",
|
||||
"md5": "cr:md5",
|
||||
"parentField": "cr:parentField",
|
||||
"path": "cr:path",
|
||||
"recordSet": "cr:recordSet",
|
||||
"references": "cr:references",
|
||||
"regex": "cr:regex",
|
||||
"repeated": "cr:repeated",
|
||||
"replace": "cr:replace",
|
||||
"sc": "https://schema.org/",
|
||||
"separator": "cr:separator",
|
||||
"source": "cr:source",
|
||||
"subField": "cr:subField",
|
||||
"transform": "cr:transform",
|
||||
}
|
||||
|
||||
# Croissant has no boolean-as-text type; the CSV writes True/False, which sc:Boolean parses.
|
||||
DATA_TYPES = {"text": "sc:Text", "integer": "sc:Integer", "boolean": "sc:Boolean", "date": "sc:Date"}
|
||||
|
||||
|
||||
sha256 = sha256_file
|
||||
|
||||
|
||||
def load_dictionary():
|
||||
return read_yaml("data/dictionary.yaml")
|
||||
|
||||
|
||||
def field_description(spec):
|
||||
text = " ".join(spec["description"].split())
|
||||
if spec.get("values"):
|
||||
text += " Values: " + "; ".join(str(v) for v in spec["values"]) + "."
|
||||
return text
|
||||
|
||||
|
||||
def build(dictionary=None):
|
||||
d = dictionary or load_dictionary()
|
||||
ds = d["dataset"]
|
||||
fg = forge.config()
|
||||
sources = pipeline()["sources"]
|
||||
|
||||
distribution = []
|
||||
for key, spec in d["files"].items():
|
||||
path = ROOT / spec["path"]
|
||||
entry = {
|
||||
"@type": "cr:FileObject",
|
||||
"@id": key,
|
||||
"name": key,
|
||||
"description": " ".join(spec["description"].split()),
|
||||
"contentUrl": forge.file_url(spec["path"], fg),
|
||||
"encodingFormat": spec["format"],
|
||||
"sha256": sha256(path),
|
||||
"contentSize": f"{path.stat().st_size} B",
|
||||
}
|
||||
distribution.append(entry)
|
||||
|
||||
fields = [
|
||||
{
|
||||
"@type": "cr:Field",
|
||||
"@id": f"runs/{name}",
|
||||
"name": name,
|
||||
"description": field_description(spec),
|
||||
"dataType": DATA_TYPES[spec["type"]],
|
||||
"source": {"fileObject": {"@id": "runs_clean"}, "extract": {"column": name}},
|
||||
}
|
||||
for name, spec in d["columns"].items()
|
||||
]
|
||||
|
||||
return {
|
||||
"@context": CONTEXT,
|
||||
"@type": "sc:Dataset",
|
||||
"conformsTo": "http://mlcommons.org/croissant/1.0",
|
||||
"name": ds["name"],
|
||||
"description": " ".join(ds["description"].split()),
|
||||
"url": fg.get("site") or forge.repo_url(fg),
|
||||
"sameAs": forge.repo_url(fg),
|
||||
"license": ds["license"],
|
||||
"creator": {"@type": "sc:Person", "name": ds["creator"]},
|
||||
"keywords": ds["keywords"],
|
||||
"citeAs": ds["citation"].format(repository=forge.repo_url(fg)),
|
||||
"isLiveDataset": True,
|
||||
"isBasedOn": [
|
||||
{"@type": "sc:CreativeWork", "name": s["label"], "url": next(iter(s["links"].values()))}
|
||||
for s in sources.values()
|
||||
# the route PDF is only fingerprinted, never redistributed; the bot's repo is private
|
||||
if (s.get("privacy") or {}).get("redistribute", True) and s.get("links")
|
||||
],
|
||||
"distribution": distribution,
|
||||
"recordSet": [
|
||||
{
|
||||
"@type": "cr:RecordSet",
|
||||
"@id": "runs",
|
||||
"name": "runs",
|
||||
"description": "One coded threshing run per row, from every source (data/public/runs_clean.csv).",
|
||||
"key": {"@id": "runs/run_id"},
|
||||
"field": fields,
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
def render(doc):
|
||||
return json.dumps(doc, indent=2, ensure_ascii=False) + "\n"
|
||||
@@ -0,0 +1,60 @@
|
||||
"""The "Report a run" GitHub issue form, written from collection/specs/report_form.yaml, and the parser for the
|
||||
issues it creates (GitHub renders each answer as "### <question>" followed by the answer)."""
|
||||
import re
|
||||
|
||||
import yaml
|
||||
|
||||
from .common import read_yaml
|
||||
|
||||
|
||||
class _Dumper(yaml.SafeDumper):
|
||||
pass
|
||||
|
||||
|
||||
def _str(dumper, s):
|
||||
# multi-line text (the intro) as a readable block
|
||||
return dumper.represent_scalar("tag:yaml.org,2002:str", s, style="|" if "\n" in s else None)
|
||||
|
||||
|
||||
_Dumper.add_representer(str, _str)
|
||||
|
||||
SPEC_PATH = "collection/specs/report_form.yaml"
|
||||
TEMPLATE = ".github/ISSUE_TEMPLATE/report-a-run.yml"
|
||||
NOT_SURE = "Not sure"
|
||||
NO_RESPONSE = {"", "_No response_", "None", NOT_SURE}
|
||||
|
||||
|
||||
def spec():
|
||||
return read_yaml(SPEC_PATH)
|
||||
|
||||
|
||||
def render(s=None):
|
||||
s = s or spec()
|
||||
body = [{"type": "markdown", "attributes": {"value": s["intro"]}}]
|
||||
for f in s["fields"]:
|
||||
if f.get("type") == "integer":
|
||||
item = {"type": "input", "id": f["id"], "attributes": {"label": f["label"], "placeholder": "e.g. 3"}}
|
||||
else:
|
||||
opts = list(f["options"])
|
||||
if not f.get("required"):
|
||||
opts.append(NOT_SURE)
|
||||
item = {"type": "dropdown", "id": f["id"], "attributes": {"label": f["label"], "options": opts}}
|
||||
item["validations"] = {"required": bool(f.get("required"))}
|
||||
body.append(item)
|
||||
form = {"name": s["name"], "description": s["description"], "title": s["title"], "labels": [s["label"]], "body": body}
|
||||
head = f"# Written by collection/etl/report_form.py from {SPEC_PATH}: edit that file, then run `python -m collection build`.\n"
|
||||
return head + yaml.dump(form, Dumper=_Dumper, sort_keys=False, allow_unicode=True, width=1000)
|
||||
|
||||
|
||||
def parse_body(body, s=None):
|
||||
"""Issue body -> {field id: chosen option label or text}. Unanswered questions are left out."""
|
||||
s = s or spec()
|
||||
by_label = {f["label"].strip(): f["id"] for f in s["fields"]}
|
||||
out = {}
|
||||
for block in re.split(r"^### ", body or "", flags=re.M)[1:]:
|
||||
q, _, a = block.partition("\n")
|
||||
fid = by_label.get(q.strip())
|
||||
a = a.strip()
|
||||
if fid and a not in NO_RESPONSE:
|
||||
out[fid] = a
|
||||
return out
|
||||
@@ -0,0 +1,274 @@
|
||||
"""Build: every public source file -> one coded run per row, for data/public/runs_clean.csv.
|
||||
|
||||
One coder per source (pipeline.yaml `runs:`). Every coder returns rows keyed by the columns of data/dictionary.yaml;
|
||||
missing answers get the same "not known" values the community form's coding uses, so every source can be filtered
|
||||
the same way. The `source` column says where a run came from; `entry` keeps the spreadsheet's own row label.
|
||||
"""
|
||||
import json
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
from .common import path, read_jsonl, read_yaml
|
||||
from . import report_form
|
||||
|
||||
DICT = read_yaml("data/dictionary.yaml")
|
||||
COLUMNS = list(DICT["columns"])
|
||||
COLOURS = ["Red", "Green", "Orange", "Brown", "Blue", "Black"]
|
||||
|
||||
# what "not known" is, per column, for sources that did not ask (the community form's coding uses the same)
|
||||
NOT_KNOWN = {
|
||||
"wing": "Unknown", "squad": "Unknown", "attempt_group": "Unknown", "goal": "(not asked/blank)",
|
||||
"company": "Unknown", "direction": "Unknown", "first_sighting": "Unknown", "sighting_action": "Unknown",
|
||||
"scream": "Unknown", "resolution": "Unknown", "combat_first": "(not recorded)", "combat_second": "(not recorded)",
|
||||
"post_path": "Unknown", "hour": "Unknown", "rare_reported": "(not asked)", "malek_intent": "(not asked)",
|
||||
"outcome": "No outcome recorded", "data_flags": "",
|
||||
}
|
||||
|
||||
|
||||
def blank_row(**values):
|
||||
row = {c: None for c in COLUMNS}
|
||||
row.update(values)
|
||||
for c, v in NOT_KNOWN.items():
|
||||
if row[c] is None:
|
||||
row[c] = v
|
||||
return row
|
||||
|
||||
|
||||
def attempt_group(n):
|
||||
return "First attempt" if n == 1 else "Later attempt" if n and n > 1 else "Unknown"
|
||||
|
||||
|
||||
def encounter_columns(row, intentional=False):
|
||||
"""The bonding-grid column of the dragon that ended the run."""
|
||||
col = row["outcome_color"]
|
||||
if col and not intentional:
|
||||
if row["outcome"] == "Bonded":
|
||||
row["enc_" + col] = "Bonded!"
|
||||
elif row["outcome"] == "Incinerated":
|
||||
row["enc_" + col] = "Incinerated"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- coders, by pipeline.yaml `runs:`
|
||||
|
||||
def spreadsheet(name, spec):
|
||||
"""The community form: core/spec/form.yaml + core/atlas/coding.py, unchanged."""
|
||||
from atlas import coding
|
||||
df, missing = coding.code_frame(coding.read_export(path(spec["load"])))
|
||||
if missing:
|
||||
print(f"WARNING: {name}: questions not found in the sheet: {missing}")
|
||||
df["attempt"] = df["attempt"].astype("Int64")
|
||||
rows = []
|
||||
for rec in df.astype(object).where(df.notna(), None).to_dict("records"):
|
||||
n = rec.pop("run_id")
|
||||
entry = rec.pop("source")
|
||||
rows.append({**{c: None for c in COLUMNS}, **rec, "run_id": f"sheet-{n}", "source": spec["run_source"], "entry": entry})
|
||||
return rows
|
||||
|
||||
|
||||
def reddit_results(name, spec):
|
||||
"""Dragons read from result pages linked in the megathreads: bonded, colour and tail known, route unknown."""
|
||||
rows = []
|
||||
for r in read_yaml(spec["transform"]["manual"])["results"]:
|
||||
row = blank_row(run_id=f"thread-{r['id']}", source=spec["run_source"], outcome="Bonded",
|
||||
outcome_color=r["colour"], tail=r["tail"])
|
||||
encounter_columns(row)
|
||||
rows.append(row)
|
||||
return rows
|
||||
|
||||
|
||||
def register(name, spec):
|
||||
"""The Unofficial Dragon Register: one bonded dragon per row, with the rider's assignment, no route. A rider may
|
||||
have logged the same run in the community form, so every row is flagged; nothing can match the two."""
|
||||
p = path(spec["load"])
|
||||
data = json.loads(p.read_text(encoding="utf-8")) if p.exists() else {"headers": [], "rows": []}
|
||||
|
||||
def col(*words):
|
||||
return next((h for h in data["headers"] if all(w in h.lower() for w in words)), None)
|
||||
|
||||
h = {k: col(*w) for k, w in {"when": ("timestamp",), "wing": ("wing",), "section": ("section",), "squad": ("squad",),
|
||||
"colour": ("colour",), "tail": ("tail",)}.items()}
|
||||
values = {c: DICT["columns"][c].get("values") or [] for c in ("wing", "section", "squad", "outcome_color", "tail")}
|
||||
rows = []
|
||||
for n, r in enumerate(data["rows"], 1):
|
||||
get = lambda k: (str(r.get(h[k])).strip() if h[k] and r.get(h[k]) is not None else None) # noqa: E731
|
||||
flags = ["outcome only (register): the same run may also be in the spreadsheet"]
|
||||
colour = (get("colour") or "").title() or None
|
||||
if colour not in values["outcome_color"]:
|
||||
flags.append("colour not recognised")
|
||||
colour = None
|
||||
tail = (get("tail") or "").replace(" ", "").capitalize() or None
|
||||
row = blank_row(run_id=f"register-{n}", source=spec["run_source"], date=(get("when") or "")[:10] or None,
|
||||
outcome="Bonded", outcome_color=colour, tail=tail if tail in values["tail"] else None)
|
||||
for c in ("wing", "section", "squad"):
|
||||
if get(c) and (not values[c] or get(c) in values[c]): # section is free text in the dictionary
|
||||
row[c] = get(c)
|
||||
encounter_columns(row)
|
||||
row["data_flags"] = "; ".join(flags)
|
||||
rows.append(row)
|
||||
return rows
|
||||
|
||||
|
||||
def reports(name, spec):
|
||||
"""Runs reported through the "Report a run" issue form (collection/specs/report_form.yaml)."""
|
||||
form = report_form.spec()
|
||||
fields = {f["id"]: f for f in form["fields"]}
|
||||
p = path(spec["load"])
|
||||
data = json.loads(p.read_text(encoding="utf-8")) if p.exists() else {"reports": []}
|
||||
rows = []
|
||||
for rep in data["reports"]:
|
||||
vals, flags = {}, []
|
||||
for fid, answer in rep["answers"].items():
|
||||
f = fields.get(fid)
|
||||
if not f:
|
||||
continue
|
||||
if f.get("type") == "integer":
|
||||
m = re.search(r"\d+", answer)
|
||||
vals[f["column"]] = int(m.group()) if m else None
|
||||
elif answer in f["options"]:
|
||||
vals[f["column"]] = f["options"][answer]
|
||||
else:
|
||||
flags.append(f"unrecognised answer to {fid}")
|
||||
row = blank_row(run_id=f"reported-{rep['number']}", source=spec["run_source"], date=rep.get("opened"), **vals)
|
||||
row["attempt_group"] = attempt_group(row["attempt"])
|
||||
if row["outcome"] == "Died before the hour" and row["hour"] == "Unknown":
|
||||
row["hour"] = "DIED before the hour"
|
||||
branch = row["branch"]
|
||||
if branch:
|
||||
tree = branch in ("Shadow (rare)", "Descend quickly: Red", "Descend quickly: let the Red pass", "Descend slowly: two Greens")
|
||||
if row["hour"] == "Unknown":
|
||||
row["hour"] = "Tree" if tree else "Valley"
|
||||
elif row["hour"] != ("Tree" if tree else "Valley"):
|
||||
flags.append("encounter does not match the tree/valley answer")
|
||||
row["saw_shadow"] = branch == "Shadow (rare)" if tree else None
|
||||
if branch == "Passed the Red: meadow" and row["outcome_color"] == "Blue":
|
||||
row["saw_blue_meadow"] = True
|
||||
if row["outcome"] == "Bonded" and not row["outcome_color"]:
|
||||
flags.append("bonded, colour not given")
|
||||
encounter_columns(row)
|
||||
row["data_flags"] = "; ".join(flags)
|
||||
rows.append(row)
|
||||
return rows
|
||||
|
||||
|
||||
def _norm(text):
|
||||
from .transform.bot import normalize
|
||||
return normalize(text)
|
||||
|
||||
|
||||
def bot_trajectories(spec):
|
||||
"""Every published trajectory (data/bot/trajectories-*.jsonl), each attempt once."""
|
||||
seen, out = set(), []
|
||||
for f in sorted(Path(path(spec["load"])).glob("trajectories-*.jsonl")):
|
||||
for t in read_jsonl(f):
|
||||
if t["id"] not in seen:
|
||||
seen.add(t["id"])
|
||||
out.append(t)
|
||||
return out
|
||||
|
||||
|
||||
def bot_variables(traj, crosswalk):
|
||||
"""A bot attempt -> columns, through the crosswalk in collection/specs/bot.yaml. First match wins."""
|
||||
v, unmapped = {}, []
|
||||
for s in played(traj["steps"]):
|
||||
t = _norm(s["optionText"])
|
||||
hit = next((c for c in crosswalk if c[0].search(t)), None)
|
||||
if hit:
|
||||
v.setdefault(hit[1], hit[2])
|
||||
else:
|
||||
unmapped.append(s["optionText"])
|
||||
# the first dragon is the first tinted scene once the direction is chosen
|
||||
if v.get("direction") and not v.get("first_sighting") and s.get("tint"):
|
||||
v["first_sighting"] = s["tint"].capitalize()
|
||||
return v, unmapped
|
||||
|
||||
|
||||
BURN_REASONS = { # why the bot chose to die, in words (the bot's own reason codes)
|
||||
"TREE_NO_SHADOW_AUTO_BURN": "no shadow at the tree",
|
||||
"MEADOW_NO_BLUE_AUTO_BURN": "no Blue in the meadow",
|
||||
}
|
||||
|
||||
|
||||
def played(steps):
|
||||
"""The steps that were actually played. The bot logs a pick it then overrode (its own rules against the atlas's
|
||||
advice) as a step whose `to` is not where the run went, followed by the pick it made on the same screen. Those
|
||||
superseded picks are dropped: counting them codes a run with choices it never made."""
|
||||
return [s for i, s in enumerate(steps)
|
||||
if not (i + 1 < len(steps) and steps[i + 1]["scene"] == s["scene"] and s.get("to") != steps[i + 1]["scene"])]
|
||||
|
||||
|
||||
def _seen_after(steps, start, key):
|
||||
"""Values the bot saw (step["seen"][key]) from step index `start` on."""
|
||||
out = []
|
||||
for st in steps[start:]:
|
||||
v = (st.get("seen") or {}).get(key)
|
||||
if v is not None:
|
||||
out += v if isinstance(v, list) else [v]
|
||||
return out
|
||||
|
||||
|
||||
def bot(name, spec):
|
||||
cw = [(re.compile(rx), col, val) for rx, col, val in read_yaml(spec["transform"]["spec"])["crosswalk"]]
|
||||
rows = []
|
||||
for traj in bot_trajectories(spec):
|
||||
traj = {**traj, "steps": played(traj["steps"])}
|
||||
steps = traj["steps"]
|
||||
v, _ = bot_variables(traj, cw)
|
||||
red = v.pop("red", None)
|
||||
v.pop("scream_investigate", None)
|
||||
if red == "Let it pass (two Greens)":
|
||||
v["branch"] = "Descend quickly: let the Red pass"
|
||||
o = traj["outcome"]
|
||||
meta = traj.get("meta") or {}
|
||||
flags = []
|
||||
if o["type"] == "BONDED":
|
||||
outcome, colour = "Bonded", (o.get("colour") or "").capitalize() or None
|
||||
elif o["type"] == "BURNED":
|
||||
last_tint = steps[-1].get("tint") if steps else None
|
||||
outcome = "Incinerated" if v.get("hour") else "Died before the hour"
|
||||
colour = last_tint.capitalize() if last_tint and v.get("hour") else None
|
||||
if o.get("intentional"):
|
||||
why = BURN_REASONS.get(o.get("reason") or "", "")
|
||||
flags.append("deliberate burn (the bot chose to die" + (f": {why}" if why else "") + ")")
|
||||
else: # ABORTED, ENDED_NO_BOND: the run stopped without an ending the bot saw
|
||||
outcome, colour = "No outcome recorded", None
|
||||
if not steps:
|
||||
flags.append("bonded dragon only (the bot logged no steps)")
|
||||
target = (meta.get("target") or "").capitalize() or None
|
||||
row = blank_row(run_id=traj["id"], source=spec["run_source"], bot_mode=meta.get("decisionMode"),
|
||||
date=(meta.get("startedAt") or "")[:10] or None, attempt=meta.get("attempt"),
|
||||
goal=target if target in COLOURS else None,
|
||||
outcome=outcome, outcome_color=colour, data_flags="; ".join(flags), **v)
|
||||
row["attempt_group"] = attempt_group(row["attempt"])
|
||||
if target: # the bot never bonds a dragon it was not sent for: it dies on purpose instead (Malek)
|
||||
row["malek_intent"] = "Yes"
|
||||
if outcome == "Died before the hour" and not o.get("intentional"): # where the game killed it
|
||||
if row["scream"] == "Unknown":
|
||||
row["scream"] = "DIED at first sighting"
|
||||
elif row["scream"] == "Investigate & help" and row["resolution"] == "Unknown":
|
||||
row["resolution"] = "DIED in combat"
|
||||
else:
|
||||
row["hour"] = "DIED before the hour"
|
||||
# what the bot saw: the shadow at the treetop, and which dragons waited in the meadow
|
||||
shadow = _seen_after(steps, 0, "shadow")
|
||||
if row["hour"] == "Tree" and shadow:
|
||||
row["saw_shadow"] = any(shadow)
|
||||
if row["branch"] == "Passed the Red: meadow":
|
||||
i = next((k for k, st in enumerate(steps) if re.search(r"no way this is your dragon", _norm(st["optionText"]))), len(steps))
|
||||
meadow = _seen_after(steps, i + 1, "dragons")
|
||||
if meadow or o.get("reason") == "MEADOW_NO_BLUE_AUTO_BURN":
|
||||
row["saw_blue_meadow"] = "blue" in meadow or colour == "Blue"
|
||||
encounter_columns(row, intentional=bool(o.get("intentional")))
|
||||
rows.append(row)
|
||||
return rows
|
||||
|
||||
|
||||
CODERS = {"spreadsheet": spreadsheet, "reddit_results": reddit_results, "reports": reports, "bot": bot, "register": register}
|
||||
|
||||
|
||||
def build_runs(pipe):
|
||||
rows = []
|
||||
for name in pipe["runs"]["order"]:
|
||||
spec = pipe["sources"][name]
|
||||
if spec.get("runs"):
|
||||
rows += CODERS[spec["runs"]](name, spec)
|
||||
return rows
|
||||
@@ -0,0 +1,7 @@
|
||||
"""Named transforms (pipeline.yaml `transform: {name: ...}`). Each module has
|
||||
transform(raw_path, spec, ctx) -> the public source file's content (pure: no network, no clock)
|
||||
describe(old, new) -> report lines comparing the previous public file with the new one
|
||||
"""
|
||||
from . import bot, pdf, reddit, reports, sheet
|
||||
|
||||
TRANSFORMS = {"sheet": sheet, "pdf_fingerprint": pdf, "bot": bot, "reddit_results": reddit, "reports": reports}
|
||||
@@ -0,0 +1,367 @@
|
||||
"""The DragonKind bot's private data -> anonymised trajectories and a scene catalogue (Python port of bot.js).
|
||||
|
||||
Raw input (from the private bot repo, packed by extract.local_dir): data/knowledge.json (scene atlas: prose,
|
||||
choices, tint, backdrop), data/runs.jsonl (one record per attempt) and logs/encounters.jsonl (every decision the
|
||||
bot made, with the options on screen). Nothing of the prose or the account ids leaves this module: the output
|
||||
holds scene fingerprints, short labels (collection/specs/bot.yaml), choice text and outcomes, and check_public()
|
||||
refuses anything else.
|
||||
|
||||
Output: {"scenes": {sceneId: {stage, tint, backdrop, label, options: [{id, text}]}},
|
||||
"trajectories": [{id, source, meta, steps, outcome}], "unlabeled": [...]}
|
||||
"""
|
||||
import hashlib
|
||||
import json
|
||||
import re
|
||||
from datetime import datetime
|
||||
|
||||
from ..common import read_yaml
|
||||
|
||||
SPEC = read_yaml("collection/specs/bot.yaml")
|
||||
_NORMALIZE = [(re.compile(a), b) for a, b in SPEC["normalize"]]
|
||||
CHOICE_EVENTS = set(SPEC["choice_events"])
|
||||
|
||||
|
||||
def sha1(s, n=12):
|
||||
return hashlib.sha1(str(s).encode("utf-8")).hexdigest()[:n]
|
||||
|
||||
|
||||
def normalize(text):
|
||||
"""Must match normalize() in the bot's src/strategy.js, so fingerprints line up."""
|
||||
t = str(text or "").lower()
|
||||
for rx, rep in _NORMALIZE:
|
||||
t = rx.sub(rep, t)
|
||||
return t.strip()
|
||||
|
||||
|
||||
def scene_id(prose, choices):
|
||||
"""Must match computeSceneFingerprint() in the bot's src/learner.js."""
|
||||
prose_norm = normalize(prose)[:500]
|
||||
opts = sorted(c for c in (normalize(c) for c in choices) if c)
|
||||
return sha1(f"{prose_norm} ### {' || '.join(opts)}")
|
||||
|
||||
|
||||
def option_id(text):
|
||||
return sha1(normalize(text), 10)
|
||||
|
||||
|
||||
def label_for(sid, node):
|
||||
if sid in SPEC["labels"]:
|
||||
return SPEC["labels"][sid]
|
||||
bits = [node.get("stage") or "Scene"]
|
||||
if node.get("tint"):
|
||||
bits.append(node["tint"])
|
||||
return " · ".join(bits)
|
||||
|
||||
|
||||
def _jsonl(text):
|
||||
out = []
|
||||
for line in (text or "").splitlines():
|
||||
if line.strip():
|
||||
try:
|
||||
out.append(json.loads(line))
|
||||
except json.JSONDecodeError:
|
||||
pass
|
||||
return out
|
||||
|
||||
|
||||
def build_scenes(knowledge, encounters):
|
||||
scenes = {}
|
||||
for sid, n in ((knowledge or {}).get("nodes") or {}).items():
|
||||
scenes[sid] = {
|
||||
"stage": n.get("stage") or "UNKNOWN", "tint": n.get("tint"), "backdrop": n.get("backdrop"),
|
||||
"label": label_for(sid, n),
|
||||
"options": [{"id": option_id(c.get("label") or c.get("choiceNorm")), "text": c.get("label") or c.get("choiceNorm")}
|
||||
for c in (n.get("choices") or {}).values()],
|
||||
}
|
||||
for e in encounters:
|
||||
if not isinstance(e.get("choices"), list) or not e.get("prose"):
|
||||
continue
|
||||
sid = e.get("nodeId") or scene_id(e["prose"], e["choices"])
|
||||
if sid in scenes:
|
||||
continue
|
||||
stage = (e.get("decision") or {}).get("stage") or e.get("stage") or "UNKNOWN"
|
||||
scenes[sid] = {"stage": stage, "tint": None, "backdrop": None, "label": label_for(sid, {"stage": stage}),
|
||||
"options": [{"id": option_id(t), "text": t} for t in e["choices"]]}
|
||||
return scenes
|
||||
|
||||
|
||||
def trajectories_from_encounters(encounters, scenes):
|
||||
"""Group the log by attempt, keep the decisions acted on, and close each attempt at its first BURNED or
|
||||
DRAGON_BONDED event. Repeated BURNED events with no decision between them are ignored."""
|
||||
by_attempt = {}
|
||||
for e in encounters:
|
||||
key = f"{e['account']}:{e.get('attempt')}" if e.get("account") else str(e.get("attempt"))
|
||||
by_attempt.setdefault(key, []).append(e)
|
||||
out = []
|
||||
for key, events in by_attempt.items():
|
||||
events = sorted(events, key=lambda e: str(e.get("ts")))
|
||||
steps, outcome = [], None
|
||||
for e in events:
|
||||
if outcome:
|
||||
break
|
||||
if e.get("event") in CHOICE_EVENTS:
|
||||
d = e.get("decision") or {}
|
||||
text = d.get("choiceText") or e.get("choiceText")
|
||||
if d.get("action") and d["action"] != "choose":
|
||||
continue # paused, nothing happened
|
||||
if not text or not isinstance(e.get("choices"), list):
|
||||
continue
|
||||
scene = e.get("nodeId") or scene_id(e.get("prose") or "", e["choices"])
|
||||
manual = e["event"] != "DECISION"
|
||||
sc = scenes.get(scene) or {}
|
||||
steps.append({
|
||||
"scene": scene, "stage": d.get("stage") or sc.get("stage") or "UNKNOWN", "tint": sc.get("tint"),
|
||||
"option": option_id(text), "optionText": text, "offered": [option_id(c) for c in e["choices"]],
|
||||
"rule": d.get("rule"), "decisionMode": "manual" if manual else d.get("source"),
|
||||
"manual": manual, "at": e.get("ts"),
|
||||
})
|
||||
elif e.get("event") == "BURNED" and steps:
|
||||
outcome = {"type": "BURNED", "colour": None, "intentional": bool(e.get("intentional"))}
|
||||
elif e.get("event") == "DRAGON_BONDED" and steps:
|
||||
outcome = {"type": "BONDED", "colour": str(e["dragon"]).lower() if e.get("dragon") else None, "intentional": False}
|
||||
# a decision repeated on the same scene (the bot re-detecting the screen) counts once
|
||||
dedup = [s for i, s in enumerate(steps)
|
||||
if not (i > 0 and steps[i - 1]["scene"] == s["scene"] and steps[i - 1]["option"] == s["option"])]
|
||||
for i, s in enumerate(dedup):
|
||||
s["to"] = dedup[i + 1]["scene"] if i + 1 < len(dedup) else None
|
||||
if not dedup:
|
||||
continue
|
||||
if outcome:
|
||||
dedup[-1]["to"] = "BURNED" if outcome["type"] == "BURNED" else f"BONDED:{outcome['colour'] or 'unknown'}"
|
||||
try:
|
||||
attempt = int(float(key.split(":")[-1])) or None
|
||||
except ValueError:
|
||||
attempt = None
|
||||
started = dedup[0]["at"]
|
||||
out.append({
|
||||
"id": "bot-" + sha1(f"{key}:{started}", 10),
|
||||
"source": "bot",
|
||||
"meta": {"attempt": attempt, "startedAt": dedup[0]["at"], "accountKey": None, "target": None, "decisionMode": None},
|
||||
"steps": dedup,
|
||||
"outcome": outcome or {"type": "ABORTED", "colour": None, "intentional": False},
|
||||
})
|
||||
return out
|
||||
|
||||
|
||||
def _ms(ts):
|
||||
try:
|
||||
return datetime.fromisoformat(str(ts).replace("Z", "+00:00")).timestamp() * 1000
|
||||
except ValueError:
|
||||
return float("nan")
|
||||
|
||||
|
||||
def attach_run_meta(trajs, runs, salt):
|
||||
"""Run-level metadata (target colour, mode) from runs.jsonl, where an attempt is in both."""
|
||||
window = SPEC["match_hours"] * 3600e3
|
||||
for r in runs:
|
||||
t = next((x for x in trajs if x["meta"]["attempt"] == r.get("attempt")
|
||||
and abs(_ms(x["meta"]["startedAt"]) - _ms(r.get("startedAt"))) < window), None)
|
||||
if not t:
|
||||
continue
|
||||
m = t["meta"]
|
||||
m["target"] = r.get("targetDragon")
|
||||
m["decisionMode"] = r.get("decisionMode")
|
||||
m["policyId"] = r.get("policyId")
|
||||
m["experimentId"] = r.get("experimentId")
|
||||
m["arm"] = r.get("arm")
|
||||
if r.get("accountKey"):
|
||||
m["accountKey"] = r["accountKey"]
|
||||
elif r.get("accountId") and salt:
|
||||
m["accountKey"] = sha1(f"{salt}:{r['accountId']}", 10)
|
||||
if r.get("outcome") == "BONDED" and r.get("dragonColor"):
|
||||
t["outcome"] = {"type": "BONDED", "colour": str(r["dragonColor"]).lower(), "intentional": False}
|
||||
if r.get("intentionalBurn"):
|
||||
t["outcome"]["intentional"] = True
|
||||
return trajs
|
||||
|
||||
|
||||
def import_bot(knowledge, encounters, runs, salt=None):
|
||||
scenes = build_scenes(knowledge, encounters)
|
||||
trajectories = attach_run_meta(trajectories_from_encounters(encounters, scenes), runs, salt)
|
||||
unlabeled = [f"{sid} ({s['stage']}{', ' + s['tint'] if s['tint'] else ''})" for sid, s in scenes.items() if sid not in SPEC["labels"]]
|
||||
return scenes, trajectories, unlabeled
|
||||
|
||||
|
||||
def check_public(obj, refuse, max_string):
|
||||
"""Nothing that looks like game prose or an account identifier may leave this module."""
|
||||
def walk(v, p):
|
||||
if isinstance(v, list):
|
||||
for i, x in enumerate(v):
|
||||
walk(x, f"{p}[{i}]")
|
||||
elif isinstance(v, dict):
|
||||
for k, x in v.items():
|
||||
if k in refuse:
|
||||
raise ValueError(f'refusing to export field "{k}" at {p}')
|
||||
walk(x, f"{p}.{k}")
|
||||
elif isinstance(v, str) and len(v) > max_string:
|
||||
raise ValueError(f"refusing to export a {len(v)}-character string at {p} (looks like prose)")
|
||||
walk(obj, "$")
|
||||
|
||||
|
||||
def merge_scenes(existing, scenes):
|
||||
"""Add new scenes and new options to the published catalogue; never drop what is already there."""
|
||||
out = json.loads(json.dumps(existing or {}))
|
||||
for sid, s in scenes.items():
|
||||
old = out.get(sid)
|
||||
if not old:
|
||||
out[sid] = s
|
||||
continue
|
||||
ids = {o["id"] for o in old["options"]}
|
||||
old["options"] += [o for o in s["options"] if o["id"] not in ids]
|
||||
old["tint"] = old.get("tint") or s["tint"]
|
||||
old["backdrop"] = old.get("backdrop") or s["backdrop"]
|
||||
if "·" in old["label"] and "·" not in s["label"]:
|
||||
old["label"] = s["label"]
|
||||
return dict(sorted(out.items()))
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- run records with steps (the bot's schema 2)
|
||||
|
||||
def _to(key):
|
||||
"""The bot's toKey -> ours: a scene id, BURNED or BONDED:<colour>."""
|
||||
key = str(key or "")
|
||||
if key == "TERMINAL:BURNED":
|
||||
return "BURNED"
|
||||
if key.startswith("TERMINAL:BONDED"):
|
||||
return "BONDED:" + (key.split("_", 1)[1].lower() if "_" in key else "unknown")
|
||||
return key or None
|
||||
|
||||
|
||||
def _seen(observed):
|
||||
"""What the bot saw on a screen that the route model needs: the dragons (from the tint) and the shadow."""
|
||||
o = observed or {}
|
||||
out = {}
|
||||
if o.get("dragons"):
|
||||
out["dragons"] = [str(d).lower() for d in o["dragons"]]
|
||||
if "shadow" in o:
|
||||
out["shadow"] = bool(o["shadow"])
|
||||
return out
|
||||
|
||||
|
||||
def trajectory_from_run(r, account_key):
|
||||
"""A run record that carries its own steps -> a trajectory. Nothing but choice text, ids and outcomes is kept."""
|
||||
steps = []
|
||||
for st in r.get("steps") or []:
|
||||
text = st.get("choiceText") or st.get("choiceNorm")
|
||||
if not text:
|
||||
continue
|
||||
steps.append({
|
||||
"scene": st.get("nodeId"), "stage": st.get("stage") or "UNKNOWN", "tint": st.get("tint"),
|
||||
"option": option_id(text), "optionText": text,
|
||||
"offered": [option_id(o.get("text") or o.get("norm")) for o in st.get("offered") or [] if o.get("text") or o.get("norm")],
|
||||
"rule": st.get("rule"), "decisionMode": "manual" if st.get("manual") else st.get("decisionMode"),
|
||||
"manual": bool(st.get("manual")), "at": st.get("at"), "seen": _seen(st.get("observed")),
|
||||
"propensity": st.get("propensity"), "to": _to(st.get("toKey")),
|
||||
})
|
||||
colour = str(r["dragonColor"]).lower() if r.get("dragonColor") else None
|
||||
return {
|
||||
"id": "bot-" + sha1(r["runId"], 10),
|
||||
"source": "bot",
|
||||
"meta": {"attempt": r.get("accountAttempt") or r.get("attempt"), "startedAt": r.get("startedAt"),
|
||||
"accountKey": account_key, "accountRole": r.get("accountRole"), "target": r.get("targetDragon"),
|
||||
"decisionMode": r.get("decisionMode"), "policyId": r.get("policyId"),
|
||||
"experimentId": r.get("experimentId"), "arm": r.get("arm")},
|
||||
"steps": steps,
|
||||
"outcome": {"type": r.get("outcome") or "ABORTED", "colour": colour, "intentional": bool(r.get("intentionalBurn")),
|
||||
"reason": (r.get("burn") or {}).get("reason")},
|
||||
}
|
||||
|
||||
|
||||
def _account_files(files):
|
||||
"""{account: {"runs": [...], "encounters": [...]}} from the packed files. The top-level files are the bot's
|
||||
original single account; data/accounts/<name>/ and logs/accounts/<name>/ hold one account each."""
|
||||
out = {}
|
||||
for rel, text in files.items():
|
||||
if text is None:
|
||||
continue
|
||||
parts = rel.split("/")
|
||||
acct = parts[2] if len(parts) == 4 and parts[1] == "accounts" else "(default)"
|
||||
kind = "runs" if rel.endswith("runs.jsonl") else "encounters" if rel.endswith("encounters.jsonl") else None
|
||||
if kind:
|
||||
out.setdefault(acct, {"runs": [], "encounters": []})[kind] += _jsonl(text)
|
||||
# since the bot keeps one folder per account, its top-level files mirror its first account (the same runs,
|
||||
# logged a moment apart): counting both would count those runs twice
|
||||
if len(out) > 1:
|
||||
out.pop("(default)", None)
|
||||
return out
|
||||
|
||||
|
||||
def account_salt(env, privacy):
|
||||
"""The salt that turns account names into anonymous keys: the environment variable if set, otherwise one made
|
||||
once and kept in the private raw store (data/raw/bot/account-salt.txt, never committed)."""
|
||||
salt = env.get(privacy.get("account_salt_env", ""))
|
||||
if salt:
|
||||
return salt
|
||||
from ..common import path
|
||||
import secrets
|
||||
p = path("data/raw/bot/account-salt.txt")
|
||||
if not p.exists():
|
||||
p.parent.mkdir(parents=True, exist_ok=True)
|
||||
p.write_text(secrets.token_hex(16), encoding="utf-8")
|
||||
return p.read_text(encoding="utf-8").strip()
|
||||
|
||||
|
||||
def transform(raw_path, spec, ctx):
|
||||
with open(raw_path, encoding="utf-8") as f:
|
||||
files = json.load(f)
|
||||
k = files.get("data/knowledge.json")
|
||||
knowledge = json.loads(k) if k else {"nodes": {}}
|
||||
privacy = spec.get("privacy") or {}
|
||||
salt = account_salt(ctx.get("env", {}), privacy)
|
||||
accounts = _account_files(files)
|
||||
all_encounters = [e for a in accounts.values() for e in a["encounters"]]
|
||||
scenes = build_scenes(knowledge, all_encounters)
|
||||
trajectories, seen_ids = [], set()
|
||||
for acct, data in sorted(accounts.items()):
|
||||
key = sha1(f"{salt}:{acct}", 10)
|
||||
with_steps = [r for r in data["runs"] if r.get("steps") and r.get("runId")]
|
||||
for r in with_steps:
|
||||
t = trajectory_from_run(r, key)
|
||||
if t["id"] not in seen_ids:
|
||||
seen_ids.add(t["id"])
|
||||
trajectories.append(t)
|
||||
# older runs without steps: rebuild them from the decision log, as before
|
||||
legacy = [r for r in data["runs"] if not r.get("steps")]
|
||||
window = SPEC["match_hours"] * 3600e3
|
||||
same_run = lambda t, r: (t["meta"]["attempt"] == (r.get("accountAttempt") or r.get("attempt")) # noqa: E731
|
||||
and abs(_ms(t["meta"]["startedAt"]) - _ms(r.get("startedAt"))) < window)
|
||||
old = attach_run_meta(trajectories_from_encounters(data["encounters"], scenes), legacy, salt)
|
||||
kept = []
|
||||
for t in old: # the decision log also holds the runs that have steps: keep only the others
|
||||
if any(same_run(t, r) for r in with_steps) or t["id"] in seen_ids:
|
||||
continue
|
||||
t["meta"]["accountKey"] = key
|
||||
seen_ids.add(t["id"])
|
||||
trajectories.append(t)
|
||||
kept.append(t)
|
||||
# bonded runs logged without any steps still say which dragon was bonded
|
||||
for r in legacy:
|
||||
if r.get("outcome") == "BONDED" and r.get("runId") and not any(same_run(t, r) for t in kept):
|
||||
t = trajectory_from_run({**r, "steps": []}, key)
|
||||
if t["id"] not in seen_ids:
|
||||
seen_ids.add(t["id"])
|
||||
trajectories.append(t)
|
||||
# scenes the run records show but the knowledge file does not have yet
|
||||
for t in trajectories:
|
||||
for st in t["steps"]:
|
||||
if st["scene"] and st["scene"] not in scenes:
|
||||
scenes[st["scene"]] = {"stage": st["stage"], "tint": st["tint"], "backdrop": None,
|
||||
"label": label_for(st["scene"], {"stage": st["stage"], "tint": st["tint"]}), "options": []}
|
||||
sc = scenes.get(st["scene"])
|
||||
if sc is not None and st["option"] not in {o["id"] for o in sc["options"]}:
|
||||
sc["options"].append({"id": st["option"], "text": st["optionText"]})
|
||||
unlabeled = [f"{sid} ({s['stage']}{', ' + s['tint'] if s['tint'] else ''})" for sid, s in scenes.items() if sid not in SPEC["labels"]]
|
||||
for obj in (scenes, trajectories):
|
||||
check_public(obj, set(privacy.get("refuse_fields", [])), privacy.get("max_string", 200))
|
||||
trajectories.sort(key=lambda t: (str(t["meta"].get("startedAt")), t["id"]))
|
||||
return {"scenes": scenes, "trajectories": trajectories, "_unlabeled": unlabeled}
|
||||
|
||||
|
||||
def describe(old, new):
|
||||
outcomes = {}
|
||||
for t in new["trajectories"]:
|
||||
outcomes[t["outcome"]["type"]] = outcomes.get(t["outcome"]["type"], 0) + 1
|
||||
lines = [f"{len(new['scenes'])} scenes, {len(new['trajectories'])} attempts {json.dumps(outcomes)}"]
|
||||
if new.get("_unlabeled"):
|
||||
lines.append(" - Scenes without a short label (add them to collection/specs/bot.yaml): " + ", ".join(new["_unlabeled"]))
|
||||
return lines
|
||||
@@ -0,0 +1,51 @@
|
||||
"""The route PDF -> its fingerprint only. The PDF is never redistributed: the public file holds hashes of the file,
|
||||
of each page's text and of each line, so a change can be detected and located without keeping the text."""
|
||||
import hashlib
|
||||
|
||||
|
||||
def _sha(text, n):
|
||||
return hashlib.sha256(text.encode("utf-8")).hexdigest()[:n]
|
||||
|
||||
|
||||
def pdf_lines(path):
|
||||
from pypdf import PdfReader
|
||||
pages = []
|
||||
for page in PdfReader(str(path)).pages:
|
||||
text = page.extract_text() or ""
|
||||
pages.append([" ".join(line.split()) for line in text.splitlines() if line.strip()])
|
||||
return pages
|
||||
|
||||
|
||||
def transform(raw_path, spec, ctx):
|
||||
with open(raw_path, "rb") as f:
|
||||
data = f.read()
|
||||
pages = pdf_lines(raw_path)
|
||||
return {
|
||||
"sha256": hashlib.sha256(data).hexdigest(),
|
||||
"bytes": len(data),
|
||||
"pages": len(pages),
|
||||
"page_hashes": [_sha("\n".join(p), 16) for p in pages],
|
||||
"line_hashes": sorted({_sha(line.lower(), 12) for p in pages for line in p}),
|
||||
"checked": ctx.get("changed"),
|
||||
# transient: the new lines' text, for the report only (load drops every key starting with "_")
|
||||
"_lines": [line for p in pages for line in p],
|
||||
}
|
||||
|
||||
|
||||
def describe(old, new):
|
||||
if old is None:
|
||||
return [f"fingerprint recorded for the first time ({new['pages']} pages)"]
|
||||
if old.get("page_hashes") == new["page_hashes"]:
|
||||
return ["the file changed but its text did not (layout or images only). Worth a look."]
|
||||
changed = [i + 1 for i, h in enumerate(new["page_hashes"])
|
||||
if i >= len(old["page_hashes"]) or old["page_hashes"][i] != h]
|
||||
old_lines = set(old["line_hashes"])
|
||||
new_lines = [line for line in new.get("_lines", []) if _sha(line.lower(), 12) not in old_lines]
|
||||
lines = [f"changed. {old['pages']} → {new['pages']} pages; pages with new text: {', '.join(map(str, changed)) or 'none'}; "
|
||||
f"{len(new_lines)} new lines, {len(old_lines - set(new['line_hashes']))} lines gone."]
|
||||
if new_lines:
|
||||
lines.append(" - New lines (update core/spec/game.yaml or the crosswalks if they add options):")
|
||||
lines += [f" - {line}" for line in new_lines[:60]]
|
||||
if len(new_lines) > 60:
|
||||
lines.append(f" - … and {len(new_lines) - 60} more")
|
||||
return lines
|
||||
@@ -0,0 +1,45 @@
|
||||
"""Reddit megathreads (raw: the threads' comment trees from the official API) -> dragonkind.com result links that
|
||||
are not yet in collection/manual/reddit_results.yaml. Usernames and comment text are never kept: only the result
|
||||
ids and the comment permalinks, for the report, so a person can read the result page and add it by hand."""
|
||||
import json
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
from ..common import read_yaml
|
||||
|
||||
RESULT_RE = re.compile(r"dragonkind\.com/results/(THRESH-[A-Z0-9]+)", re.I)
|
||||
|
||||
|
||||
def _comments(node):
|
||||
"""Every comment in a listing tree."""
|
||||
if isinstance(node, list):
|
||||
for x in node:
|
||||
yield from _comments(x)
|
||||
elif isinstance(node, dict):
|
||||
data = node.get("data") or {}
|
||||
if node.get("kind") in ("t1", "t3"):
|
||||
yield data
|
||||
for key in ("children", "replies"):
|
||||
if isinstance(data.get(key), (dict, list)):
|
||||
yield from _comments(data[key])
|
||||
|
||||
|
||||
def transform(raw_path, spec, ctx):
|
||||
threads = json.loads(Path(raw_path).read_text(encoding="utf-8"))
|
||||
known = {r["id"].upper() for r in read_yaml(spec["transform"]["manual"])["results"]}
|
||||
found = {}
|
||||
for tid, tree in sorted(threads.items()):
|
||||
for c in _comments(tree):
|
||||
for m in RESULT_RE.finditer((c.get("body") or "") + " " + (c.get("selftext") or "") + " " + (c.get("url") or "")):
|
||||
rid = m.group(1).upper()
|
||||
if rid not in known and rid not in found:
|
||||
found[rid] = "https://www.reddit.com" + (c.get("permalink") or f"/comments/{tid}/")
|
||||
return {"new_results": [{"id": k, "comment": v} for k, v in sorted(found.items())]}
|
||||
|
||||
|
||||
def describe(old, new):
|
||||
rs = new["new_results"]
|
||||
if not rs:
|
||||
return ["no new result links in the threads"]
|
||||
return [f"{len(rs)} result link(s) not yet in collection/manual/reddit_results.yaml (read each page, then add it):"] + \
|
||||
[f" - https://dragonkind.com/results/{r['id']} (posted at {r['comment']})" for r in rs[:40]]
|
||||
@@ -0,0 +1,31 @@
|
||||
"""Run reports (raw: the "run report" issues from the GitHub API) -> data/public/reports.json.
|
||||
|
||||
Kept per report: the issue number, the date it was opened, and the answers (the option labels chosen). GitHub
|
||||
usernames and any other text are dropped. Reports closed as "not planned" or carrying a reject label (e.g.
|
||||
invalid, duplicate) are left out, so a maintainer removes a bad report by closing it that way."""
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from .. import report_form
|
||||
|
||||
|
||||
def transform(raw_path, spec, ctx):
|
||||
issues = json.loads(Path(raw_path).read_text(encoding="utf-8"))
|
||||
reject = set(spec["transform"].get("reject_labels", []))
|
||||
form = report_form.spec()
|
||||
reports = []
|
||||
for i in sorted(issues, key=lambda i: i["number"]):
|
||||
labels = {lb["name"] if isinstance(lb, dict) else lb for lb in i.get("labels") or []}
|
||||
if labels & reject or i.get("state_reason") == "not_planned":
|
||||
continue
|
||||
answers = report_form.parse_body(i.get("body"), form)
|
||||
if not answers:
|
||||
continue
|
||||
reports.append({"number": i["number"], "opened": (i.get("created_at") or "")[:10] or None, "answers": answers})
|
||||
return {"source": spec["label"], "reports": reports}
|
||||
|
||||
|
||||
def describe(old, new):
|
||||
o = {r["number"] for r in (old or {}).get("reports", [])}
|
||||
n = {r["number"] for r in new["reports"]}
|
||||
return [f"{len(n)} report(s) ({len(n - o)} new, {len(o - n)} removed)"]
|
||||
@@ -0,0 +1,75 @@
|
||||
"""A Google Sheets export (.xlsx or .csv) -> the public source file: the sheet's own questions and answers, with the
|
||||
source's privacy rules applied. No recoding happens here (that is core/atlas/coding.py, at build time)."""
|
||||
import re
|
||||
from datetime import datetime
|
||||
|
||||
import pandas as pd
|
||||
|
||||
from ..common import read_yaml
|
||||
|
||||
EMAIL_RE = re.compile(r"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}")
|
||||
|
||||
|
||||
def load_sheet(path, sheet_contains="form responses"):
|
||||
if str(path).lower().endswith(".csv"):
|
||||
return pd.read_csv(path)
|
||||
xl = pd.ExcelFile(path)
|
||||
sheet = next((n for n in xl.sheet_names if sheet_contains in n.lower()), xl.sheet_names[0])
|
||||
return pd.read_excel(xl, sheet)
|
||||
|
||||
|
||||
def cell(v, redact=True):
|
||||
if v is None or v is pd.NaT or (not isinstance(v, str) and pd.isna(v)):
|
||||
return None
|
||||
if isinstance(v, (datetime, pd.Timestamp)):
|
||||
return pd.Timestamp(v).strftime("%Y-%m-%d %H:%M:%S")
|
||||
if isinstance(v, float) and v.is_integer():
|
||||
return int(v)
|
||||
if isinstance(v, str) and redact:
|
||||
return EMAIL_RE.sub("[email removed]", v) # respondents sometimes leave an email in free text
|
||||
return v
|
||||
|
||||
|
||||
def extra_results(manual):
|
||||
"""Dragons read from result pages linked on Reddit (collection/manual/reddit_results.yaml)."""
|
||||
return [{"source": "dragonkind.com result page linked on Reddit", "url": f"https://dragonkind.com/results/{r['id']}",
|
||||
"name": r["name"], "colour": r["colour"], "tail": r["tail"], "sex": r["sex"], "age": r["age"],
|
||||
"lineage": r["lineage"]} for r in read_yaml(manual)["results"]]
|
||||
|
||||
|
||||
def transform(raw_path, spec, ctx):
|
||||
t, privacy = spec["transform"], spec.get("privacy") or {}
|
||||
raw = load_sheet(raw_path, t.get("sheet_contains", "form responses"))
|
||||
drop = [d.lower() for d in privacy.get("drop_columns_matching", [])]
|
||||
raw = raw[[c for c in raw.columns if not any(d in str(c).lower() for d in drop)]]
|
||||
redact = privacy.get("redact_emails", True)
|
||||
rows = []
|
||||
for _, r in raw.iterrows():
|
||||
row = {}
|
||||
for k, v in r.items():
|
||||
c = cell(v, redact)
|
||||
if c is not None:
|
||||
row[str(k)] = c
|
||||
rows.append(row)
|
||||
out = {"source": spec["label"], "exported": ctx.get("changed"),
|
||||
# every header, even one blank in every row, so the coding rules see every question
|
||||
"headers": [str(c) for c in raw.columns], "rows": rows}
|
||||
if t.get("extra"):
|
||||
out["extra"] = extra_results(t["extra"])
|
||||
return out
|
||||
|
||||
|
||||
def describe(old, new):
|
||||
"""One report line (plus details) comparing the previous public file with the new one."""
|
||||
if old is None:
|
||||
return [f"first export: {len(new['rows'])} rows"]
|
||||
key = lambda r: repr(sorted(r.items())) # noqa: E731
|
||||
o, n = {key(r) for r in old["rows"]}, {key(r) for r in new["rows"]}
|
||||
lines = [f"{len(old['rows'])} → {len(new['rows'])} rows ({len(n - o)} new or edited, {len(o - n)} removed or edited)"]
|
||||
new_q = [h for h in new["headers"] if h not in old["headers"]]
|
||||
gone_q = [h for h in old["headers"] if h not in new["headers"]]
|
||||
if new_q:
|
||||
lines.append(f" - New questions (add them to `core/spec/form.yaml`): {', '.join(new_q)}")
|
||||
if gone_q:
|
||||
lines.append(f" - Questions no longer in the sheet: {', '.join(gone_q)}")
|
||||
return lines
|
||||
@@ -0,0 +1,44 @@
|
||||
"""Validate: a table is checked against data/dictionary.yaml before it is loaded. A failure stops the load."""
|
||||
import re
|
||||
|
||||
CHECKS = {
|
||||
"integer": lambda v: isinstance(v, int) and not isinstance(v, bool) or bool(re.fullmatch(r"-?\d+", str(v))),
|
||||
"boolean": lambda v: isinstance(v, bool) or v in ("True", "False"),
|
||||
"date": lambda v: bool(re.fullmatch(r"\d{4}-\d{2}-\d{2}", str(v))),
|
||||
"text": lambda v: isinstance(v, str),
|
||||
}
|
||||
|
||||
|
||||
class Invalid(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def problems(rows, dictionary, header=None):
|
||||
"""Every way the rows break the dictionary, as readable lines (empty when the table is valid)."""
|
||||
cols = dictionary["columns"]
|
||||
out = []
|
||||
if header is not None and list(header) != list(cols):
|
||||
out.append(f"columns differ from the dictionary: {list(header)} vs {list(cols)}")
|
||||
ids = [r.get("run_id") for r in rows]
|
||||
if len(set(ids)) != len(ids):
|
||||
out.append("run_id is not unique")
|
||||
for name, col in cols.items():
|
||||
vals = [r.get(name) for r in rows]
|
||||
present = [v for v in vals if v is not None and v != ""]
|
||||
bad_type = sorted({str(v) for v in present if not CHECKS[col["type"]](v)})
|
||||
if bad_type:
|
||||
out.append(f"{name}: not {col['type']}: {bad_type[:5]}")
|
||||
if "values" in col:
|
||||
allowed = {str(v) for v in col["values"]}
|
||||
bad = sorted({str(v) for v in present if str(v) not in allowed})
|
||||
if bad:
|
||||
out.append(f"{name}: values not in the dictionary: {bad[:10]}")
|
||||
if col.get("required") and len(present) != len(vals):
|
||||
out.append(f"{name}: required, but {len(vals) - len(present)} rows are empty")
|
||||
return out
|
||||
|
||||
|
||||
def check(rows, dictionary, what="table"):
|
||||
errs = problems(rows, dictionary)
|
||||
if errs:
|
||||
raise Invalid(f"{what} does not match data/dictionary.yaml:\n " + "\n ".join(errs))
|
||||
@@ -0,0 +1,19 @@
|
||||
# Dragons from dragonkind.com result pages that riders linked in the r/fourthwing megathreads, read by hand.
|
||||
# Each is one run in runs_clean.csv (source "reddit thread": bonded, colour and tail known, route not recorded) and
|
||||
# appears under "extra" in data/public/register.json. The reddit_thread source lists result links found in the
|
||||
# threads that are not here yet; add them after reading the result page. No usernames are kept.
|
||||
version: 1
|
||||
read: "2026-10-19"
|
||||
results:
|
||||
- { id: THRESH-VFRQVM5K3B0CP, name: Thiduach, colour: Blue, tail: Swordtail, sex: Female, age: 51, lineage: Gormfaileas }
|
||||
- { id: THRESH-3M4P9MNFQGBS8, name: Caenuis, colour: Blue, tail: Swordtail, sex: Female, age: 38, lineage: Gormfaileas }
|
||||
- { id: THRESH-5JQDJ21G1BYKR, name: Oavuagh, colour: Green, tail: Morningstartail, sex: Female, age: 43, lineage: Uaineloidsig }
|
||||
- { id: THRESH-5KRAAVFB3D1MG, name: Geagios, colour: Blue, tail: Clubtail, sex: Male, age: 99, lineage: Gormfaileas }
|
||||
- { id: THRESH-B5HSM00J4A2Z4, name: Fiedheil, colour: Black, tail: Clubtail, sex: Male, age: 32, lineage: Moerlaighen }
|
||||
- { id: THRESH-BMPM2GAPK58JT, name: Teirfua, colour: Green, tail: Morningstartail, sex: Female, age: 68, lineage: Eifyrielle }
|
||||
- { id: THRESH-MCQ8D6GAGF4K8, name: Caollo, colour: Blue, tail: Morningstartail, sex: Female, age: 93, lineage: Nyghmuiron }
|
||||
- { id: THRESH-Q0XDBFMNBEB86, name: Aenminn, colour: Red, tail: Swordtail, sex: Male, age: 59, lineage: Berradhyr }
|
||||
- { id: THRESH-W99DB29MG16QA, name: Meinso, colour: Green, tail: Clubtail, sex: Female, age: 63, lineage: Eifyrielle }
|
||||
- { id: THRESH-XCJCY7HW7QSSP, name: Einmial, colour: Blue, tail: Clubtail, sex: Male, age: 58, lineage: Gormfaileas }
|
||||
- { id: THRESH-XR6G68VPGT48M, name: Recuagh, colour: Brown, tail: Morningstartail, sex: Female, age: 55, lineage: Vormalgh }
|
||||
- { id: THRESH-YQC97TK34214E, name: Dannidh, colour: Orange, tail: Clubtail, sex: Male, age: 61, lineage: Cariaslog }
|
||||
@@ -0,0 +1,99 @@
|
||||
# Data collection as extract -> transform -> load, one block per source. collection/run.py reads this file.
|
||||
#
|
||||
# extract fetches the source as it is now. The raw file goes to data/raw/<source>/current.<ext> (git-ignored,
|
||||
# never published); the version it replaces is kept as previous.<ext>, and the daily workflow keeps
|
||||
# that previous copy in an encrypted, private cache. Nothing older is kept.
|
||||
# transform turns the raw file into the public source file: a pure function of the raw file (no network, no
|
||||
# clock), with the source's privacy rules applied. Named transforms live in collection/etl/transform/.
|
||||
# load writes the public source file (byte-stable: same input, same bytes) and reports what changed.
|
||||
#
|
||||
# Then `build` codes every public source file into one run per row (runs: the coder) and writes
|
||||
# data/public/runs_clean.csv: every run from every source, with a `source` column. Each table is checked against
|
||||
# data/dictionary.yaml before it is written. Every input to `build` is committed, so CI can rebuild it exactly.
|
||||
version: 1
|
||||
|
||||
raw_dir: data/raw
|
||||
manifest: data/manifest.json # for each source: the sha256 of the current raw file and when it last changed
|
||||
|
||||
runs:
|
||||
path: data/public/runs_clean.csv
|
||||
# sources in this order; within a source, the order the coder returns
|
||||
order: [reddit_spreadsheet, reddit_thread, register, reported, bot, reddit_pdf]
|
||||
|
||||
sources:
|
||||
reddit_spreadsheet:
|
||||
label: Threshing Routes form and spreadsheet (u/ClumsyBadger, linked from the r/fourthwing megathreads)
|
||||
run_source: reddit spreadsheet
|
||||
links:
|
||||
sheet: https://docs.google.com/spreadsheets/d/1gnw1AdRg1XT4JsOfRM6QTA0jSaS3n9ZF-rPWnYewzv0
|
||||
form: https://forms.gle/DRpj9tG8gb5E4Hcu7 # the Threshing Routes Google Form the megathreads link to
|
||||
extract: { kind: http, url: "https://docs.google.com/spreadsheets/d/1gnw1AdRg1XT4JsOfRM6QTA0jSaS3n9ZF-rPWnYewzv0/export?format=xlsx", ext: xlsx }
|
||||
transform: { name: sheet, sheet_contains: form responses }
|
||||
privacy: { redact_emails: true }
|
||||
load: data/public/form_responses.json
|
||||
runs: spreadsheet # core/spec/form.yaml + core/atlas/coding.py
|
||||
|
||||
register:
|
||||
label: Unofficial Dragon Register (which dragon each rider bonded)
|
||||
run_source: register
|
||||
links: { sheet: https://docs.google.com/spreadsheets/d/1KMiE9sec0l597Pzue1OhGYf07NF4howtQ_lPeqx7jXQ }
|
||||
extract: { kind: http, url: "https://docs.google.com/spreadsheets/d/1KMiE9sec0l597Pzue1OhGYf07NF4howtQ_lPeqx7jXQ/export?format=xlsx", ext: xlsx }
|
||||
transform: { name: sheet, sheet_contains: form responses, extra: collection/manual/reddit_results.yaml }
|
||||
privacy: { redact_emails: true, drop_columns_matching: [photo, cadet name] } # no rider names, no photos
|
||||
load: data/public/register.json
|
||||
# bonded dragons without the route that led there: in the master list as outcome-only runs, flagged, because
|
||||
# a rider may have logged the same run in the community form (no analysis uses them: planner/policy.yaml and
|
||||
# analysis/stats/measures.yaml name their sources)
|
||||
runs: register
|
||||
|
||||
reddit_pdf:
|
||||
label: Community route PDF (u/ClumsyBadger)
|
||||
run_source: reddit pdf
|
||||
links: { view: https://drive.google.com/file/d/17o72ehHsSPW4UdsKF-sXTxMLEuinWeEg/view }
|
||||
extract: { kind: http, url: "https://drive.google.com/uc?export=download&id=17o72ehHsSPW4UdsKF-sXTxMLEuinWeEg", ext: pdf }
|
||||
transform: { name: pdf_fingerprint }
|
||||
privacy: { redistribute: false } # only hashes of the file, its pages and its lines are kept
|
||||
load: data/derived/pdf_fingerprint.json
|
||||
runs: null # a flowchart of the routes, not a log of runs (see collection/README.md)
|
||||
|
||||
reddit_thread:
|
||||
label: Runs posted in the r/fourthwing Dragonkind megathreads
|
||||
run_source: reddit thread
|
||||
links:
|
||||
part3: https://www.reddit.com/r/fourthwing/comments/1wvwfp9/
|
||||
part4: https://www.reddit.com/r/fourthwing/comments/1wz5cnj/
|
||||
# the official Reddit API (app-only OAuth); skipped with a note when the secrets are not set
|
||||
extract: { kind: reddit, threads: [1wvwfp9, 1wz5cnj], secrets: [REDDIT_CLIENT_ID, REDDIT_CLIENT_SECRET], ext: json }
|
||||
# lists dragonkind.com result links that are not in the manual file yet; usernames are never kept
|
||||
transform: { name: reddit_results, manual: collection/manual/reddit_results.yaml }
|
||||
load: null # the public source file is the hand-checked collection/manual/reddit_results.yaml
|
||||
runs: reddit_results
|
||||
|
||||
reported:
|
||||
label: Runs reported on the Atlas ("Report a run", an issue form on the Atlas's repository)
|
||||
run_source: reported
|
||||
# the repository's host is forge.yaml (Gitea or GitHub); its "new issue" link is made from it
|
||||
extract: { kind: forge_issues, label: run report, ext: json }
|
||||
# usernames are dropped; issues closed as "not planned" (GitHub) or labelled invalid/duplicate are left out
|
||||
transform: { name: reports, form: collection/specs/report_form.yaml, reject_labels: [invalid, duplicate] }
|
||||
load: data/public/reports.json
|
||||
runs: reports
|
||||
|
||||
bot:
|
||||
label: DragonKind bot runs (Ken's private bot, imported locally)
|
||||
run_source: bot
|
||||
# the bot's repo is private: this step runs only on a machine with a copy of it
|
||||
# data/accounts/<account>/ and logs/accounts/<account>/: one folder per game account (account names are
|
||||
# replaced by salted hashes); the top-level files are the bot's original single account
|
||||
extract:
|
||||
kind: local_dir
|
||||
env: DRAGONKIND_BOT_DIR
|
||||
files: [data/knowledge.json, data/runs.jsonl, logs/encounters.jsonl, data/accounts/*/runs.jsonl, logs/accounts/*/encounters.jsonl]
|
||||
transform: { name: bot, spec: collection/specs/bot.yaml }
|
||||
privacy:
|
||||
account_salt_env: DK_ACCOUNT_SALT # account names are hashed with this salt (or, if unset, one kept in
|
||||
# data/raw/bot/account-salt.txt); never committed
|
||||
refuse_fields: [prose, proseNorm, proseExcerpt, email, password, accountId, accountName]
|
||||
max_string: 200 # anything longer looks like game prose
|
||||
load: data/bot # scenes.json (merged) + trajectories-<date>.jsonl
|
||||
runs: bot
|
||||
@@ -0,0 +1,169 @@
|
||||
"""Data collection: extract -> transform -> load for every source, then build the combined runs.
|
||||
|
||||
python -m collection update [--source NAME ...] [--file NAME=PATH ...] [--report FILE]
|
||||
For each source (all by default): extract it (or take a local file), and when the raw file changed,
|
||||
transform it and load the public source file. Then build. Exit code 0 even when a source could not be
|
||||
reached: the report says what happened (and the daily workflow opens an issue).
|
||||
python -m collection refresh [--bot PATH ...]
|
||||
Locally, what the daily workflow does: update every source (plus bot folders or zips someone sent), then
|
||||
rebuild the graph, the route model, the statistics and the build.
|
||||
python -m collection export-bot-kit
|
||||
exports/atlas-for-bot-<date>-<policy id>.zip: policy.json, experiments.json, solver.js and graph.js.
|
||||
python -m collection cycle --bot PATH [--deliver DIR] [--community] [--force]
|
||||
The automated loop with the bot: import its new runs, refit the route model, rebuild the experiment
|
||||
plan (planner/experiments.yaml), and copy the bot's files into DIR. Safe to run on a timer.
|
||||
python -m collection build [--check]
|
||||
Code every public source file into data/public/runs_clean.csv (validated against data/dictionary.yaml),
|
||||
and write the files generated from the specs: the "Report a run" issue form, the bot crosswalk in
|
||||
core/graph.js, and data/croissant.json. With --check nothing is written; exit 1
|
||||
if any of them is out of date (CI runs this).
|
||||
|
||||
Sources and their rules: collection/pipeline.yaml. What each column means: data/dictionary.yaml.
|
||||
"""
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
from datetime import datetime, timezone
|
||||
|
||||
from .etl import extract as E
|
||||
from .etl import load as L
|
||||
from .etl import codegen, metadata, report_form, runs, validate
|
||||
from .etl.common import Report, path, pipeline
|
||||
from .etl.transform import TRANSFORMS
|
||||
|
||||
|
||||
def update_source(name, spec, manifest, report, local_file=None, env=None):
|
||||
env = os.environ if env is None else env
|
||||
try:
|
||||
raw, changed = E.extract(name, spec, manifest, env, local_file)
|
||||
except E.Skip as e:
|
||||
report.add(f"- **{spec['label']}:** skipped ({e}).")
|
||||
return False
|
||||
except Exception as e: # one broken source must not block the others
|
||||
report.failed.append(name)
|
||||
report.add(f"- **{spec['label']}:** could not extract ({type(e).__name__}: {e}).")
|
||||
return False
|
||||
if not changed:
|
||||
report.add(f"- **{spec['label']}:** no change.")
|
||||
return False
|
||||
mod = TRANSFORMS[spec["transform"]["name"]]
|
||||
ctx = {"changed": manifest[name]["changed"], "env": env}
|
||||
new = mod.transform(raw, spec, ctx)
|
||||
target = spec.get("load")
|
||||
if name == "bot":
|
||||
old = {"scenes": L.read_json(f"{target}/scenes.json") or {}}
|
||||
lines = mod.describe(old, new)
|
||||
wrote = L.json_file(f"{target}/scenes.json", mod.merge_scenes(old["scenes"], new["scenes"]), compact=False)
|
||||
# one file per import (date + raw checksum), so two imports on the same day (yours, Ken's) never overwrite
|
||||
tag = f"{ctx['changed']}-{manifest[name]['sha256'][:8]}"
|
||||
wrote |= L.jsonl_file(f"{target}/trajectories-{tag}.jsonl", new["trajectories"])
|
||||
elif target:
|
||||
old = L.read_json(target)
|
||||
lines = mod.describe(old, new)
|
||||
wrote = L.json_file(target, new, compact=not target.startswith("data/derived"))
|
||||
else: # nothing to load: the report is the output (e.g. Reddit result links to add by hand)
|
||||
lines, wrote = mod.describe(None, new), False
|
||||
report.add(f"- **{spec['label']}:** {lines[0]}")
|
||||
for line in lines[1:]:
|
||||
report.add(line)
|
||||
return wrote
|
||||
|
||||
|
||||
def build(check=False, report=None):
|
||||
"""Combined runs, issue form and metadata. Returns the list of files that changed (or would change)."""
|
||||
pipe = pipeline()
|
||||
rows = runs.build_runs(pipe)
|
||||
validate.check(rows, runs.DICT, "runs_clean.csv")
|
||||
out = []
|
||||
if L.csv_file(pipe["runs"]["path"], rows, runs.COLUMNS, check):
|
||||
out.append(pipe["runs"]["path"])
|
||||
if L.write_bytes(report_form.TEMPLATE, report_form.render().encode("utf-8"), check):
|
||||
out.append(report_form.TEMPLATE)
|
||||
if L.write_bytes(codegen.GRAPH_JS, codegen.graph_js().encode("utf-8"), check):
|
||||
out.append(codegen.GRAPH_JS)
|
||||
if L.json_file(codegen.LINKS, codegen.links(), check, compact=False):
|
||||
out.append(codegen.LINKS)
|
||||
# the metadata hashes the files above, so it is built from what is (or would be) on disk
|
||||
if not check or not out:
|
||||
if L.write_bytes(metadata.OUT, metadata.render(metadata.build()).encode("utf-8"), check):
|
||||
out.append(metadata.OUT)
|
||||
counts = {}
|
||||
for r in rows:
|
||||
counts[r["source"]] = counts.get(r["source"], 0) + 1
|
||||
msg = f"runs_clean.csv: {len(rows)} runs ({', '.join(f'{k} {v}' for k, v in counts.items())})"
|
||||
(report.add if report else print)(f"- **Combined runs:** {msg}")
|
||||
return out
|
||||
|
||||
|
||||
def main(argv=None):
|
||||
ap = argparse.ArgumentParser(prog="python -m collection", description=__doc__,
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
sub = ap.add_subparsers(dest="cmd", required=True)
|
||||
up = sub.add_parser("update")
|
||||
up.add_argument("--source", action="append", help="only these sources (repeatable)")
|
||||
up.add_argument("--file", action="append", default=[], help="NAME=PATH: use a local file instead of extracting")
|
||||
up.add_argument("--report")
|
||||
b = sub.add_parser("build")
|
||||
b.add_argument("--check", action="store_true")
|
||||
fg = sub.add_parser("forge", help="pull requests, issues and labels on the repository's host (forge.yaml)")
|
||||
fg.add_argument("args", nargs=argparse.REMAINDER)
|
||||
k = sub.add_parser("export-bot-kit", help="zip policy.json, experiments.json, solver.js and graph.js for the bot")
|
||||
k.add_argument("--out", default="exports")
|
||||
sub.add_parser("rebuild", help="rebuild everything made from the runs: graph, route model, plan, reports, statistics, build")
|
||||
r = sub.add_parser("refresh", help="update every source, then rebuild everything (the daily workflow, locally)")
|
||||
r.add_argument("--bot", action="append", default=[], help="a bot folder or a .zip of its data (repeatable)")
|
||||
c = sub.add_parser("cycle", help="the loop with the bot: import its runs, refit, re-plan, deliver (safe on a timer)")
|
||||
c.add_argument("--bot", action="append", default=[], help="the bot's folder, or a .zip of its data (repeatable); default: $DRAGONKIND_BOT_DIR")
|
||||
c.add_argument("--deliver", help="a folder to put the bot's files in (its vendor/threshing-atlas/)")
|
||||
c.add_argument("--community", action="store_true", help="also check the community sources first")
|
||||
c.add_argument("--force", action="store_true", help="rebuild even when there are no new runs")
|
||||
a = ap.parse_args(argv)
|
||||
|
||||
if a.cmd == "cycle":
|
||||
from .etl.handoff import cycle
|
||||
bots = a.bot or ([os.environ["DRAGONKIND_BOT_DIR"]] if os.environ.get("DRAGONKIND_BOT_DIR") else [])
|
||||
return cycle(main, bots, a.deliver, a.community, a.force)
|
||||
if a.cmd == "forge":
|
||||
from .etl import forge
|
||||
return forge.main(a.args)
|
||||
if a.cmd == "export-bot-kit":
|
||||
from .etl.handoff import export_bot_kit
|
||||
print(f"wrote {export_bot_kit(a.out)}")
|
||||
return 0
|
||||
if a.cmd == "rebuild":
|
||||
from .etl.handoff import rebuild
|
||||
return rebuild()
|
||||
if a.cmd == "refresh":
|
||||
from .etl.handoff import refresh
|
||||
return refresh(main, a.bot)
|
||||
|
||||
if a.cmd == "build":
|
||||
changed = build(check=a.check)
|
||||
if a.check and changed:
|
||||
print("out of date (run `python -m collection build`): " + ", ".join(changed), file=sys.stderr)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
pipe = pipeline()
|
||||
manifest = L.read_json(pipe["manifest"]) or {}
|
||||
files = dict(f.split("=", 1) for f in a.file)
|
||||
report = Report()
|
||||
for name, spec in pipe["sources"].items():
|
||||
if a.source and name not in a.source:
|
||||
continue
|
||||
report.changed |= update_source(name, spec, manifest, report, files.get(name))
|
||||
L.json_file(pipe["manifest"], dict(sorted(manifest.items())), compact=False)
|
||||
try:
|
||||
report.changed |= bool(build(report=report))
|
||||
except validate.Invalid as e: # new answers the coding rules do not know yet: report them, load nothing
|
||||
report.failed.append("build")
|
||||
report.add(f"- **Combined runs not rebuilt:** {e}")
|
||||
report.add(" - Add the new answers to `core/spec/form.yaml` (or `data/dictionary.yaml`), then run `python -m collection build`.")
|
||||
text = report.text(f"Source check {datetime.now(timezone.utc).strftime('%Y-%m-%d %H:%M UTC')}")
|
||||
if a.report:
|
||||
with open(a.report, "w", encoding="utf-8") as f:
|
||||
f.write(text)
|
||||
if os.environ.get("GITHUB_OUTPUT"):
|
||||
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
|
||||
f.write(f"changed={'true' if report.changed else 'false'}\nfailed={','.join(report.failed)}\n")
|
||||
return 0
|
||||
@@ -0,0 +1,94 @@
|
||||
# The DragonKind bot: how its screens and choices become public data and runs. collection/etl/transform/bot.py.
|
||||
#
|
||||
# The bot's raw data (game prose, account ids) stays on the machine that runs it. What is published:
|
||||
# scene fingerprints, the short labels below (our own paraphrases, not game prose), choice text and outcomes.
|
||||
version: 1
|
||||
|
||||
# Must match normalize() in the bot's src/strategy.js, so fingerprints line up (applied in this order).
|
||||
normalize:
|
||||
- ["[\u2018\u2019\u201b`']", "'"]
|
||||
- ["[\u201c\u201d\"]", "\""]
|
||||
- ["[\u2013\u2014-]", " "]
|
||||
- ["\u2026", " "]
|
||||
- ["[^a-z0-9'\\s]", " "]
|
||||
- ["\\s+", " "]
|
||||
|
||||
# Events in the bot's log that record a choice it acted on
|
||||
choice_events: [DECISION, MANUAL_DECISION, MANUAL_EDGE_PICK]
|
||||
# runs.jsonl and the log are matched when the same attempt starts within this many hours
|
||||
match_hours: 6
|
||||
|
||||
# Short public labels, by scene fingerprint. A scene without one is labelled "<stage> · <tint>" and listed by the
|
||||
# importer so a label can be added here.
|
||||
labels:
|
||||
"db7786392626": "Start: choose company"
|
||||
"a68f681076c6": "Valley edge: choose direction"
|
||||
"bc4ee4754b9c": "First sighting: Red (forest centre)"
|
||||
"abe3011378ac": "First sighting: Brown (forest centre)"
|
||||
"84780dab01e3": "Survived the first sighting"
|
||||
"d25f2759ace0": "Deeper in the forest: a scream"
|
||||
"f72199f24b91": "Clearing: squadmate vs two bullies"
|
||||
"b209bacacec3": "Bully fight: first move"
|
||||
"fbe0f0bea700": "Bully fight: smaller cadet has a dagger"
|
||||
"a2368b0dc212": "Blocked the bigger cadet: bullies’ fate"
|
||||
"f4b4944d3f3b": "Beat the smaller cadet: bullies’ fate"
|
||||
"0cfd06cf8939": "After the fight: choose a direction"
|
||||
"0a561d53ad19": "An hour later: valley or tree"
|
||||
"96b68612eaf4": "Top of the tree (shadow check)"
|
||||
"10bc7353b8eb": "Descended quickly: a Red below"
|
||||
"c62f1f1a2b3a": "Let the Red pass: two Greens in the clearing"
|
||||
"07e24681e3b3": "Descended slowly: two Greens in the clearing"
|
||||
|
||||
# Crosswalk: a bot choice (option text, normalised as in core/graph.js norm()) -> a column of the coded runs.
|
||||
# First match wins; a column keeps its first value. Unmatched choices are listed, never guessed.
|
||||
# Two keys are not columns: scream_investigate (the scream step on its own) and red (the Red below the tree).
|
||||
crosswalk:
|
||||
- ["^enter the valley alone", company, "Alone"]
|
||||
- ["^enter the valley with one of your squadmates", company, "1 Squadmate"]
|
||||
- ["^enter the valley with two of your squadmates", company, "2 Squadmates"]
|
||||
- ["^leave your squadmates?$", left_squadmates, true]
|
||||
- ["^head east toward the roar", direction, "East"]
|
||||
- ["^head west toward the scent", direction, "West"]
|
||||
- ["^head toward the center of the forest", direction, "Center"]
|
||||
# with squadmates, the direction is agreed with them
|
||||
- ["^go east with your squad|^convince them to head east", direction, "East"]
|
||||
- ["^go west with your squad|^convince them to head west", direction, "West"]
|
||||
- ["^keep walking the cadets are just as dangerous", scream, "Ignore the scream"]
|
||||
- ["^run and hope", sighting_action, "Retreat / run"]
|
||||
- ["hold still|hold your ground", sighting_action, "Hold still"]
|
||||
- ["lower your eyes in respect|lower your eyes and turn to face it", sighting_action, "Respect / face it"]
|
||||
- ["meeting its gaze", sighting_action, "Meet its gaze"]
|
||||
- ["^hide behind a tree|^duck behind a boulder", sighting_action, "Hide"]
|
||||
- ["^approach with confidence|^approach from the left", sighting_action, "Approach"]
|
||||
- ["^investigate the scream", scream_investigate, true]
|
||||
- ["^help your squadmate", scream, "Investigate & help"]
|
||||
- ["^play it safe and leave them", scream, "Investigate & leave"]
|
||||
- ["^pause to assess the situation", combat_first, "Assess the situation"]
|
||||
- ["^charge the other cadet", combat_first, "Even the numbers (smaller cadet)"]
|
||||
- ["^unsheathe your weapon and charge between", combat_first, "Put yourself in the middle (bigger cadet)"]
|
||||
- ["^engage the smaller cadet", combat_second, "Engage the smaller cadet"]
|
||||
- ["^daggers or not", combat_second, "Daggers or not (protect squadmate)"]
|
||||
- ["^end the lives of the bullies", resolution, "Killed the bullies yourself"]
|
||||
- ["^allow your squadmate to exact", resolution, "Squadmate's revenge"]
|
||||
- ["^leave the bullies alive", resolution, "Left bullies to the dragons"]
|
||||
- ["tourniquet", resolution, "Tourniquet"]
|
||||
# the wounded cadet's other two choices (the bot has not logged this screen yet, so these are kept loose)
|
||||
- ["leave (them|him|her) to die|^keep going clearly they've been found lacking", resolution, "Left injured cadet"]
|
||||
- ["take (their|his|her|the cadet's) weapons?", resolution, "Took their weapons"]
|
||||
- ["^walk toward the east", post_path, "East"]
|
||||
- ["^walk toward the west", post_path, "West"]
|
||||
- ["^walk farther into the forest", post_path, "Forest"]
|
||||
- ["^continue toward the center of the valley", hour, "Valley"]
|
||||
- ["^find the tallest tree", hour, "Tree"]
|
||||
# the Red in the valley centre
|
||||
- ["^there's no way this is your dragon", branch, "Passed the Red: meadow"]
|
||||
- ["^this is your dragon and it's time to start bonding", branch, "Valley Red"]
|
||||
- ["^descend quickly", branch, "Descend quickly: Red"]
|
||||
- ["^climb down slowly to pursue the green", branch, "Descend slowly: two Greens"]
|
||||
- ["^reds are too hot tempered", red, "Let it pass (two Greens)"]
|
||||
- ["^jump (now|in a few seconds)", red, "Jump onto the Red"]
|
||||
|
||||
# Route choices (before the hour) that no column of the coded runs has a value for; they are coded as unknown.
|
||||
# tests/collection/test_collection.py fails on any other unmapped route choice.
|
||||
not_coded:
|
||||
- "^stare at the ground and drop the weapon" # a first-sighting reaction with no form category
|
||||
@@ -0,0 +1,119 @@
|
||||
# "Report a run": the questions of the issue form (on the Atlas's repository: forge.yaml), and how each answer becomes a column of runs_clean.csv.
|
||||
#
|
||||
# collection/etl/report_form.py writes .github/ISSUE_TEMPLATE/report-a-run.yml from this file (a test checks it is
|
||||
# up to date), and collection/etl/runs.py codes every report with it. Each option is "label shown: column value";
|
||||
# an option with value null (or no answer) means "not known". Values must be listed in data/dictionary.yaml.
|
||||
version: 1
|
||||
|
||||
name: Report a run
|
||||
description: Log one threshing run for the Threshing Atlas. Reports are public and become rows of runs_clean.csv.
|
||||
title: "Run report"
|
||||
label: run report
|
||||
intro: |
|
||||
Thanks for reporting a run! Answer what you remember; leave anything you're unsure of on "Not sure".
|
||||
Every answer here is visible to everyone who can see this repository (it is an issue) and goes into the Atlas's
|
||||
open data as source "reported".
|
||||
Please don't include your DragonKind account name or anything personal.
|
||||
You can also use the community [Threshing Routes form](https://forms.gle/DRpj9tG8gb5E4Hcu7) linked from the r/fourthwing megathread; please report each run only once.
|
||||
|
||||
fields:
|
||||
- id: goal
|
||||
label: Which dragon were you trying to bond?
|
||||
column: goal
|
||||
options: { Red: Red, Green: Green, Orange: Orange, Brown: Brown, Blue: Blue, Black: Black, "Any, just for fun": Any (for fun) }
|
||||
- id: attempt
|
||||
label: Which attempt was this for your account? (a number; 1 = your first)
|
||||
column: attempt
|
||||
type: integer
|
||||
- id: company
|
||||
label: Who entered the valley with you?
|
||||
column: company
|
||||
required: true
|
||||
options: { Alone: Alone, One squadmate: 1 Squadmate, Two squadmates: 2 Squadmates }
|
||||
- id: left_squadmates
|
||||
label: If you went with squadmates, did you leave them?
|
||||
column: left_squadmates
|
||||
options: { "Yes, I left them": true, "No, we stayed together": false, "I went alone": null }
|
||||
- id: direction
|
||||
label: Which way did you go first?
|
||||
column: direction
|
||||
required: true
|
||||
options: { East (toward the roar): East, West (toward the scent): West, Toward the forest centre: Center }
|
||||
- id: first_sighting
|
||||
label: Which dragon found you first?
|
||||
column: first_sighting
|
||||
options: { Red: Red, Brown: Brown, Green: Green, Orange: Orange }
|
||||
- id: sighting_action
|
||||
label: What did you do when it found you?
|
||||
column: sighting_action
|
||||
options:
|
||||
Hold still: Hold still
|
||||
Lower your eyes in respect / turn to face it: Respect / face it
|
||||
Run: Retreat / run
|
||||
Hide: Hide
|
||||
Draw a weapon: Weapon
|
||||
Meet its gaze: Meet its gaze
|
||||
Protect your squadmate: Protect squadmate
|
||||
- id: scream
|
||||
label: The scream
|
||||
column: scream
|
||||
required: true
|
||||
options:
|
||||
I died at the first dragon: DIED at first sighting
|
||||
Investigated, and helped my squadmate: Investigate & help
|
||||
Investigated, and walked away: Investigate & leave
|
||||
Kept walking (ignored it): Ignore the scream
|
||||
- id: combat_first
|
||||
label: "If you helped: your first move in the fight"
|
||||
column: combat_first
|
||||
options:
|
||||
Pause to assess: Assess the situation
|
||||
Charge the smaller cadet: Even the numbers (smaller cadet)
|
||||
Charge between the bigger cadet and your squadmate: Put yourself in the middle (bigger cadet)
|
||||
- id: combat_second
|
||||
label: "If you paused to assess: the smaller cadet's dagger"
|
||||
column: combat_second
|
||||
options: { Engage the smaller cadet: Engage the smaller cadet, Charge the bigger cadet anyway: Daggers or not (protect squadmate) }
|
||||
- id: resolution
|
||||
label: How did the cadet encounter end?
|
||||
column: resolution
|
||||
options:
|
||||
I died in the fight: DIED in combat
|
||||
"Bullies: killed them myself": Killed the bullies yourself
|
||||
"Bullies: my squadmate's revenge": Squadmate's revenge
|
||||
"Bullies: left them to the dragons": Left bullies to the dragons
|
||||
"Wounded cadet: tourniquet": Tourniquet
|
||||
"Wounded cadet: left them": Left injured cadet
|
||||
"Wounded cadet: took their weapons": Took their weapons
|
||||
"I walked away from the clearing": Left them to it
|
||||
- id: post_path
|
||||
label: "After the fight: which way did you walk?"
|
||||
column: post_path
|
||||
options: { Deeper into the forest: Forest, West: West, East: East, There was no fork: (no fork) }
|
||||
- id: hour
|
||||
label: After an hour's walk
|
||||
column: hour
|
||||
options: { Climbed the tallest tree: Tree, Went to the valley centre: Valley, I died before the hour: DIED before the hour }
|
||||
- id: branch
|
||||
label: Which bonding encounter did you reach?
|
||||
column: branch
|
||||
options:
|
||||
"Tree: the shadow (Blue or Black)": Shadow (rare)
|
||||
"Tree: climbed down quickly, jumped on the Red": "Descend quickly: Red"
|
||||
"Tree: climbed down quickly, let the Red pass": "Descend quickly: let the Red pass"
|
||||
"Tree: climbed down slowly to the two Greens": "Descend slowly: two Greens"
|
||||
"Valley: faced the Red": Valley Red
|
||||
"Valley: passed the Red, the meadow": "Passed the Red: meadow"
|
||||
- id: outcome
|
||||
label: How did the run end?
|
||||
column: outcome
|
||||
required: true
|
||||
options: { Bonded: Bonded, Incinerated at a bonding encounter: Incinerated, Died before the hour: Died before the hour }
|
||||
- id: outcome_color
|
||||
label: Which dragon bonded you (or incinerated you)?
|
||||
column: outcome_color
|
||||
options: { Red: Red, Green: Green, Orange: Orange, Brown: Brown, Blue: Blue, Black: Black }
|
||||
- id: tail
|
||||
label: "If you bonded: the dragon's tail"
|
||||
column: tail
|
||||
options: { Clubtail: Clubtail, Daggertail: Daggertail, Morningstartail: Morningstartail, Scorpiontail: Scorpiontail, Swordtail: Swordtail }
|
||||
@@ -0,0 +1,21 @@
|
||||
# core
|
||||
|
||||
The shared model. Every other part uses it, so run `npm test` after any change.
|
||||
|
||||
The rules and the game are **declarative** files in `spec/`; the Python package `atlas/` reads them. JavaScript is
|
||||
used only where it has to run in a browser or in Ken's bot.
|
||||
|
||||
| File | What it does |
|
||||
|---|---|
|
||||
| `spec/form.yaml` | Every question of the community form (how to find it in an export) and every answer (what it is coded as), the answers that count as missing, email redaction, when "left your squadmates" was first asked. |
|
||||
| `spec/game.yaml` | The game: every decision and its options in order, every roll and what its odds may depend on, every bonding encounter, the flow of a run from the entrance to the dragons, how form answers map onto it, and the text the bot sees for each option. |
|
||||
| `atlas/coding.py` | Codes every form row into a run (`python -m atlas.coding`). Rule tests: `tests/core/test_coding.py`. |
|
||||
| `atlas/model.py`, `atlas/solver.py` | The route model: what each coded run reveals about each step, the count tables and shrinkage, the posterior draws, and one interpreter of `game.yaml` used to solve, evaluate and export the best routes (`planner/build_policy.py`). Tests: `tests/core/test_solver.py`, `test_game.py`. |
|
||||
| `solver.js` | **JavaScript, for the site and the bot.** The route advisor: reads the game and the count tables from `data/policy.json` and re-solves from any point in a run. `tests/core/advisor.test.js` checks it gives exactly the Python model's values and choices. |
|
||||
| `graph.js` | **JavaScript, for the bot.** Turns the bot's on-screen choices into form answers, and builds the route graph (`analysis/network/build-graph.js`). Moves to Python with the collection review. |
|
||||
|
||||
The site and Ken's bot load the published copies (`https://ekcschiano.github.io/threshing-atlas/solver.js`,
|
||||
`graph.js`, `data/policy.json`), so those names on the site must not change.
|
||||
|
||||
To support a new form answer, add it to `spec/form.yaml`. To change a rule, edit `atlas/coding.py` and add a test case.
|
||||
To add a choice to the game, add it to `spec/game.yaml` (and, if the form records it, to `atlas/model.py`).
|
||||
@@ -0,0 +1,8 @@
|
||||
"""threshing-atlas core: the shared model every part of the project uses.
|
||||
|
||||
The rules and the game live in declarative files under core/spec/ (form.yaml, game.yaml, crosswalk.yaml);
|
||||
the modules here read them:
|
||||
|
||||
atlas.spec load the spec files
|
||||
atlas.coding community form rows -> coded runs
|
||||
"""
|
||||
@@ -0,0 +1,125 @@
|
||||
"""Reporting bias: some sources report a rare sighting more readily than a miss.
|
||||
|
||||
The bot logs every run, and bulk-pasted logs record every run of the players who kept them ("complete" groups).
|
||||
Form submissions and reports are chosen by the rider, and a run with a shadow or a meadow Blue is more likely to be
|
||||
written up than one without. For each rare roll and each selective group, the bias is the factor by which the
|
||||
group's odds of the rare outcome exceed the complete groups' odds:
|
||||
|
||||
rho = odds(rare | group) / odds(rare | complete groups)
|
||||
|
||||
Each rare outcome a group reports then counts 1/rho in the route model's tables. That keeps the group's pattern
|
||||
across routes and moves its overall level to what complete logging shows. The assumption: the bias is the same on
|
||||
every route (planner/policy.yaml says which groups, rolls and settings are used).
|
||||
"""
|
||||
import random
|
||||
|
||||
from . import model
|
||||
|
||||
|
||||
def group_of(r, groups, rare_goals):
|
||||
"""The first group in planner/policy.yaml whose condition the run meets."""
|
||||
for g in groups:
|
||||
w = g.get("when", {})
|
||||
if "source" in w and r.get("source") != w["source"]:
|
||||
continue
|
||||
if "entry_not" in w and r.get("entry") in (None, w["entry_not"]):
|
||||
continue
|
||||
if w.get("goal") == "rare" and r.get("goal") not in rare_goals:
|
||||
continue
|
||||
return g["name"]
|
||||
return None
|
||||
|
||||
|
||||
def _odds(y, n):
|
||||
p = (y + 0.5) / (n + 1) # Jeffreys
|
||||
return p / (1 - p)
|
||||
|
||||
|
||||
def estimate(runs, prepared, cfg, rare_goals, seed=20261109, sims=4000):
|
||||
"""{group: {roll: {rare, n, rho, lo, hi, used}}} and the group of every run."""
|
||||
groups = cfg["groups"]
|
||||
names = [group_of(r, groups, rare_goals) for r in runs]
|
||||
complete = {g["name"] for g in groups if g.get("complete")}
|
||||
rolls = cfg["rolls"]
|
||||
tally = {}
|
||||
for name, v in zip(names, prepared):
|
||||
for node, rare in rolls.items():
|
||||
y = model.OBSERVE[node](v)
|
||||
if y is None:
|
||||
continue
|
||||
t = tally.setdefault(name, {}).setdefault(node, [0, 0])
|
||||
t[0] += y == rare
|
||||
t[1] += 1
|
||||
ref = {node: [sum(tally.get(g, {}).get(node, [0, 0])[i] for g in complete) for i in (0, 1)] for node in rolls}
|
||||
rnd = random.Random(seed)
|
||||
out = {}
|
||||
for g in groups:
|
||||
name = g["name"]
|
||||
out[name] = {}
|
||||
for node in rolls:
|
||||
y, n = tally.get(name, {}).get(node, [0, 0])
|
||||
ry, rn = ref[node]
|
||||
e = {"rare": y, "n": n, "completeRare": ry, "completeN": rn}
|
||||
if g.get("complete"):
|
||||
e.update(rho=1.0, lo=1.0, hi=1.0, used="complete: counted as reported")
|
||||
elif ry < cfg.get("min_complete_rare", 5) and (cfg.get("borrow") or {}).get(node):
|
||||
# complete logging has (almost) never seen it, so the bias cannot be estimated for this roll: assume
|
||||
# the group over-reports it as much as it over-reports another rare roll (filled in below)
|
||||
e.update(rho=None, borrow=cfg["borrow"][node])
|
||||
elif ry < cfg.get("min_complete_rare", 5):
|
||||
# complete logging has (almost) never seen it: the bias cannot be estimated, so this roll is learned
|
||||
# from complete logging only (its range then shows how little is known)
|
||||
e.update(rho=None, lo=None, hi=None, exclude=True,
|
||||
used=f"left out: complete logs have only {ry} rare outcomes, too few to estimate the bias")
|
||||
elif n < cfg.get("min_runs", 30) or rn < cfg.get("min_runs", 30):
|
||||
e.update(rho=None, used=f"too few runs: uses {g.get('same_as') or 'no correction'}")
|
||||
else:
|
||||
rho = _odds(y, n) / _odds(ry, rn)
|
||||
sim = [] # a 90% range for rho from the two rates' posteriors
|
||||
for _ in range(sims):
|
||||
a = rnd.betavariate(y + 0.5, n - y + 0.5)
|
||||
b = rnd.betavariate(ry + 0.5, rn - ry + 0.5)
|
||||
sim.append((a / (1 - a)) / (b / (1 - b)))
|
||||
sim.sort()
|
||||
e.update(rho=rho, lo=sim[int(0.05 * sims)], hi=sim[int(0.95 * sims) - 1], used="estimated")
|
||||
out[name][node] = e
|
||||
# groups with too little data borrow another group's estimate
|
||||
for g in groups:
|
||||
for node in rolls:
|
||||
e = out[g["name"]][node]
|
||||
if e.get("rho") is None and not e.get("exclude") and not e.get("borrow"):
|
||||
src = out.get(g.get("same_as") or "", {}).get(node, {})
|
||||
e["rho"] = src.get("rho") or 1.0
|
||||
e["lo"], e["hi"] = src.get("lo", e["rho"]), src.get("hi", e["rho"])
|
||||
# a roll whose bias cannot be estimated borrows the same group's estimate for another roll (`borrow`)
|
||||
for g in groups:
|
||||
for node in rolls:
|
||||
e = out[g["name"]][node]
|
||||
if e.get("borrow"):
|
||||
src = out[g["name"]].get(e["borrow"], {})
|
||||
if src.get("rho"):
|
||||
e.update(rho=src["rho"], lo=src.get("lo"), hi=src.get("hi"),
|
||||
used=f"assumed equal to this group's bias for the {e['borrow']} roll: complete logs have only "
|
||||
f"{e['completeRare']} rare outcomes, too few to estimate it")
|
||||
else:
|
||||
e.update(lo=None, hi=None, exclude=True, used="left out: no bias estimate to borrow")
|
||||
return out, names
|
||||
|
||||
|
||||
def weights(names, prepared, est, rolls):
|
||||
"""Per run: {roll: weight of the outcome it observed}: 1/rho for a rare outcome from a biased group, 0 for any
|
||||
outcome of a roll its group is left out of. Only where it differs from 1."""
|
||||
out = []
|
||||
for name, v in zip(names, prepared):
|
||||
w = {}
|
||||
for node, rare in rolls.items():
|
||||
e = (est.get(name) or {}).get(node, {})
|
||||
y = model.OBSERVE[node](v)
|
||||
if y is None:
|
||||
continue
|
||||
if e.get("exclude"):
|
||||
w[node] = 0.0
|
||||
elif y == rare and (e.get("rho") or 1.0) != 1.0:
|
||||
w[node] = 1.0 / e["rho"]
|
||||
out.append(w)
|
||||
return out
|
||||
@@ -150,10 +150,6 @@ def code_row(r, C):
|
||||
company = company_raw[: -len(suffix)] if left_squad else company_raw
|
||||
if not left_squad and company in ("1 Squadmate", "2 Squadmates") and not (date and date >= F["left_squadmates_asked_from"]):
|
||||
left_squad = None # the form did not offer "left them" yet: unknown, not "stayed together"
|
||||
alias = F.get("first_sighting_alias") or {}
|
||||
if first in alias:
|
||||
flags.append(f"first sighting answered as {first!r}")
|
||||
first = alias[first]
|
||||
pools = F["sighting_pool"]
|
||||
pool = list(pools.get(company, {}).get(direction, [])) + (list(pools["Alone"].get(direction, [])) if left_squad else [])
|
||||
if first and first != "Unsure" and pool and first not in pool:
|
||||
@@ -0,0 +1,458 @@
|
||||
"""From coded runs to the route model's numbers: what each run says about each step of the game (prepare_run),
|
||||
how often each roll came out in each context (count_tables), how strongly to shrink toward shorter contexts
|
||||
(fit_alpha), the probability source the solver uses (Params), and which options have enough data (support_from).
|
||||
|
||||
The game itself (steps, options, chance contexts) is core/spec/game.yaml.
|
||||
|
||||
The random numbers (xorshift32, Marsaglia-Tsang gamma) are the same as the route model has always used, so the
|
||||
posterior draws are reproducible from the seed.
|
||||
"""
|
||||
import math
|
||||
|
||||
import numpy as np
|
||||
|
||||
from . import spec
|
||||
|
||||
G = spec.game()
|
||||
DECISIONS = {k: v["options"] for k, v in G["decisions"].items()}
|
||||
CHANCE = G["chance"]
|
||||
COLOURS = G["colours"]
|
||||
FROM_FORM = G["from_form"]
|
||||
HELP = set(FROM_FORM["helped"])
|
||||
IGNORE = set(FROM_FORM["ignored"])
|
||||
FIGHT_OF = FROM_FORM["fight"]
|
||||
DAGGER_OF = FROM_FORM["dagger"]
|
||||
RARE_GOALS = FROM_FORM["rare_goals"]
|
||||
NO_DAGGER = "(no dagger choice)"
|
||||
ALONE = "(alone)"
|
||||
ALPHA = 20
|
||||
ALPHA_GRID = [1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 20000, 100000]
|
||||
ENC_CATS = G["encounter_outcomes"]
|
||||
GIVENS = G.get("givens") or {}
|
||||
DEFAULT_GIVEN = {k: g["default"] for k, g in GIVENS.items()}
|
||||
|
||||
|
||||
def enc_colour(ctx):
|
||||
return "Green" if ctx == "tree-Greens" else ctx.split("-")[1]
|
||||
|
||||
|
||||
def dagger_after(fight, dagger):
|
||||
"""The fight moves in a history: a run that charged straight in never faces the dagger."""
|
||||
return None if fight is None else (dagger or None) if fight == "Pause to assess" else NO_DAGGER
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- 1. coded run -> what it says about each step
|
||||
|
||||
def genuine_attempt(r, ctx):
|
||||
"""Whether a run's bonding attempt counts for this encounter, given the rider's stated goal and Malek intent."""
|
||||
c = enc_colour(ctx)
|
||||
g = r.get("goal") or ""
|
||||
matches = g == c or g.startswith("Any") or (g == "Blue or Black" and c in ("Blue", "Black")) or \
|
||||
(g == "Red (tree)" and ctx == "tree-Red")
|
||||
if matches:
|
||||
return True
|
||||
if r.get("malek_intent") == "No":
|
||||
return True
|
||||
if r.get("malek_intent") == "Yes":
|
||||
return False
|
||||
specific_other = (g in COLOURS and g != c) or g == "Blue or Black" or g == "Red (tree)"
|
||||
return not specific_other
|
||||
|
||||
|
||||
def prepare_run(r):
|
||||
"""One coded run (atlas.coding) as the steps of the game it reveals."""
|
||||
v = {"company": r["company"] if r["company"] in DECISIONS["company"] else None,
|
||||
"direction": r["direction"] if r["direction"] in DECISIONS["direction"] else None,
|
||||
"fs": r["first_sighting"] if r["first_sighting"] in ("Red", "Brown", "Green", "Orange") else None}
|
||||
# the givens (game.yaml): first or later attempt, from the run's attempt number
|
||||
v["attempt"] = r.get("attempt_group") if r.get("attempt_group") in GIVENS.get("attempt", {}).get("values", ()) else None
|
||||
lf = r.get("left_squadmates")
|
||||
known = lf is not None and not (isinstance(lf, float) and lf != lf) and lf != ""
|
||||
v["left"] = ALONE if v["company"] == "Alone" else (("Leave them" if lf is True or str(lf).lower() == "true" else "Stay together") if v["company"] and known else None)
|
||||
v["react"] = r["sighting_action"] if r.get("sighting_action") in DECISIONS["react"] else None
|
||||
v["diedSight"] = r["scream"] == "DIED at first sighting"
|
||||
if v["diedSight"]:
|
||||
return v
|
||||
if r["scream"] not in ("Investigate & help", "Ignore the scream", "Investigate & leave"):
|
||||
v["sightUnknown"] = True # no answer after the first dragon: whether the rider survived it is not known
|
||||
return v
|
||||
res = r["resolution"]
|
||||
# the choices at the scream, by their names in game.yaml (gates are written with these)
|
||||
v["scream"] = "Keep walking" if r["scream"] == "Ignore the scream" else "Investigate the scream"
|
||||
if r["scream"] in ("Investigate & help", "Investigate & leave"):
|
||||
v["clearing"] = "Help your squadmate" if r["scream"] == "Investigate & help" else "Walk away"
|
||||
if r["scream"] == "Investigate & help":
|
||||
v["help"] = True
|
||||
v["fight"] = FIGHT_OF.get(r.get("combat_first"))
|
||||
v["dagger"] = dagger_after(v["fight"], DAGGER_OF.get(r.get("combat_second")))
|
||||
v["diedCombat"] = res == "DIED in combat"
|
||||
v["cadet"] = res if res in HELP else None
|
||||
if v["diedCombat"]:
|
||||
return v
|
||||
v["post"] = r["post_path"] if r.get("post_path") in DECISIONS["post"] else None
|
||||
elif r["scream"] == "Ignore the scream":
|
||||
v["cadet"] = res if res in IGNORE else None
|
||||
v["post"] = "(no fork)"
|
||||
elif r["scream"] == "Investigate & leave":
|
||||
v["cadet"] = "Left them to it"
|
||||
v["post"] = "(no fork)"
|
||||
else:
|
||||
return v
|
||||
v["survivedCadets"] = True
|
||||
v["diedHour"] = r["hour"] == "DIED before the hour"
|
||||
if v["diedHour"]:
|
||||
return v
|
||||
v["hour"] = r["hour"] if r.get("hour") in DECISIONS["hour"] else None
|
||||
b = r.get("branch")
|
||||
if v["hour"] == "Tree" and b:
|
||||
v["shadow"] = b == "Shadow (rare)"
|
||||
if v["shadow"]:
|
||||
v["shadowColour"] = "Black" if r.get("enc_Black") else "Blue"
|
||||
v["encCtx"] = "shadow-" + v["shadowColour"]
|
||||
elif b == "Descend quickly: Red":
|
||||
v["descend"], v["red"], v["encCtx"] = "Quickly (Red)", "Jump onto the Red", "tree-Red"
|
||||
elif b == "Descend quickly: let the Red pass":
|
||||
v["descend"], v["red"], v["encCtx"] = "Quickly (Red)", "Let it pass (two Greens)", "tree-Greens"
|
||||
elif b == "Descend slowly: two Greens":
|
||||
v["descend"], v["encCtx"] = "Slowly (two Greens)", "tree-Greens"
|
||||
elif v["hour"] == "Valley" and b:
|
||||
if b == "Valley Red":
|
||||
v["valley"], v["encCtx"] = "Face the Red", "valley-Red"
|
||||
elif b == "Passed the Red: meadow":
|
||||
v["valley"] = "Pass the Red (meadow)"
|
||||
# the meadow dragon: Blue if one appeared, otherwise the one the rider ended the run with
|
||||
ended = lambda c: r.get("enc_" + c) and r.get("enc_" + c) != "Changed my mind" # noqa: E731
|
||||
v["meadow"] = "Blue" if (r.get("enc_Blue") or r.get("rare_reported") == "Blue (valley)") else \
|
||||
"Orange" if ended("Orange") else "Brown" if ended("Brown") else \
|
||||
"Orange" if r.get("enc_Orange") else "Brown" if r.get("enc_Brown") else \
|
||||
"Blue" if r.get("saw_blue_meadow") is True else \
|
||||
r["outcome_color"] if r.get("saw_blue_meadow") is False and r.get("outcome_color") in ("Orange", "Brown") else None
|
||||
if v["meadow"]:
|
||||
v["encCtx"] = "meadow-" + v["meadow"]
|
||||
if v.get("encCtx"):
|
||||
v["encOutcome"] = r["outcome_color"] if (r["outcome"] == "Bonded" and r.get("outcome_color")) else \
|
||||
"burn" if r["outcome"] == "Incinerated" else None
|
||||
if v["encOutcome"] and not genuine_attempt(r, v["encCtx"]):
|
||||
v["encOutcome"] = None
|
||||
return v
|
||||
|
||||
|
||||
def gate_open(node, state):
|
||||
"""Whether a gated roll (game.yaml `requires`) can come out any other way than `otherwise`."""
|
||||
req = CHANCE[node].get("requires") or {}
|
||||
return all(state.get(k) == v for k, v in req.items())
|
||||
|
||||
|
||||
# what each chance event observed in a prepared run (a gated roll only where its gate was open)
|
||||
OBSERVE = {
|
||||
"fs": lambda v: v.get("fs"),
|
||||
"dieSight": lambda v: ("die" if v.get("diedSight") else "live") if v.get("fs") and not v.get("sightUnknown") else None,
|
||||
"dieCombat": lambda v: ("die" if v.get("diedCombat") else "live") if v.get("help") else None,
|
||||
"dieHour": lambda v: ("die" if v.get("diedHour") else "live") if v.get("survivedCadets") else None,
|
||||
"shadow": lambda v: None if "shadow" not in v or not gate_open("shadow", v) else ("yes" if v["shadow"] else "no"),
|
||||
"shadowColour": lambda v: v.get("shadowColour"),
|
||||
"meadow": lambda v: v.get("meadow"),
|
||||
}
|
||||
assert set(OBSERVE) == set(CHANCE), "every chance event in game.yaml needs an OBSERVE rule"
|
||||
|
||||
|
||||
def ctx_key(v, names):
|
||||
return "|".join("?" if v.get(k) is None else str(v[k]) for k in names)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- 2. counts
|
||||
|
||||
def can_bond(ctx, colour):
|
||||
"""Whether a bond with this colour is possible at this encounter (game.yaml `encounters`)."""
|
||||
e = G["encounters"][ctx]
|
||||
return colour == "burn" or colour == e["colour"] or colour in (e.get("also") or [])
|
||||
|
||||
|
||||
def count_tables(prepared, weights=None):
|
||||
"""Counts for every chance event at every back-off level, plus each encounter's outcomes. weights: per run,
|
||||
{chance event: weight of the outcome it observed} (reporting-bias corrections, core/atlas/bias.py)."""
|
||||
T = {}
|
||||
for node, sp in CHANCE.items():
|
||||
t = T[node] = {}
|
||||
for i, v in enumerate(prepared):
|
||||
y = OBSERVE[node](v)
|
||||
if not y:
|
||||
continue
|
||||
w = weights[i].get(node, 1) if weights else 1
|
||||
if w == 0:
|
||||
continue
|
||||
for L in range(len(sp["context"]) + 1):
|
||||
names = sp["context"][:L]
|
||||
if any(v.get(k) is None for k in names):
|
||||
break
|
||||
c = t.setdefault(f"{L}:{ctx_key(v, names)}", {})
|
||||
c[y] = c.get(y, 0) + w
|
||||
for t in T.values(): # weighted counts are fractions: keep them short and stable
|
||||
for c in t.values():
|
||||
for k, x in c.items():
|
||||
if isinstance(x, float):
|
||||
c[k] = round(x, 4)
|
||||
enc = T["encounter"] = {}
|
||||
for v in prepared:
|
||||
if not v.get("encCtx"):
|
||||
continue
|
||||
c = enc.setdefault(v["encCtx"], {"outcomes": {}, "seen": {}})
|
||||
if v.get("encOutcome") and can_bond(v["encCtx"], v["encOutcome"]):
|
||||
c["outcomes"][v["encOutcome"]] = c["outcomes"].get(v["encOutcome"], 0) + 1
|
||||
# which colours can ever end a run in this context (from all runs, genuine or not)
|
||||
for v in prepared:
|
||||
if v.get("encCtx") and v.get("encOutcome") and v["encOutcome"] != "burn" and can_bond(v["encCtx"], v["encOutcome"]):
|
||||
enc[v["encCtx"]]["seen"][v["encOutcome"]] = 1
|
||||
return T
|
||||
|
||||
|
||||
def support_from(prepared, min_n):
|
||||
"""Options taken at least min_n times; options never recorded at all are not restricted."""
|
||||
n = {}
|
||||
|
||||
def bump(k, o):
|
||||
n.setdefault(k, {})
|
||||
n[k][o] = n[k].get(o, 0) + 1
|
||||
|
||||
for v in prepared:
|
||||
for k in ("company", "direction", "cadet", "hour", "descend", "valley"):
|
||||
if v.get(k):
|
||||
bump(k, v[k])
|
||||
if v.get("left") and v["left"] != ALONE:
|
||||
bump("leave", v["left"])
|
||||
if v.get("fs") and v.get("react"):
|
||||
bump("react:" + v["fs"], v["react"])
|
||||
if v.get("post") and v["post"] != "(no fork)":
|
||||
bump("post", v["post"])
|
||||
# the cadet encounter's steps, including riders killed in the fight (they chose to help)
|
||||
if v.get("help") or v.get("cadet"):
|
||||
ignore = bool(v.get("cadet") and v["cadet"] in IGNORE)
|
||||
bump("scream", "Keep walking" if ignore else "Investigate the scream")
|
||||
if ignore:
|
||||
bump("wounded", v["cadet"])
|
||||
else:
|
||||
bump("clearing", "Walk away" if v.get("cadet") == "Left them to it" else "Help your squadmate")
|
||||
if v.get("cadet") in HELP:
|
||||
bump("fate", v["cadet"])
|
||||
if v.get("help") and v.get("fight"):
|
||||
bump("fight", v["fight"])
|
||||
if v.get("dagger") and v["dagger"] != NO_DAGGER:
|
||||
bump("dagger", v["dagger"])
|
||||
s = {"encounter": DECISIONS["encounter"]}
|
||||
for k in ("company", "leave", "direction", "cadet", "scream", "clearing", "fight", "dagger", "fate", "wounded",
|
||||
"post", "hour", "descend", "valley"):
|
||||
s[k] = [o for o in DECISIONS[k] if n.get(k, {}).get(o, 0) >= min_n] or list(DECISIONS[k])
|
||||
for fs in ("Red", "Brown", "Green", "Orange"):
|
||||
k = "react:" + fs
|
||||
s[k] = [o for o in DECISIONS["react"] if n.get(k, {}).get(o, 0) >= min_n] or list(DECISIONS["react"])
|
||||
for k, d in G["decisions"].items():
|
||||
if d.get("always_offered") and k != "encounter":
|
||||
s[k] = list(d["options"])
|
||||
return s, n
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- 3. empirical-Bayes concentration
|
||||
|
||||
def lgamma(x):
|
||||
"""Log-gamma (Lanczos), the same approximation the route model has always used."""
|
||||
c = [76.18009172947146, -86.50532032941677, 24.01409824083091, -1.231739572450155, 0.1208650973866179e-2,
|
||||
-0.5395239384953e-5]
|
||||
y = x
|
||||
tmp = x + 5.5
|
||||
tmp -= (x + 0.5) * math.log(tmp)
|
||||
ser = 1.000000000190015
|
||||
for v in c:
|
||||
y += 1
|
||||
ser += v / y
|
||||
return -tmp + math.log(2.5066282746310005 * ser / x)
|
||||
|
||||
|
||||
def fit_alpha(T, node):
|
||||
"""The concentration that maximises the Dirichlet-multinomial likelihood of each back-off level given the one above."""
|
||||
cats = CHANCE[node]["outcomes"]
|
||||
t = T[node]
|
||||
|
||||
def pooled(key):
|
||||
c = t.get(key, {})
|
||||
a = [c.get(k, 0) + 0.5 for k in cats]
|
||||
s = 0
|
||||
for x in a:
|
||||
s += x
|
||||
return [x / s for x in a]
|
||||
|
||||
pairs = []
|
||||
for key in t:
|
||||
L = int(key.split(":")[0])
|
||||
if L <= CHANCE[node].get("distinct", 0): # the top level, and levels that are not pooled (game.yaml)
|
||||
continue
|
||||
ctx = key[key.index(":") + 1:].split("|")
|
||||
parent = f"{L - 1}:" + "|".join(ctx[:L - 1])
|
||||
pairs.append(([t[key].get(k, 0) for k in cats], pooled(parent)))
|
||||
if not pairs:
|
||||
return {"alpha": ALPHA, "logLik": None}
|
||||
# a roll that has only ever come out one way says nothing about whether routes differ: pool fully (the fit
|
||||
# would otherwise drive every route's chance of the unseen outcome to zero)
|
||||
if sum(1 for k in cats if t.get("0:", {}).get(k, 0) > 0) < 2:
|
||||
return {"alpha": max(ALPHA_GRID), "logLik": None}
|
||||
best_a, best_ll, lls = ALPHA, -math.inf, {}
|
||||
for a in ALPHA_GRID:
|
||||
ll = 0
|
||||
for c, p in pairs:
|
||||
n = 0
|
||||
for x in c:
|
||||
n += x
|
||||
ll += lgamma(a) - lgamma(n + a)
|
||||
for i in range(len(cats)):
|
||||
ll += lgamma(c[i] + a * p[i]) - lgamma(a * p[i])
|
||||
lls[a] = ll
|
||||
if ll > best_ll:
|
||||
best_ll, best_a = ll, a
|
||||
return {"alpha": best_a, "logLik": lls}
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- 4. random numbers (reproducible from the seed)
|
||||
|
||||
class Rng:
|
||||
"""xorshift32, as in the original route model (JavaScript semantics)."""
|
||||
|
||||
def __init__(self, seed):
|
||||
self.s = (seed & 0xFFFFFFFF) or 1
|
||||
|
||||
def __call__(self):
|
||||
s = self.s
|
||||
s = (s ^ (s << 13)) & 0xFFFFFFFF
|
||||
s ^= s >> 17
|
||||
s = (s ^ (s << 5)) & 0xFFFFFFFF
|
||||
self.s = s
|
||||
return s / 4294967296
|
||||
|
||||
|
||||
def gamma(shape, rand):
|
||||
if shape < 1:
|
||||
g = gamma(shape + 1, rand)
|
||||
return g * math.pow(rand() or 1e-12, 1 / shape)
|
||||
d = shape - 1 / 3
|
||||
c = 1 / math.sqrt(9 * d)
|
||||
while True:
|
||||
while True:
|
||||
u1 = rand() or 1e-12
|
||||
u2 = rand()
|
||||
x = math.sqrt(-2 * math.log(u1)) * math.cos(2 * math.pi * u2)
|
||||
v = 1 + c * x
|
||||
if v > 0:
|
||||
break
|
||||
v = v * v * v
|
||||
u = rand()
|
||||
if u < 1 - 0.0331 * x ** 4 or math.log(u) < 0.5 * x * x + d * (1 - v + math.log(v)):
|
||||
return d * v
|
||||
|
||||
|
||||
def dirichlet(alpha, rand):
|
||||
g = [gamma(max(a, 1e-6), rand) for a in alpha]
|
||||
s = 0
|
||||
for x in g:
|
||||
s += x
|
||||
return [x / s for x in g]
|
||||
|
||||
|
||||
def _normalise(a):
|
||||
s = 0
|
||||
for x in a:
|
||||
s = s + x
|
||||
return [x / s for x in a]
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- 5. the probability source
|
||||
|
||||
class Params:
|
||||
"""Chance probabilities and encounter outcomes, as arrays over D worlds.
|
||||
|
||||
mode "mean": D = 1, posterior means. mode "draw": D = len(seeds), one joint posterior draw per seed (each
|
||||
distribution is drawn once, the first time it is needed, and reused, so a draw is one consistent world).
|
||||
In draw mode each world draws its numbers in the order its own walk of the game first needs them (a branch with
|
||||
probability exactly zero in that world is never walked), so call solver.draw_worlds() before using it.
|
||||
chance(node, state) -> {outcome: array(D)}; encounter(ctx) -> {outcome: array(D)}.
|
||||
|
||||
given: the run's givens (game.yaml `givens`, e.g. first or later attempt); having() gives the same worlds for
|
||||
other givens.
|
||||
"""
|
||||
|
||||
def __init__(self, T, mode="mean", seeds=(), alphas=None, given=None):
|
||||
self.T, self.mode, self.alphas = T, mode, alphas or {}
|
||||
self.given = {**DEFAULT_GIVEN, **(given or {})}
|
||||
self.rngs = [Rng(s) for s in seeds] if mode == "draw" else []
|
||||
self.D = len(self.rngs) if mode == "draw" else 1
|
||||
self.memo = {} # (node, level key) or ("enc", ctx) -> array (K, D)
|
||||
self.filled = {} # same keys -> bool array (D,): which worlds have drawn this distribution
|
||||
self.world = None # while drawing one world (see draw_world), its index
|
||||
self._cache = {}
|
||||
|
||||
def having(self, **given):
|
||||
"""The same odds (and the same posterior draws) for a run with other givens."""
|
||||
import copy
|
||||
p = copy.copy(self)
|
||||
p.given = {**self.given, **given}
|
||||
p._cache = {}
|
||||
return p
|
||||
|
||||
def _levels(self, node, state):
|
||||
sp = CHANCE[node]
|
||||
out = []
|
||||
for L in range(len(sp["context"]) + 1):
|
||||
names = sp["context"][:L]
|
||||
if any(state.get(k) is None for k in names):
|
||||
break
|
||||
out.append(f"{L}:{ctx_key(state, names)}")
|
||||
return out
|
||||
|
||||
def _get(self, mk, K, make_a):
|
||||
"""The distribution for key mk: drawn (or computed) the first time it is needed, then reused."""
|
||||
if self.mode == "mean":
|
||||
if mk not in self.memo:
|
||||
self.memo[mk] = np.array(_normalise(make_a(None)), dtype=float).reshape(K, 1)
|
||||
return self.memo[mk]
|
||||
if mk not in self.memo:
|
||||
self.memo[mk] = np.zeros((K, self.D))
|
||||
self.filled[mk] = np.zeros(self.D, dtype=bool)
|
||||
d = self.world
|
||||
if d is not None and not self.filled[mk][d]:
|
||||
self.memo[mk][:, d] = dirichlet([float(x) for x in make_a(d)], self.rngs[d])
|
||||
self.filled[mk][d] = True
|
||||
return self.memo[mk]
|
||||
|
||||
def chance(self, node, state):
|
||||
if not gate_open(node, state): # a closed gate: the roll always comes out the same way
|
||||
other = CHANCE[node]["otherwise"]
|
||||
return {k: np.full(self.D, 1.0 if k == other else 0.0) for k in CHANCE[node]["outcomes"]}
|
||||
state = {**self.given, **state}
|
||||
# once every world has been drawn, the answer depends only on the context values: cache it
|
||||
ck = (node, tuple(state.get(k) for k in CHANCE[node]["context"]))
|
||||
if self.world is None and ck in self._cache:
|
||||
return self._cache[ck]
|
||||
out = self._chance(node, state)
|
||||
if self.world is None:
|
||||
self._cache[ck] = out
|
||||
return out
|
||||
|
||||
def _chance(self, node, state):
|
||||
cats = CHANCE[node]["outcomes"]
|
||||
fitted = self.alphas.get(node) or ALPHA
|
||||
distinct = CHANCE[node].get("distinct", 0)
|
||||
p = None
|
||||
for L, key in enumerate(self._levels(node, state)):
|
||||
c = self.T[node].get(key, {})
|
||||
parent = p
|
||||
al = 1.0 if L <= distinct else fitted # a level that is not pooled keeps a token prior of one run
|
||||
|
||||
def make_a(d, c=c, parent=parent, al=al):
|
||||
if parent is None:
|
||||
return [c.get(k, 0) + 0.5 for k in cats]
|
||||
return [c.get(k, 0) + al * (parent[i] if d is None else parent[i][d]) for i, k in enumerate(cats)]
|
||||
p = self._get((node, key), len(cats), make_a)
|
||||
return dict(zip(cats, p))
|
||||
|
||||
def encounter(self, ctx):
|
||||
e = self.T["encounter"].get(ctx, {"outcomes": {}, "seen": {}})
|
||||
cats = [k for k in ENC_CATS if k == "burn" or e["seen"].get(k) or e["outcomes"].get(k, 0) > 0 or k == enc_colour(ctx)]
|
||||
p = self._get(("enc", ctx), len(cats), lambda d: [e["outcomes"].get(k, 0) + 0.5 for k in cats])
|
||||
return dict(zip(cats, p))
|
||||
@@ -0,0 +1,32 @@
|
||||
"""Read data/public/runs_clean.csv (written by `python -m collection build`) as typed records.
|
||||
|
||||
Every analysis reads the runs from this one published file. Types come from data/dictionary.yaml: integers and
|
||||
booleans are parsed, empty cells are None (data_flags is "" when a row has no flags).
|
||||
"""
|
||||
import csv
|
||||
from pathlib import Path
|
||||
|
||||
import yaml
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
PATH = ROOT / "data/public/runs_clean.csv"
|
||||
with open(ROOT / "data/dictionary.yaml", encoding="utf-8") as _f:
|
||||
TYPES = {k: v["type"] for k, v in yaml.safe_load(_f)["columns"].items()}
|
||||
|
||||
|
||||
def _parse(col, v):
|
||||
if v == "":
|
||||
return "" if col == "data_flags" else None
|
||||
t = TYPES.get(col, "text")
|
||||
if t == "integer":
|
||||
return int(v)
|
||||
if t == "boolean":
|
||||
return v == "True"
|
||||
return v
|
||||
|
||||
|
||||
def read(path=PATH, sources=None, drop=("run_id",)):
|
||||
"""Typed records, optionally only from some sources (the `source` column)."""
|
||||
with open(path, encoding="utf-8", newline="") as f:
|
||||
rows = [{k: _parse(k, v) for k, v in r.items() if k not in drop} for r in csv.DictReader(f)]
|
||||
return [r for r in rows if sources is None or r["source"] in sources]
|
||||
@@ -0,0 +1,424 @@
|
||||
"""The route model: best decisions for bonding each dragon colour.
|
||||
|
||||
The game tree is core/spec/game.yaml. One interpreter (Walker) walks it; three kinds of walk reuse it:
|
||||
|
||||
Solver backward induction: the best option at every decision (vectorised over posterior draws)
|
||||
Evaluator the value of a fixed policy (the one chosen on the posterior means) in every draw
|
||||
Exporter the published decision tree, following the chosen options
|
||||
|
||||
Two objectives per target colour X:
|
||||
1. "this attempt": maximise P(bond X on this attempt).
|
||||
2. "eventually": deaths are free (you can try again), so what matters is not ending the account on the wrong
|
||||
dragon: maximise P(X) / (P(X) + P(another colour)), by Dinkelbach iteration; ties go to the higher P(X).
|
||||
|
||||
Values are triples (x, o, r) of arrays over worlds: P(target), P(another colour), P(reaching an encounter alive).
|
||||
"""
|
||||
import numpy as np
|
||||
|
||||
from . import model, spec
|
||||
|
||||
G = spec.game()
|
||||
STEPS = G["steps"]
|
||||
LABEL = {**{k: v["label"] for k, v in G["decisions"].items()}, **{k: v["label"] for k, v in G["chance"].items()}}
|
||||
|
||||
|
||||
def canon(state):
|
||||
return tuple(sorted(state.items()))
|
||||
|
||||
|
||||
def apply(then, state, value):
|
||||
"""The state after an option or outcome: keep / drop, then set ($ = the value just taken)."""
|
||||
s = {k: state[k] for k in then["keep"] if k in state} if "keep" in then else dict(state)
|
||||
for k in then.get("drop", ()):
|
||||
s.pop(k, None)
|
||||
for k, v in (then.get("set") or {}).items():
|
||||
s[k] = value if v == "$" else v
|
||||
return s
|
||||
|
||||
|
||||
class Walker:
|
||||
"""Walks the game tree of game.yaml. Subclasses say what a decision, a roll, an ending and an encounter mean."""
|
||||
|
||||
def __init__(self, params, X, support, only=None):
|
||||
self.params, self.X, self.support, self.only = params, X, support, only
|
||||
|
||||
def options(self, name, state):
|
||||
by = G["decisions"][name].get("support_by")
|
||||
if by:
|
||||
return self.support.get(f"{name}:{state.get(by)}") or model.DECISIONS[name]
|
||||
return self.support[name]
|
||||
|
||||
def root(self):
|
||||
return self.run(G["start"], {})
|
||||
|
||||
def run(self, step_id, state):
|
||||
st = STEPS[step_id]
|
||||
if "decision" in st:
|
||||
name = st["decision"]
|
||||
return self.decision(name, state, self.options(name, state), lambda o: self.follow(st["then"], o, state))
|
||||
node = st["chance"]
|
||||
return self.chance(node, state, lambda k: self.follow(st["then"], k, state))
|
||||
|
||||
def follow(self, then, value, state):
|
||||
t = then.get(value) or then["default"]
|
||||
if "end" in t:
|
||||
return self.end(t["end"])
|
||||
s = apply(t, state, value)
|
||||
if "encounter" in t:
|
||||
ctx = t["encounter"].replace("$", value)
|
||||
opts = ["Die on purpose"] if self.only and ctx not in self.only else self.support["encounter"]
|
||||
return self.decision("encounter", {**s, "enc": ctx}, opts,
|
||||
lambda o: self.die_on_purpose() if o == "Die on purpose" else self.attempt(ctx))
|
||||
return self.run(t["go"], s)
|
||||
|
||||
|
||||
class _Values(Walker):
|
||||
"""Shared by Solver and Evaluator: values are (x, o, r) arrays over the worlds in params."""
|
||||
|
||||
def __init__(self, params, X, support, only=None):
|
||||
super().__init__(params, X, support, only)
|
||||
D = params.D
|
||||
self.ZERO = (np.zeros(D), np.zeros(D), np.zeros(D))
|
||||
self.REACHED = (np.zeros(D), np.zeros(D), np.ones(D))
|
||||
|
||||
def end(self, what):
|
||||
return self.ZERO
|
||||
|
||||
def die_on_purpose(self):
|
||||
return self.REACHED
|
||||
|
||||
def attempt(self, ctx):
|
||||
cache = self.__dict__.setdefault("_attempt", {})
|
||||
if ctx not in cache:
|
||||
cache[ctx] = self._attempt_value(ctx)
|
||||
return cache[ctx]
|
||||
|
||||
def _attempt_value(self, ctx):
|
||||
x = 0
|
||||
oth = 0
|
||||
for k, p in self.params.encounter(ctx).items():
|
||||
if k != "burn":
|
||||
if k == self.X:
|
||||
x = x + p
|
||||
else:
|
||||
oth = oth + p
|
||||
D = self.params.D
|
||||
return (np.broadcast_to(x, D).astype(float), np.broadcast_to(oth, D).astype(float), np.ones(D))
|
||||
|
||||
def chance(self, node, state, cont):
|
||||
acc = self.ZERO
|
||||
for k, p in self.params.chance(node, state).items():
|
||||
if not np.any(p):
|
||||
continue
|
||||
v = cont(k)
|
||||
acc = (acc[0] + p * v[0], acc[1] + p * v[1], acc[2] + p * v[2])
|
||||
return acc
|
||||
|
||||
|
||||
class Solver(_Values):
|
||||
"""Backward induction. lam: scalar or array (one per world). After root(): .value, .choices, .option_values."""
|
||||
|
||||
def __init__(self, params, X, support, lam=0.0, record=False, only=None):
|
||||
super().__init__(params, X, support, only)
|
||||
self.lam = lam
|
||||
self.memo, self.choices = {}, {}
|
||||
self.option_values = {} if record else None
|
||||
|
||||
def score(self, v):
|
||||
lam = self.lam
|
||||
return (1 - lam) * v[0] - lam * v[1] + 1e-9 * v[0] - 1e-12 * v[1]
|
||||
|
||||
def decision(self, name, state, options, cont):
|
||||
key = (name, canon(state))
|
||||
if key in self.memo:
|
||||
return self.memo[key]
|
||||
top = arg = None
|
||||
vals = {}
|
||||
for i, o in enumerate(options):
|
||||
v = cont(o)
|
||||
vals[o] = v
|
||||
if top is None:
|
||||
top, arg = v, np.zeros(self.params.D, dtype=int)
|
||||
else:
|
||||
better = self.score(v) > self.score(top)
|
||||
top = tuple(np.where(better, v[j], top[j]) for j in range(3))
|
||||
arg = np.where(better, i, arg)
|
||||
self.memo[key] = top
|
||||
self.choices[key] = (list(options), arg)
|
||||
if self.option_values is not None:
|
||||
self.option_values[key] = vals
|
||||
return top
|
||||
|
||||
def solve(self):
|
||||
self.value = self.root()
|
||||
self.memo.clear() # the values are no longer needed; posterior draws keep only their choices
|
||||
return self
|
||||
|
||||
def decide(self, name, state, world=0):
|
||||
opts, arg = self.choices[(name, canon(state))]
|
||||
return opts[int(arg[world])]
|
||||
|
||||
|
||||
class Evaluator(_Values):
|
||||
"""The value of a fixed policy: decide(name, state) -> option, in every world of params."""
|
||||
|
||||
def __init__(self, params, X, support, decide, only=None):
|
||||
super().__init__(params, X, support, only)
|
||||
self.decide = decide
|
||||
|
||||
def decision(self, name, state, options, cont):
|
||||
return cont(self.decide(name, state))
|
||||
|
||||
|
||||
class Exporter(Walker):
|
||||
"""The published tree: at decisions the chosen option, every option's value (each followed by the best play
|
||||
afterwards) and how often it stays best across posterior draws; at rolls every branch and its probability.
|
||||
Only the chosen option's subtree is expanded."""
|
||||
|
||||
def __init__(self, params, X, support, sol, draws, min_show=1e-4, only=None):
|
||||
super().__init__(params, X, support, only)
|
||||
self.sol, self.draws, self.min_show = sol, draws, min_show
|
||||
|
||||
def decision(self, name, state, options, cont):
|
||||
key = (name, canon(state))
|
||||
chosen = self.sol.decide(name, state)
|
||||
ov = self.sol.option_values.get(key, {})
|
||||
xs = sorted((float(v[0][0]) for v in ov.values()), reverse=True)
|
||||
tie = len(xs) > 1 and xs[0] - xs[1] < 1e-12 # nothing to choose between (e.g. every option ends the run)
|
||||
still = None
|
||||
if not tie and self.draws is not None:
|
||||
opts, arg = self.draws.choices[key]
|
||||
ok = arg == opts.index(chosen)
|
||||
reached = getattr(self.draws.params, "reached", {}).get(key)
|
||||
if reached is not None:
|
||||
ok = ok & reached
|
||||
still = int(np.sum(ok)) / len(arg)
|
||||
return {
|
||||
"type": "decision", "var": name, "label": LABEL[name], "choice": chosen, "tie": tie, "stillBest": still,
|
||||
"options": {o: {"pX": float(v[0][0]), "pOther": float(v[1][0]), "pReach": float(v[2][0])} for o, v in ov.items()},
|
||||
"next": cont(chosen),
|
||||
}
|
||||
|
||||
def chance(self, node, state, cont):
|
||||
dist = self.params.chance(node, state)
|
||||
return {"type": "chance", "var": node, "label": LABEL[node],
|
||||
"branches": {k: {"p": float(p[0]), "next": cont(k)} for k, p in dist.items() if float(p[0]) >= self.min_show}}
|
||||
|
||||
def end(self, what):
|
||||
return {"type": "end", "what": what}
|
||||
|
||||
def die_on_purpose(self):
|
||||
return self.end("die on purpose")
|
||||
|
||||
def attempt(self, ctx):
|
||||
return {"type": "end", "what": f"encounter: {ctx}", "outcomes": {k: float(p[0]) for k, p in self.params.encounter(ctx).items()}}
|
||||
|
||||
|
||||
class _Drawer(Walker):
|
||||
"""Walks the game in one world only, drawing its distributions in the order the walk first needs them and
|
||||
skipping branches with probability exactly zero in that world. Records which decisions the world reaches."""
|
||||
|
||||
def __init__(self, params, support, world, reached):
|
||||
super().__init__(params, None, support)
|
||||
self.d, self.seen, self.reached = world, set(), reached
|
||||
|
||||
def decision(self, name, state, options, cont):
|
||||
key = (name, canon(state))
|
||||
if key in self.seen:
|
||||
return
|
||||
self.seen.add(key)
|
||||
self.reached.setdefault(key, np.zeros(self.params.D, dtype=bool))[self.d] = True
|
||||
for o in options:
|
||||
cont(o)
|
||||
|
||||
def chance(self, node, state, cont):
|
||||
for k, p in self.params.chance(node, state).items():
|
||||
if p[self.d]:
|
||||
cont(k)
|
||||
|
||||
def attempt(self, ctx):
|
||||
self.params.encounter(ctx)
|
||||
|
||||
def end(self, what):
|
||||
return None
|
||||
|
||||
def die_on_purpose(self):
|
||||
return None
|
||||
|
||||
|
||||
def draw_worlds(T, seeds, alphas, support):
|
||||
"""Posterior draws, one world per seed, each drawn in its own walk of the game (see Params)."""
|
||||
p = model.Params(T, "draw", seeds=seeds, alphas=alphas)
|
||||
p.reached = {}
|
||||
default = dict(p.given)
|
||||
for d in range(p.D):
|
||||
p.world = d
|
||||
_Drawer(p, support, d, p.reached).root()
|
||||
# the same world for runs with other givens (a first attempt): only the rolls that depend on them are new
|
||||
for given in other_givens():
|
||||
p.given = {**default, **given}
|
||||
_Drawer(p, support, d, {}).root()
|
||||
p.given = default
|
||||
p.world = None
|
||||
return p
|
||||
|
||||
|
||||
def other_givens():
|
||||
"""Every non-default value of every given in game.yaml, one at a time: [{"attempt": "First attempt"}]."""
|
||||
return [{k: v} for k, g in model.GIVENS.items() for v in g["values"] if v != g["default"]]
|
||||
|
||||
|
||||
def given_key(given):
|
||||
"""The name a non-default given's results are published under: {"attempt": "First attempt"} -> "firstAttempt"."""
|
||||
words = " ".join(given.values()).split()
|
||||
return words[0].lower() + "".join(w.capitalize() for w in words[1:])
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- objectives
|
||||
|
||||
def solve(params, X, support, lam=0.0, record=False, only=None):
|
||||
return Solver(params, X, support, lam=lam, record=record, only=only).solve()
|
||||
|
||||
|
||||
def solve_ratio(params, X, support, record=False, only=None):
|
||||
"""Dinkelbach: lam* = max P(X) / (P(X) + P(other)), separately in every world (at most 30 updates each)."""
|
||||
D = params.D
|
||||
lam = np.zeros(D)
|
||||
s = solve(params, X, support, lam=lam, only=only)
|
||||
done = np.zeros(D, dtype=bool)
|
||||
for _ in range(30):
|
||||
x, o = s.value[0], s.value[1]
|
||||
tot = x + o
|
||||
r = np.where(tot > 0, x / np.where(tot > 0, tot, 1), 0.0)
|
||||
done = done | (np.abs(r - lam) < 1e-10)
|
||||
if done.all():
|
||||
break
|
||||
lam = np.where(done, lam, r)
|
||||
s = solve(params, X, support, lam=lam, only=only)
|
||||
if record:
|
||||
s = solve(params, X, support, lam=lam, record=True, only=only)
|
||||
s.lam = lam
|
||||
return s
|
||||
|
||||
|
||||
def evaluate(params, X, support, decide, only=None):
|
||||
return Evaluator(params, X, support, decide, only=only).root()
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- summaries
|
||||
|
||||
def _sum(xs):
|
||||
s = 0
|
||||
for x in xs:
|
||||
s += x
|
||||
return s
|
||||
|
||||
|
||||
def quantile(xs, q):
|
||||
s = sorted(xs)
|
||||
i = (len(s) - 1) * q
|
||||
lo, hi = int(np.floor(i)), int(np.ceil(i))
|
||||
return s[lo] + (s[hi] - s[lo]) * (i - lo)
|
||||
|
||||
|
||||
def summarise(xs):
|
||||
xs = [float(x) for x in xs]
|
||||
return {"mean": _sum(xs) / len(xs), "lo": quantile(xs, 0.025), "hi": quantile(xs, 0.975)}
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- the published policy
|
||||
|
||||
def build_policy(runs, draws=200, seed=20261101, min_support=None, alpha=None, colours=None, bias_config=None):
|
||||
"""The full policy for every colour. runs: coded runs (data/public/runs_clean.csv), as dicts. bias_config:
|
||||
planner/policy.yaml `reporting_bias` (None: every run counts as reported)."""
|
||||
colours = colours or model.COLOURS
|
||||
min_support = G["min_support"] if min_support is None else min_support
|
||||
prepared = [model.prepare_run(r) for r in runs]
|
||||
bias_est, w = None, None
|
||||
if bias_config:
|
||||
from . import bias
|
||||
bias_est, names = bias.estimate(runs, prepared, bias_config, set(model.RARE_GOALS))
|
||||
w = bias.weights(names, prepared, bias_est, bias_config["rolls"])
|
||||
T = model.count_tables(prepared, w)
|
||||
support, counts = model.support_from(prepared, min_support)
|
||||
fitted = {k: model.fit_alpha(T, k) for k in model.CHANCE}
|
||||
alphas = {k: alpha for k in model.CHANCE} if alpha else {k: f["alpha"] for k, f in fitted.items()}
|
||||
mean = model.Params(T, "mean", alphas=alphas)
|
||||
drawp = draw_worlds(T, [seed + i * 7919 for i in range(draws)], alphas, support)
|
||||
# Cross-fitting: choose the policy on one random half of the runs and score it on the other half.
|
||||
r = model.Rng(seed)
|
||||
fold = [0 if r() < 0.5 else 1 for _ in prepared]
|
||||
halves = [model.count_tables([v for v, f in zip(prepared, fold) if f == h],
|
||||
[x for x, f in zip(w, fold) if f == h] if w else None) for h in (0, 1)]
|
||||
half_params = [model.Params(Th, "mean", alphas=alphas) for Th in halves]
|
||||
|
||||
targets = {}
|
||||
for X in colours:
|
||||
one = solve(mean, X, support, record=True)
|
||||
ratio = solve_ratio(mean, X, support, record=True)
|
||||
d_one = solve(drawp, X, support)
|
||||
d_ratio = solve_ratio(drawp, X, support)
|
||||
ev_one = evaluate(drawp, X, support, one.decide)
|
||||
ev_ratio = evaluate(drawp, X, support, ratio.decide)
|
||||
|
||||
def block(sol, ev, dr):
|
||||
x, o = ev[0], ev[1]
|
||||
return {
|
||||
"pX": {**summarise(x), "point": float(sol.value[0][0])},
|
||||
"pOther": {**summarise(o), "point": float(sol.value[1][0])},
|
||||
"ratio": summarise([xi / (xi + oi) if xi + oi else 0 for xi, oi in zip(x, o)]),
|
||||
"expectedAttempts": summarise([1 / xi if xi > 0 else float("inf") for xi in x]),
|
||||
"tree": Exporter(mean, X, support, sol, dr).root(),
|
||||
}
|
||||
|
||||
cross = []
|
||||
for f in (0, 1):
|
||||
pol = solve(half_params[f], X, support)
|
||||
cross.append({"inSample": float(pol.value[0][0]),
|
||||
"heldOut": float(evaluate(half_params[1 - f], X, support, pol.decide)[0][0])})
|
||||
targets[X] = {
|
||||
"thisAttempt": block(one, ev_one, d_one), "eventually": block(ratio, ev_ratio, d_ratio),
|
||||
"crossFit": {"inSample": (cross[0]["inSample"] + cross[1]["inSample"]) / 2,
|
||||
"heldOut": (cross[0]["heldOut"] + cross[1]["heldOut"]) / 2},
|
||||
}
|
||||
# Runs with another given (a first attempt). "This attempt" is solved as above. "Eventually": every attempt
|
||||
# after it is an ordinary one, worth the default's ratio (lam), so the best play maximises
|
||||
# P(X now) + P(no bond now) * lam, which is the same score with lam fixed.
|
||||
later = [xi / (xi + oi) if xi + oi else 0.0 for xi, oi in zip(ev_ratio[0], ev_ratio[1])]
|
||||
for given in other_givens():
|
||||
m1, d1 = mean.having(**given), drawp.having(**given)
|
||||
g_one = solve(m1, X, support, record=True)
|
||||
g_ev = solve(m1, X, support, lam=ratio.lam, record=True)
|
||||
e_one = evaluate(d1, X, support, g_one.decide)
|
||||
e_ev = evaluate(d1, X, support, g_ev.decide)
|
||||
|
||||
def gblock(sol, ev, dr, m1=m1):
|
||||
x, o = ev[0], ev[1]
|
||||
return {"pX": {**summarise(x), "point": float(sol.value[0][0])},
|
||||
"pOther": {**summarise(o), "point": float(sol.value[1][0])},
|
||||
"tree": Exporter(m1, X, support, sol, dr).root()}
|
||||
ev_block = gblock(g_ev, e_ev, solve(d1, X, support, lam=d_ratio.lam))
|
||||
x0, o0 = float(g_ev.value[0][0]), float(g_ev.value[1][0])
|
||||
ev_block["pEventually"] = {**summarise([x + (1 - x - o) * r for x, o, r in zip(e_ev[0], e_ev[1], later)]),
|
||||
"point": x0 + (1 - x0 - o0) * float(np.ravel(ratio.lam)[0])}
|
||||
targets[X][given_key(given)] = {"given": given, "thisAttempt": gblock(g_one, e_one, solve(d1, X, support)),
|
||||
"eventually": ev_block}
|
||||
return {
|
||||
"schema": 1,
|
||||
"model": {
|
||||
"description": "Decision tree with perfect recall; chance probabilities depend on earlier choices via hierarchical Dirichlet back-off.",
|
||||
"alphas": alphas, "alphaFit": {k: f["logLik"] for k, f in fitted.items()}, "draws": draws, "seed": seed,
|
||||
"minSupport": min_support,
|
||||
"chanceContext": {k: s["context"] for k, s in model.CHANCE.items()},
|
||||
"given": model.DEFAULT_GIVEN,
|
||||
"decisions": model.DECISIONS, "support": support, "supportCounts": counts,
|
||||
"tables": T,
|
||||
# how much each kind of source over-reports each rare roll, and the correction applied (bias.py)
|
||||
"reportingBias": bias_est,
|
||||
# the game itself (core/spec/game.yaml), so the advisor in core/solver.js can re-solve from any point
|
||||
"game": {k: G[k] for k in ("version", "colours", "givens", "decisions", "chance", "encounters", "encounter_outcomes",
|
||||
"by_colour", "start", "steps", "from_form", "bot_text")},
|
||||
},
|
||||
"data": {"runs": len(runs)},
|
||||
"targets": targets,
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
"""Load the declarative spec files in core/spec/."""
|
||||
from functools import lru_cache
|
||||
from pathlib import Path
|
||||
|
||||
import yaml
|
||||
|
||||
SPEC_DIR = Path(__file__).resolve().parent.parent / "spec"
|
||||
|
||||
|
||||
@lru_cache(maxsize=None)
|
||||
def load(name):
|
||||
"""The parsed contents of core/spec/<name>.yaml (cached; treat as read-only)."""
|
||||
with open(SPEC_DIR / f"{name}.yaml", encoding="utf-8") as f:
|
||||
return yaml.safe_load(f)
|
||||
|
||||
|
||||
def form():
|
||||
return load("form")
|
||||
|
||||
|
||||
def game():
|
||||
return load("game")
|
||||
@@ -15,9 +15,6 @@
|
||||
* shadow odds), `fix` (hold some decisions to given options: an experiment arm) and sampling "uniform" (mapping);
|
||||
* assign(plan, { accountSeq, attempt }) reads the experiment plan (experiments.json) and says what an attempt is for;
|
||||
* screenPick(tree, sceneId, offered, { mode }) picks from the screen tree (tree.json): least-tried, or Thompson.
|
||||
* knownAnswer(known, offered, { target, sceneColour }) looks a screen's choices up in known_answers.json (the guide's
|
||||
* encounter answers and the bot's own results) for screens nothing else covers: a pick when the evidence is clear,
|
||||
* and the evidence for every choice either way, to hand to Clef (issue #35).
|
||||
* UMD: window.ThreshSolver in the browser, module.exports in Node. No dependencies.
|
||||
*/
|
||||
(function (root, factory) {
|
||||
@@ -449,68 +446,8 @@
|
||||
reason: mode === "thompson" ? `survived ${pick.survived} of ${pick.n} so far` : `played ${pick.n} times, the fewest on this screen` };
|
||||
}
|
||||
|
||||
/* ---------- known answers (analysis/known/build_known.py -> data/public/known_answers.json) ---------- */
|
||||
const STOP = new Set("a an the to and or of your you its it is for at in on with this that be".split(" "));
|
||||
const words = (t) => norm(t).split(" ").filter((w) => w && !STOP.has(w));
|
||||
/** The guide labels a game text carries: the guide paraphrases ("Touch its talon"), the game says it in full ("Reach a
|
||||
* hand slowly to touch its talon"), so a label matches when every word of it that matters is in the text. Labels of
|
||||
* fewer than two such words ("Is your dragon") only match a text that is exactly the label. */
|
||||
function guideMatches(known, text) {
|
||||
const n = norm(text), have = new Set(words(text)), out = [];
|
||||
for (const [k, e] of Object.entries(known.answers || {})) {
|
||||
if (!e.guide) continue;
|
||||
const w = words(e.text);
|
||||
const exact = k === n;
|
||||
if (exact || (w.length >= 2 && w.every((x) => have.has(x)))) e.guide.forEach((g) => out.push({ ...g, label: e.text, exact }));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* A screen nothing else covers: what the Atlas knows about each choice, and a pick when it is clear.
|
||||
* known data/public/known_answers.json
|
||||
* offered the choice texts on screen, in order
|
||||
* target the colour the account is after ("Blue"); sceneColour: the colour of this scene's dragon, if the
|
||||
* bot knows it (only the guide's answers for that dragon's encounters are used then)
|
||||
* Returns { pick, confidence, reason, choices }: pick is the index to take (null if nothing is clear), confidence
|
||||
* "strong" (exactly one choice is on the guide's recommended path toward the target, and the bot's own runs don't
|
||||
* contradict it) or "weak" (several fit, or only the bot's own record speaks for it). choices[i].verdict is "good",
|
||||
* "bad" (the guide ends it in incineration, or the bot died on it at least 3 times in 4) or "unknown", with the
|
||||
* evidence behind it. Anything weak or unknown goes to Clef with this evidence; a pick never skips the bot's guard.
|
||||
*/
|
||||
function knownAnswer(known, offered, { target, sceneColour = null } = {}) {
|
||||
const T = target ? target[0].toUpperCase() + target.slice(1).toLowerCase() : null;
|
||||
const choices = offered.map((text, index) => {
|
||||
const e = (known.answers || {})[norm(text)] || {};
|
||||
const bot = e.bot || null;
|
||||
const guide = guideMatches(known, text).filter((g) => !sceneColour || (g.colours || []).includes(sceneColour));
|
||||
const onPath = guide.filter((g) => T && (g.on_path || []).includes(T));
|
||||
const botBad = bot && bot.n >= 2 && bot.died / bot.n >= 0.75;
|
||||
const botGood = bot && bot.n >= 3 && bot.died === 0;
|
||||
const guideBad = guide.length > 0 && guide.every((g) => /^Incinerated/.test(g.end));
|
||||
const verdict = onPath.length && !botBad ? "good" : guideBad || botBad ? "bad" : "unknown";
|
||||
return { index, text, verdict, guide, bot, onPath: onPath.length > 0, botGood: !!botGood };
|
||||
});
|
||||
const good = choices.filter((c) => c.verdict === "good");
|
||||
let pick = null, confidence = null, reason = "nothing the Atlas knows covers these choices";
|
||||
if (good.length === 1) {
|
||||
pick = good[0].index; confidence = "strong";
|
||||
reason = `on the guide's recommended path to the ${T} ("${good[0].onPath && good[0].guide.find((g) => (g.on_path || []).includes(T)).label}")`;
|
||||
} else if (good.length > 1) {
|
||||
const best = good.find((c) => c.botGood) || good[0];
|
||||
pick = best.index; confidence = "weak"; reason = `${good.length} choices are on the guide's paths; the bot's record favours none clearly`;
|
||||
} else {
|
||||
const safe = choices.filter((c) => c.botGood && c.verdict !== "bad");
|
||||
if (safe.length) {
|
||||
const b = safe.reduce((x, y) => (y.bot.n > x.bot.n ? y : x));
|
||||
pick = b.index; confidence = "weak"; reason = `the bot got through it ${b.bot.n} of ${b.bot.n} times`;
|
||||
}
|
||||
}
|
||||
return { pick, confidence, reason, choices };
|
||||
}
|
||||
|
||||
return Object.assign(api, {
|
||||
advisor, recommendOption, solverHistory, norm, assign, armFor, givenFor, screenPick, knownAnswer,
|
||||
advisor, recommendOption, solverHistory, norm, assign, armFor, givenFor, screenPick,
|
||||
makeParams: (T, { alphas, game } = {}) => makeParams(T, { alphas, game: game || api.game }),
|
||||
/** remember the game of a policy sample (sets ENCOUNTERS) without solving anything */
|
||||
useGame(sample) { api.game = sample.model.game; api.ENCOUNTERS = api.game.by_colour; return api.game; },
|
||||
@@ -153,41 +153,5 @@ sighting_pool:
|
||||
1 Squadmate: { East: [Green, Orange, Red], West: [Red, Brown, Green], Center: [Red, Brown] }
|
||||
2 Squadmates: { East: [Red, Orange], West: [Green, Brown, Red], Center: [Red, Brown] }
|
||||
|
||||
# The dragons each bonding encounter can end with (bond or burn), from the community PDF. Only used to FLAG runs
|
||||
# answered through "Report a run" (reported, reddit comment) that end with a dragon the encounter does not have.
|
||||
# Orange and Brown after the two Greens: a Green's rescue, then the Orange or Brown.
|
||||
# Flags (data_flags, matched as text inside a flag) that mean a run cannot have happened as recorded: the game's own
|
||||
# rules, from the form coder (core/atlas/coding.py) and the checks of collection/etl/runs.py rule_flags. A run with one
|
||||
# is kept in runs_clean.csv, flagged, and left out of the route model and the site statistics (atlas.runs.impossible).
|
||||
# Everything else, however partial, is used. Not here on purpose: a first sighting outside the documented pool (the
|
||||
# pool is what riders have seen, not a rule), a missing direction, several wings, a missing Green before a rescue.
|
||||
impossible_flags:
|
||||
- "Green recorded on a Valley run"
|
||||
- "Black recorded on a Valley run"
|
||||
- "encounter, which has only"
|
||||
- "more than one dragon marked Bonded"
|
||||
- "more than one dragon marked Incinerated"
|
||||
- "tree run with both the Red and the two Greens attempted"
|
||||
- "died in combat on a path without combat"
|
||||
- "rare-dragon answer does not match the path"
|
||||
- "does not follow"
|
||||
- "fight answers on a run that did not help"
|
||||
- "a path after the fight on a run without a fight"
|
||||
- "a second fight move without pausing to assess"
|
||||
- "died before the hour, yet reached"
|
||||
|
||||
encounter_colours:
|
||||
"Shadow (rare)": [Blue, Black]
|
||||
"Descend quickly: Red": [Red]
|
||||
"Descend quickly: let the Red pass": [Green]
|
||||
"Descend slowly: two Greens": [Green, Orange, Brown]
|
||||
"Valley Red": [Red]
|
||||
"Passed the Red: meadow": [Orange, Brown, Blue]
|
||||
|
||||
# First-sighting answers that are not a single colour: coded as this colour, and the row is flagged with the
|
||||
# original answer (data_flags), so nothing is lost.
|
||||
first_sighting_alias:
|
||||
"2 Greens": Green
|
||||
|
||||
# How a bulk-pasted row's attempt answer is read
|
||||
attempt_words: { first: 1, second: 2, third: 3, fourth: 4, fifth: 5 }
|
||||
@@ -0,0 +1,249 @@
|
||||
# The threshing as a game tree: every choice a rider makes (decisions), every roll of the dice (chance events),
|
||||
# and every bonding encounter, in the game's own order.
|
||||
#
|
||||
# This file is the single source of truth for the route model. core/atlas/solver.py builds the decision tree from
|
||||
# it, and the route advisor used by the site and Ken's bot reads the same file (published as game.json).
|
||||
# Adding a choice to the game means adding it here (plus, if the form records it, how in core/atlas/model.py).
|
||||
version: 1
|
||||
|
||||
# Colours in the order the route model reports them
|
||||
colours: [Red, Orange, Brown, Green, Blue, Black]
|
||||
|
||||
# ---------------------------------------------------------------- givens: what a run starts with
|
||||
# Known before the first choice; neither decided nor rolled. A roll can depend on a given by naming it in its
|
||||
# context. The route model solves the game once per value; `default` is the one used when nothing is said.
|
||||
givens:
|
||||
attempt:
|
||||
label: Attempt
|
||||
# from the run's attempt number (attempt_group in data/public/runs_clean.csv)
|
||||
values: [First attempt, Later attempt]
|
||||
default: Later attempt
|
||||
|
||||
# ---------------------------------------------------------------- decisions: the rider's choices
|
||||
# options: every option the game offers, in a fixed order (ties go to the first). Options seen fewer than
|
||||
# min_support times in the data are not recommended, except where `always_offered` says so.
|
||||
decisions:
|
||||
company: { label: Company, options: [Alone, 1 Squadmate, 2 Squadmates] }
|
||||
leave: { label: Your squadmates, options: [Stay together, Leave them] }
|
||||
direction: { label: First direction, options: [East, West, Center] }
|
||||
react:
|
||||
label: Facing the first dragon
|
||||
# the form's categories; which ones each dragon offers is learned per first dragon (support key react:<fs>)
|
||||
options: [Hold still, Respect / face it, Retreat / run, Hide, Weapon, Meet its gaze, Protect squadmate]
|
||||
support_by: fs
|
||||
scream: { label: The scream, options: [Investigate the scream, Keep walking] }
|
||||
clearing: { label: The clearing (your squadmate vs two bullies), options: [Help your squadmate, Walk away] }
|
||||
fight: { label: "The fight: your first move", options: [Pause to assess, Charge the smaller cadet, Charge between the bigger cadet and your squadmate] }
|
||||
dagger: { label: The smaller cadet's dagger, options: [Engage the smaller cadet, Charge the bigger cadet anyway] }
|
||||
fate: { label: The bullies' fate, options: [Killed the bullies yourself, Squadmate's revenge, Left bullies to the dragons] }
|
||||
wounded: { label: The wounded cadet, options: [Tourniquet, Left injured cadet, Took their weapons] }
|
||||
post: { label: Fork in the road, options: [Forest, West, East] }
|
||||
hour: { label: After an hour, options: [Tree, Valley] }
|
||||
descend: { label: Climb down, options: [Quickly (Red), Slowly (two Greens)] }
|
||||
red:
|
||||
label: The Red below the tree
|
||||
options: [Jump onto the Red, Let it pass (two Greens)]
|
||||
# rarely logged on its own, but letting it pass leads to the two Greens' encounter, which has plenty of data
|
||||
always_offered: true
|
||||
valley: { label: Valley centre, options: [Face the Red, Pass the Red (meadow)] }
|
||||
encounter: { label: Bonding encounter, options: [Attempt the bond, Die on purpose], always_offered: true }
|
||||
# the whole cadet encounter as one answer (how the community form records it)
|
||||
cadet:
|
||||
label: Cadet encounter
|
||||
options: [Killed the bullies yourself, Squadmate's revenge, Left bullies to the dragons, Tourniquet, Left injured cadet, Took their weapons, Left them to it]
|
||||
summary_only: true
|
||||
|
||||
min_support: 20
|
||||
|
||||
# ---------------------------------------------------------------- chance events: the game's rolls
|
||||
# outcomes: in a fixed order. context: the earlier steps the odds may depend on, most important first; the
|
||||
# estimate for a full context is shrunk toward the estimate for a shorter one (hierarchical Dirichlet back-off,
|
||||
# strength learned from the data). distinct: the first N context steps are not pooled at all: each of their values
|
||||
# is its own roll (only a token prior of one run ties it to the rest). requires: earlier choices without which the
|
||||
# roll always comes out as `otherwise` (a gate); runs that did not make them say nothing about the roll and are
|
||||
# not counted.
|
||||
chance:
|
||||
fs: { label: First dragon, outcomes: [Red, Brown, Green, Orange], context: [direction, company, left] }
|
||||
# rolls that can kill you: risk_label names the danger when the advisor reports it
|
||||
dieSight: { label: Survive the first dragon, outcomes: [die, live], context: [fs, direction, company, left, react], risk_label: Killed at the first sighting }
|
||||
dieCombat: { label: Survive the fight, outcomes: [die, live], context: [fight, dagger, fs, direction], risk_label: Killed in the fight }
|
||||
dieHour: { label: Survive the hour, outcomes: [die, live], context: [cadet, post], risk_label: Killed before the hour }
|
||||
shadow:
|
||||
label: Shadow at the tree
|
||||
# Not dice. The developer has said the seed plays no part in whether the Black shows itself: it shows when the
|
||||
# rider's choices meet its conditions (planner/knowledge.yaml). The conditions are not known yet, so the model
|
||||
# still treats it as a roll: the number is the share of runs like this one that met them, which is our
|
||||
# ignorance, not the game's chance. `guard` marks that for the page and the reports.
|
||||
guard: true
|
||||
outcomes: ["yes", "no"]
|
||||
# The shadow is close to a first-attempt event (November 2026, form submissions, gated tree runs: 69 shadows in
|
||||
# 748 first attempts, 7 in 1,995 later ones, the same in every week), so first and later attempts are two
|
||||
# different rolls. Routes are then pooled within each.
|
||||
context: [attempt, cadet, post, fs, direction, company]
|
||||
distinct: 1
|
||||
# the "Black Dragon Gates" of the community route PDF (November 2026). The runs agree: in the spreadsheet,
|
||||
# 78 shadows in 4199 tree runs that investigated and helped, 2 (both form submissions) in 646 that did not.
|
||||
requires: { scream: Investigate the scream, clearing: Help your squadmate }
|
||||
otherwise: "no"
|
||||
# After the shadow comes a Blue (at the redwood), then the Black: riders' notes describe one sequence, and the
|
||||
# Blue is a trial on the way (analysis/reports/BLACK.md section 5). The form records only which dragon ended the
|
||||
# run, so this is counted as "reached the Black" against "died at the Blue".
|
||||
shadowColour: { label: "After the shadow: past the Blue to the Black", outcomes: [Black, Blue], context: [] }
|
||||
meadow: { label: Meadow dragon, outcomes: [Orange, Brown, Blue], context: [cadet, post, fs, direction, company] }
|
||||
|
||||
# Bonding encounters: where each colour can be bonded. A run can only bond the encounter's own colour, except at
|
||||
# the two Greens, where an Orange or a Brown can swoop in (`also`). A recorded bond with any other colour is a
|
||||
# data-entry error and is not counted.
|
||||
encounters:
|
||||
valley-Red: { label: The valley Red, colour: Red }
|
||||
tree-Red: { label: The Red below the tree, colour: Red }
|
||||
tree-Greens: { label: The two Greens, colour: Green, also: [Orange, Brown] }
|
||||
meadow-Orange: { label: The meadow Orange, colour: Orange }
|
||||
meadow-Brown: { label: The meadow Brown, colour: Brown }
|
||||
meadow-Blue: { label: The meadow Blue, colour: Blue }
|
||||
shadow-Blue: { label: The Blue at the redwood, colour: Blue }
|
||||
shadow-Black: { label: The Black (the shadow), colour: Black }
|
||||
encounter_outcomes: [burn, Red, Orange, Brown, Green, Blue, Black]
|
||||
by_colour:
|
||||
Red: [valley-Red, tree-Red]
|
||||
Orange: [meadow-Orange, tree-Greens]
|
||||
Brown: [meadow-Brown, tree-Greens]
|
||||
Green: [tree-Greens]
|
||||
Blue: [meadow-Blue, shadow-Blue]
|
||||
Black: [shadow-Black]
|
||||
|
||||
# ---------------------------------------------------------------- the flow of a run
|
||||
# Each step is a decision, a chance event or an encounter, keyed by the history so far (the "state").
|
||||
# After an option or outcome, `then` says what happens: `set` adds to the state ($ = the option or outcome just
|
||||
# taken), `keep` / `drop` remove steps nothing later depends on, `go` names the next step, `end` finishes the run
|
||||
# (with a death, the value is zero). `default` covers every option without its own entry.
|
||||
start: company
|
||||
steps:
|
||||
company:
|
||||
decision: company
|
||||
then:
|
||||
Alone: { set: { company: $, left: (alone) }, go: direction }
|
||||
default: { set: { company: $ }, go: leave }
|
||||
leave:
|
||||
decision: leave
|
||||
then: { default: { set: { left: $ }, go: direction } }
|
||||
direction:
|
||||
decision: direction
|
||||
then: { default: { set: { direction: $ }, go: first_dragon } }
|
||||
first_dragon:
|
||||
chance: fs
|
||||
then: { default: { set: { fs: $ }, go: react } }
|
||||
react:
|
||||
decision: react
|
||||
then: { default: { set: { react: $ }, go: survive_sighting } }
|
||||
survive_sighting:
|
||||
chance: dieSight
|
||||
then:
|
||||
die: { end: incinerated at the first sighting }
|
||||
# leaving your squadmates and your reaction only matter at the first dragon
|
||||
live: { keep: [company, direction, fs], go: scream }
|
||||
scream:
|
||||
decision: scream
|
||||
then:
|
||||
Keep walking: { set: { scream: $ }, go: wounded }
|
||||
Investigate the scream: { set: { scream: $ }, go: clearing }
|
||||
wounded:
|
||||
decision: wounded
|
||||
then: { default: { set: { cadet: $, post: (no fork) }, go: survive_hour } }
|
||||
clearing:
|
||||
decision: clearing
|
||||
then:
|
||||
Walk away: { set: { clearing: $, cadet: Left them to it, post: (no fork) }, go: survive_hour }
|
||||
Help your squadmate: { set: { clearing: $ }, go: fight }
|
||||
fight:
|
||||
decision: fight
|
||||
then:
|
||||
Pause to assess: { set: { fight: $ }, go: dagger }
|
||||
default: { set: { fight: $, dagger: (no dagger choice) }, go: survive_fight }
|
||||
dagger:
|
||||
decision: dagger
|
||||
then: { default: { set: { dagger: $ }, go: survive_fight } }
|
||||
survive_fight:
|
||||
chance: dieCombat
|
||||
then:
|
||||
die: { end: killed in the fight }
|
||||
live: { go: fate }
|
||||
fate:
|
||||
decision: fate
|
||||
# the fight's moves only matter for surviving it
|
||||
then: { default: { drop: [fight, dagger], set: { cadet: $ }, go: post } }
|
||||
post:
|
||||
decision: post
|
||||
then: { default: { set: { post: $ }, go: survive_hour } }
|
||||
survive_hour:
|
||||
chance: dieHour
|
||||
then:
|
||||
die: { end: incinerated }
|
||||
live: { go: hour }
|
||||
hour:
|
||||
decision: hour
|
||||
then:
|
||||
Tree: { set: { hour: $ }, go: shadow }
|
||||
Valley: { set: { hour: $ }, go: valley }
|
||||
shadow:
|
||||
chance: shadow
|
||||
then:
|
||||
"yes": { go: shadow_colour }
|
||||
"no": { set: { shadow: "no" }, go: descend }
|
||||
shadow_colour:
|
||||
chance: shadowColour
|
||||
then: { default: { set: { shadow: "yes" }, encounter: "shadow-$" } }
|
||||
descend:
|
||||
decision: descend
|
||||
then:
|
||||
Quickly (Red): { set: { descend: $ }, go: red }
|
||||
Slowly (two Greens): { set: { descend: $ }, encounter: tree-Greens }
|
||||
red:
|
||||
decision: red
|
||||
then:
|
||||
Jump onto the Red: { set: { red: $ }, encounter: tree-Red }
|
||||
Let it pass (two Greens): { set: { red: $ }, encounter: tree-Greens }
|
||||
valley:
|
||||
decision: valley
|
||||
then:
|
||||
Face the Red: { set: { valley: $ }, encounter: valley-Red }
|
||||
Pass the Red (meadow): { set: { valley: $ }, go: meadow }
|
||||
meadow:
|
||||
chance: meadow
|
||||
then: { default: { set: { meadow: $ }, encounter: "meadow-$" } }
|
||||
|
||||
# ---------------------------------------------------------------- how the community form's answers map onto the game
|
||||
# (used to count how often each option was taken and how each roll came out; see core/atlas/model.py)
|
||||
from_form:
|
||||
fight:
|
||||
"Assess the situation": Pause to assess
|
||||
"Even the numbers (smaller cadet)": Charge the smaller cadet
|
||||
"Put yourself in the middle (bigger cadet)": Charge between the bigger cadet and your squadmate
|
||||
dagger:
|
||||
"Engage the smaller cadet": Engage the smaller cadet
|
||||
"Daggers or not (protect squadmate)": Charge the bigger cadet anyway
|
||||
# cadet resolutions on each side of the scream
|
||||
helped: [Killed the bullies yourself, Squadmate's revenge, Left bullies to the dragons]
|
||||
ignored: [Tourniquet, Left injured cadet, Took their weapons]
|
||||
# a rider's stated goal that means "chasing a rare dragon"
|
||||
rare_goals: [Blue, Black, Blue or Black]
|
||||
|
||||
# ---------------------------------------------------------------- the bot: which on-screen text is which option
|
||||
# Regular expressions over the option text, lower-cased with punctuation removed (see core/graph.js norm()).
|
||||
# recommendOption() in core/solver.js uses these to point the bot at the recommended option on its screen.
|
||||
bot_text:
|
||||
company: { Alone: "^enter the valley alone", "1 Squadmate": "^enter the valley with one", "2 Squadmates": "^enter the valley with two" }
|
||||
leave: { Leave them: "^leave your squadmates?$" } # staying is answered on the same screen as the direction
|
||||
# alone (or after leaving the squad), and with the squad: going their way or convincing them
|
||||
direction: { East: "^head east|^go east with your squad|^convince them to head east", West: "^head west|^go west with your squad|^convince them to head west", Center: "^head toward the center of the forest" }
|
||||
react: { Hold still: "hold still", Respect / face it: "in respect|turn to face it", Retreat / run: "^run and hope", Hide: "^hide", Meet its gaze: "meeting its gaze" }
|
||||
scream: { Investigate the scream: "^investigate the scream", Keep walking: "^keep walking" }
|
||||
clearing: { Help your squadmate: "^help your squadmate", Walk away: "^play it safe and leave them" }
|
||||
fight: { Pause to assess: "^pause to assess", Charge the smaller cadet: "^charge the other cadet", Charge between the bigger cadet and your squadmate: "^unsheathe your weapon" }
|
||||
dagger: { Engage the smaller cadet: "^engage the smaller cadet", Charge the bigger cadet anyway: "^daggers or not" }
|
||||
fate: { Killed the bullies yourself: "^end the lives of the bullies", Squadmate's revenge: "^allow your squadmate to exact", Left bullies to the dragons: "^leave the bullies alive" }
|
||||
wounded: { Tourniquet: "tourniquet", Left injured cadet: "leave (them|him|her) to die", Took their weapons: "take (their|his|her) weapons?" }
|
||||
post: { East: "^walk toward the east", West: "^walk toward the west", Forest: "^walk farther into the forest" }
|
||||
hour: { Valley: "^continue toward the center of the valley", Tree: "^find the tallest tree" }
|
||||
descend: { Quickly (Red): "^descend quickly", Slowly (two Greens): "^climb down slowly" }
|
||||
red: { Jump onto the Red: "^jump", Let it pass (two Greens): "^reds are too hot tempered" }
|
||||
@@ -0,0 +1,25 @@
|
||||
# Data sources
|
||||
|
||||
Every source is declared in `collection/pipeline.yaml` and collected by `python -m collection update`
|
||||
(see `collection/README.md`). Every run from every source is in `public/runs_clean.csv`, with a `source` column.
|
||||
|
||||
| Source (`source` column) | Where it lives here |
|
||||
|---|---|
|
||||
| Community "Threshing Routes" form and spreadsheet, u/ClumsyBadger (`reddit spreadsheet`) | `public/form_responses.json` (emails redacted) |
|
||||
| Result pages posted in the r/fourthwing megathreads (`reddit thread`) | `collection/manual/reddit_results.yaml` |
|
||||
| The Atlas's "Report a run" form (`reported`) | `public/reports.json` (answers only, no usernames) |
|
||||
| DragonKind bot exports (`bot`) | `bot/scenes.json`, `bot/trajectories-<date>.jsonl` (anonymised; see `docs/BOT_DATA_PROTOCOL.md`) |
|
||||
| Community route PDF, u/ClumsyBadger (`reddit pdf`) | not redistributed: `derived/pdf_fingerprint.json` only; it maps the choices and holds no runs |
|
||||
| Unofficial Dragon Register | `public/register.json` (rider names and photos dropped); no runs |
|
||||
| Discord | not yet: planned, with admin consent and anonymised usernames |
|
||||
|
||||
Raw files (`raw/`, git-ignored) are never published: the current version of each source and the one before it.
|
||||
`manifest.json` records the current raw file's checksum and when it last changed.
|
||||
|
||||
## What each column means
|
||||
|
||||
`data/dictionary.yaml` describes every published file and every column of `data/public/runs_clean.csv`: its type,
|
||||
what it means and every value it can take. `data/croissant.json` says the same in the
|
||||
[Croissant](https://docs.mlcommons.org/croissant/) metadata format (with a sha256 checksum for every file), so
|
||||
dataset tools can load and cite the data. `python -m collection build` rewrites it; the tests fail if a column or
|
||||
value is not described or the metadata is out of date.
|
||||
@@ -0,0 +1,826 @@
|
||||
{
|
||||
"01c36238ed4d": {
|
||||
"stage": "FORK_IN_FOREST",
|
||||
"tint": "red",
|
||||
"backdrop": "clearing",
|
||||
"label": "FORK_IN_FOREST · red",
|
||||
"options": [
|
||||
{
|
||||
"id": "8815af6f63",
|
||||
"text": "There’s no way this is your dragon and you need to get out of here"
|
||||
},
|
||||
{
|
||||
"id": "ec479648fd",
|
||||
"text": "This is your dragon and it’s time to start bonding"
|
||||
}
|
||||
]
|
||||
},
|
||||
"07e24681e3b3": {
|
||||
"stage": "TREE_SHADOW_CHECK",
|
||||
"tint": "green",
|
||||
"backdrop": "clearing",
|
||||
"label": "Descended slowly: two Greens in the clearing",
|
||||
"options": [
|
||||
{
|
||||
"id": "d7f4b4e9da",
|
||||
"text": "Lower your eyes and turn your body toward the right"
|
||||
},
|
||||
{
|
||||
"id": "9da997c847",
|
||||
"text": "Lower your eyes but keep your body neutral, letting them decide"
|
||||
},
|
||||
{
|
||||
"id": "bafcacfd8c",
|
||||
"text": "Lower your eyes and turn your body toward the left"
|
||||
}
|
||||
]
|
||||
},
|
||||
"0905c924562b": {
|
||||
"stage": "FORK_IN_FOREST",
|
||||
"tint": null,
|
||||
"backdrop": "clearing",
|
||||
"label": "FORK_IN_FOREST",
|
||||
"options": [
|
||||
{
|
||||
"id": "fad9b2b701",
|
||||
"text": "Approach the orange dragon"
|
||||
},
|
||||
{
|
||||
"id": "4003505565",
|
||||
"text": "Approach the brown dragon"
|
||||
}
|
||||
]
|
||||
},
|
||||
"0a561d53ad19": {
|
||||
"stage": "THORN_WALK",
|
||||
"tint": null,
|
||||
"backdrop": "clearing",
|
||||
"label": "An hour later: valley or tree",
|
||||
"options": [
|
||||
{
|
||||
"id": "f0700810bf",
|
||||
"text": "Continue toward the center of the valley"
|
||||
},
|
||||
{
|
||||
"id": "7276f2fd9a",
|
||||
"text": "Find the tallest tree and climb for a better view"
|
||||
}
|
||||
]
|
||||
},
|
||||
"0cfd06cf8939": {
|
||||
"stage": "SCREAM_AND_CADETS",
|
||||
"tint": null,
|
||||
"backdrop": "forest",
|
||||
"label": "After the fight: choose a direction",
|
||||
"options": [
|
||||
{
|
||||
"id": "d79c512261",
|
||||
"text": "Walk toward the east"
|
||||
},
|
||||
{
|
||||
"id": "cfe44a775d",
|
||||
"text": "Walk toward the west"
|
||||
},
|
||||
{
|
||||
"id": "3929adfa07",
|
||||
"text": "Walk farther into the forest"
|
||||
}
|
||||
]
|
||||
},
|
||||
"10bc7353b8eb": {
|
||||
"stage": "FORK_IN_FOREST",
|
||||
"tint": "red",
|
||||
"backdrop": "clearing",
|
||||
"label": "Descended quickly: a Red below",
|
||||
"options": [
|
||||
{
|
||||
"id": "714e3abd94",
|
||||
"text": "Reds are too hot-tempered. You’d rather take your chance with that green"
|
||||
},
|
||||
{
|
||||
"id": "2991a60b20",
|
||||
"text": "Jump in a few seconds and you’ll land closer to its tail, farther from the teeth"
|
||||
},
|
||||
{
|
||||
"id": "40c171677e",
|
||||
"text": "Jump now, and you can land on its back"
|
||||
}
|
||||
]
|
||||
},
|
||||
"13673f2461a1": {
|
||||
"stage": "SCREAM_AND_CADETS",
|
||||
"tint": null,
|
||||
"backdrop": "forest",
|
||||
"label": "SCREAM_AND_CADETS",
|
||||
"options": [
|
||||
{
|
||||
"id": "1477a0f34f",
|
||||
"text": "Keep going. Clearly they’ve been found lacking and weak riders threaten the wing"
|
||||
},
|
||||
{
|
||||
"id": "2de42c6660",
|
||||
"text": "Take the cadet’s weapons and continue along your way. Good steel shouldn’t go to waste"
|
||||
},
|
||||
{
|
||||
"id": "8cf4b0cf60",
|
||||
"text": "Use the cadet’s own belt as a tourniquet to staunch the blood flow and wait for a wingleader to come along"
|
||||
}
|
||||
]
|
||||
},
|
||||
"3f5d4c880fa9": {
|
||||
"stage": "MEADOW_ENCOUNTER",
|
||||
"tint": "brown",
|
||||
"backdrop": "clearing",
|
||||
"label": "MEADOW_ENCOUNTER · brown",
|
||||
"options": [
|
||||
{
|
||||
"id": "f1aaea7f76",
|
||||
"text": "You point out that it’s already talking to you, so clearly you’re on the right track"
|
||||
},
|
||||
{
|
||||
"id": "ef5d1b474e",
|
||||
"text": "You’ll respect its decision and hope for a clean death"
|
||||
},
|
||||
{
|
||||
"id": "aed44971b9",
|
||||
"text": "You’ll convince it with charm"
|
||||
}
|
||||
]
|
||||
},
|
||||
"4118582c85df": {
|
||||
"stage": "TARGET_BONDING",
|
||||
"tint": "blue",
|
||||
"backdrop": "clearing",
|
||||
"label": "TARGET_BONDING · blue",
|
||||
"options": [
|
||||
{
|
||||
"id": "7d7788a891",
|
||||
"text": "Hold the blue’s glare and advance"
|
||||
},
|
||||
{
|
||||
"id": "06a35668b0",
|
||||
"text": "Keep moving forward with your eyes lowered"
|
||||
},
|
||||
{
|
||||
"id": "6a855c9d5c",
|
||||
"text": "Halt your approach and lower your eyes"
|
||||
}
|
||||
]
|
||||
},
|
||||
"4f4ae4c4e49a": {
|
||||
"stage": "MEADOW_ENCOUNTER",
|
||||
"tint": "orange",
|
||||
"backdrop": "clearing",
|
||||
"label": "MEADOW_ENCOUNTER · orange",
|
||||
"options": [
|
||||
{
|
||||
"id": "c95309baca",
|
||||
"text": "Take a chance and try a tail-mount"
|
||||
}
|
||||
]
|
||||
},
|
||||
"545578ddbe46": {
|
||||
"stage": "ENTER_THRESHING",
|
||||
"tint": null,
|
||||
"backdrop": "forest",
|
||||
"label": "ENTER_THRESHING",
|
||||
"options": [
|
||||
{
|
||||
"id": "1147432132",
|
||||
"text": "Convince them to head east instead"
|
||||
},
|
||||
{
|
||||
"id": "5501c1635f",
|
||||
"text": "Go west with your squadmate"
|
||||
},
|
||||
{
|
||||
"id": "81dae2ed4f",
|
||||
"text": "Leave your squadmate"
|
||||
}
|
||||
]
|
||||
},
|
||||
"5b2713be89b2": {
|
||||
"stage": "MEADOW_ENCOUNTER",
|
||||
"tint": "orange",
|
||||
"backdrop": "clearing",
|
||||
"label": "MEADOW_ENCOUNTER · orange",
|
||||
"options": [
|
||||
{
|
||||
"id": "31b348db0c",
|
||||
"text": "On second thought, a nice brown sounds great"
|
||||
},
|
||||
{
|
||||
"id": "900576c438",
|
||||
"text": "Absolutely. I have a feeling this is my dragon"
|
||||
}
|
||||
]
|
||||
},
|
||||
"5ddaca4ebf6c": {
|
||||
"stage": "TARGET_BONDING",
|
||||
"tint": "blue",
|
||||
"backdrop": "clearing",
|
||||
"label": "TARGET_BONDING · blue",
|
||||
"options": [
|
||||
{
|
||||
"id": "3f99a5c45d",
|
||||
"text": "Do nothing. It’s worked so far"
|
||||
},
|
||||
{
|
||||
"id": "b67f49441d",
|
||||
"text": "Speak first, claiming the dragon as yours"
|
||||
},
|
||||
{
|
||||
"id": "8d768b0ef2",
|
||||
"text": "Straighten your spine and wait for it to speak"
|
||||
}
|
||||
]
|
||||
},
|
||||
"69c5b0e2b790": {
|
||||
"stage": "ENTER_THRESHING",
|
||||
"tint": "orange",
|
||||
"backdrop": "forest",
|
||||
"label": "ENTER_THRESHING · orange",
|
||||
"options": [
|
||||
{
|
||||
"id": "a137e8047c",
|
||||
"text": "Duck behind a boulder"
|
||||
},
|
||||
{
|
||||
"id": "b98b30e96d",
|
||||
"text": "Lower your eyes in respect and retreat"
|
||||
},
|
||||
{
|
||||
"id": "ddad2bafb4",
|
||||
"text": "Approach with confidence"
|
||||
}
|
||||
]
|
||||
},
|
||||
"6b8a5625b88d": {
|
||||
"stage": "FORK_IN_FOREST",
|
||||
"tint": "red",
|
||||
"backdrop": "clearing",
|
||||
"label": "FORK_IN_FOREST · red",
|
||||
"options": [
|
||||
{
|
||||
"id": "1a981e7715",
|
||||
"text": "You’re absolutely sure"
|
||||
},
|
||||
{
|
||||
"id": "e99d6c3481",
|
||||
"text": "On second thought, let’s get out of here"
|
||||
}
|
||||
]
|
||||
},
|
||||
"78afc925529f": {
|
||||
"stage": "FORK_IN_FOREST",
|
||||
"tint": "brown",
|
||||
"backdrop": "clearing",
|
||||
"label": "FORK_IN_FOREST · brown",
|
||||
"options": [
|
||||
{
|
||||
"id": "b2a9ecfcd0",
|
||||
"text": "Ehh. On second thought, maybe it won’t see if you change direction"
|
||||
},
|
||||
{
|
||||
"id": "70a4f53a6d",
|
||||
"text": "You’re sure. The heart doesn’t lie, and it’s set on that brown"
|
||||
}
|
||||
]
|
||||
},
|
||||
"792fc5ad90c3": {
|
||||
"stage": "MEADOW_ENCOUNTER",
|
||||
"tint": "brown",
|
||||
"backdrop": "clearing",
|
||||
"label": "MEADOW_ENCOUNTER · brown",
|
||||
"options": [
|
||||
{
|
||||
"id": "b4d31960c6",
|
||||
"text": "Immediately throw your body weight onto the tail and hold on for dear life"
|
||||
},
|
||||
{
|
||||
"id": "732901a659",
|
||||
"text": "Wait for the tail to return for a more advantageous angle"
|
||||
}
|
||||
]
|
||||
},
|
||||
"84780dab01e3": {
|
||||
"stage": "FIRST_SIGHTING",
|
||||
"tint": "red",
|
||||
"backdrop": "forest",
|
||||
"label": "Survived the first sighting",
|
||||
"options": [
|
||||
{
|
||||
"id": "6913c7fb2c",
|
||||
"text": "Head deeper into the forest"
|
||||
}
|
||||
]
|
||||
},
|
||||
"848f03f8f298": {
|
||||
"stage": "TARGET_BONDING",
|
||||
"tint": "blue",
|
||||
"backdrop": "clearing",
|
||||
"label": "TARGET_BONDING · blue",
|
||||
"options": [
|
||||
{
|
||||
"id": "7d771616e4",
|
||||
"text": "No. I have better odds with the orange"
|
||||
},
|
||||
{
|
||||
"id": "78b3ba405f",
|
||||
"text": "Absolutely. My whole life hinges on this moment"
|
||||
},
|
||||
{
|
||||
"id": "f0e858698f",
|
||||
"text": "Nope. I’d rather live bonded to a brown than die pursuing a blue"
|
||||
}
|
||||
]
|
||||
},
|
||||
"900d49229a84": {
|
||||
"stage": "FORK_IN_FOREST",
|
||||
"tint": null,
|
||||
"backdrop": "clearing",
|
||||
"label": "FORK_IN_FOREST",
|
||||
"options": [
|
||||
{
|
||||
"id": "4003505565",
|
||||
"text": "Approach the brown dragon"
|
||||
},
|
||||
{
|
||||
"id": "fad9b2b701",
|
||||
"text": "Approach the orange dragon"
|
||||
},
|
||||
{
|
||||
"id": "4bbcb73ed1",
|
||||
"text": "Approach the blue dragon"
|
||||
}
|
||||
]
|
||||
},
|
||||
"959e965095c3": {
|
||||
"stage": "TARGET_BONDING",
|
||||
"tint": "blue",
|
||||
"backdrop": "clearing",
|
||||
"label": "TARGET_BONDING · blue",
|
||||
"options": [
|
||||
{
|
||||
"id": "0f1d136c69",
|
||||
"text": "Launch yourself to the right, taking cover behind a boulder"
|
||||
},
|
||||
{
|
||||
"id": "442a0fc4eb",
|
||||
"text": "Hold steady, fear will get you killed"
|
||||
}
|
||||
]
|
||||
},
|
||||
"96b68612eaf4": {
|
||||
"stage": "FORK_IN_FOREST",
|
||||
"tint": null,
|
||||
"backdrop": "clearing",
|
||||
"label": "Top of the tree (shadow check)",
|
||||
"options": [
|
||||
{
|
||||
"id": "c71ea9e2b6",
|
||||
"text": "Descend quickly in preparation for whatever’s coming your way"
|
||||
},
|
||||
{
|
||||
"id": "2c5af7e978",
|
||||
"text": "Climb down slowly to pursue the green"
|
||||
}
|
||||
]
|
||||
},
|
||||
"9dc9518d8c84": {
|
||||
"stage": "FORK_IN_FOREST",
|
||||
"tint": "green",
|
||||
"backdrop": "clearing",
|
||||
"label": "FORK_IN_FOREST · green",
|
||||
"options": [
|
||||
{
|
||||
"id": "fe2406af4e",
|
||||
"text": "Glance over at the dragon on the right, keeping situational awareness"
|
||||
},
|
||||
{
|
||||
"id": "6c7e2bb27b",
|
||||
"text": "Don’t move a muscle"
|
||||
}
|
||||
]
|
||||
},
|
||||
"a2368b0dc212": {
|
||||
"stage": "SCREAM_AND_CADETS",
|
||||
"tint": null,
|
||||
"backdrop": "forest",
|
||||
"label": "Blocked the bigger cadet: bullies’ fate",
|
||||
"options": [
|
||||
{
|
||||
"id": "2fba1113c6",
|
||||
"text": "Leave the bullies alive. The dragons will sort them out"
|
||||
},
|
||||
{
|
||||
"id": "43fb669800",
|
||||
"text": "End the lives of the bullies yourself"
|
||||
},
|
||||
{
|
||||
"id": "e579a5cd9f",
|
||||
"text": "Allow your squadmate to exact their own revenge"
|
||||
}
|
||||
]
|
||||
},
|
||||
"a68f681076c6": {
|
||||
"stage": "ENTER_THRESHING",
|
||||
"tint": null,
|
||||
"backdrop": "forest",
|
||||
"label": "Valley edge: choose direction",
|
||||
"options": [
|
||||
{
|
||||
"id": "5f7eefac34",
|
||||
"text": "Head east toward the roar"
|
||||
},
|
||||
{
|
||||
"id": "9c613e0d47",
|
||||
"text": "Head west toward the scent"
|
||||
},
|
||||
{
|
||||
"id": "05d19abb5d",
|
||||
"text": "Head toward the center of the forest"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ab2da0553abf": {
|
||||
"stage": "ENTER_THRESHING",
|
||||
"tint": null,
|
||||
"backdrop": "forest",
|
||||
"label": "ENTER_THRESHING",
|
||||
"options": [
|
||||
{
|
||||
"id": "44095be371",
|
||||
"text": "Go east with your squad"
|
||||
},
|
||||
{
|
||||
"id": "eaf6e41387",
|
||||
"text": "Leave your squadmates"
|
||||
},
|
||||
{
|
||||
"id": "55fe423f15",
|
||||
"text": "Convince them to head west instead"
|
||||
}
|
||||
]
|
||||
},
|
||||
"abe3011378ac": {
|
||||
"stage": "ENTER_THRESHING",
|
||||
"tint": "brown",
|
||||
"backdrop": "forest",
|
||||
"label": "First sighting: Brown (forest centre)",
|
||||
"options": [
|
||||
{
|
||||
"id": "1c97464061",
|
||||
"text": "Run and hope it didn’t see you"
|
||||
},
|
||||
{
|
||||
"id": "bab6a76e8b",
|
||||
"text": "Lower your eyes and hold still"
|
||||
},
|
||||
{
|
||||
"id": "f6fc843ffc",
|
||||
"text": "Lower your eyes and turn to face it"
|
||||
}
|
||||
]
|
||||
},
|
||||
"afc48a9ae27f": {
|
||||
"stage": "TARGET_BONDING",
|
||||
"tint": "blue",
|
||||
"backdrop": "clearing",
|
||||
"label": "TARGET_BONDING · blue",
|
||||
"options": [
|
||||
{
|
||||
"id": "bdbd932924",
|
||||
"text": "Do nothing"
|
||||
},
|
||||
{
|
||||
"id": "5a76aa2e2f",
|
||||
"text": "Intervene and help"
|
||||
}
|
||||
]
|
||||
},
|
||||
"b209bacacec3": {
|
||||
"stage": "SCREAM_AND_CADETS",
|
||||
"tint": null,
|
||||
"backdrop": "forest",
|
||||
"label": "Bully fight: first move",
|
||||
"options": [
|
||||
{
|
||||
"id": "6dc46afcb2",
|
||||
"text": "Pause to assess the situation even though it may risk your squadmate’s life"
|
||||
},
|
||||
{
|
||||
"id": "483000d9b9",
|
||||
"text": "Charge the other cadet to even out the numbers"
|
||||
},
|
||||
{
|
||||
"id": "249cab536f",
|
||||
"text": "Unsheathe your weapon and charge between the bigger cadet and your squadmate"
|
||||
}
|
||||
]
|
||||
},
|
||||
"b637d4115786": {
|
||||
"stage": "ENTER_THRESHING",
|
||||
"tint": "green",
|
||||
"backdrop": "forest",
|
||||
"label": "ENTER_THRESHING · green",
|
||||
"options": [
|
||||
{
|
||||
"id": "ad4f3fb6f4",
|
||||
"text": "Lower your eyes and hold your ground"
|
||||
},
|
||||
{
|
||||
"id": "911bbead41",
|
||||
"text": "Approach from the left"
|
||||
},
|
||||
{
|
||||
"id": "04c3fb524d",
|
||||
"text": "Stare at the ground and drop the weapon"
|
||||
}
|
||||
]
|
||||
},
|
||||
"b7e1483dd17a": {
|
||||
"stage": "FORK_IN_FOREST",
|
||||
"tint": "green",
|
||||
"backdrop": "clearing",
|
||||
"label": "FORK_IN_FOREST · green",
|
||||
"options": [
|
||||
{
|
||||
"id": "fbc43edf79",
|
||||
"text": "You overextend yourself constantly"
|
||||
},
|
||||
{
|
||||
"id": "cda997fd10",
|
||||
"text": "Your lack of flaws is a flaw itself"
|
||||
},
|
||||
{
|
||||
"id": "8bd1cc6042",
|
||||
"text": "You’re pretty certain you’re always right… even when you’re wrong"
|
||||
},
|
||||
{
|
||||
"id": "92e06f9e6b",
|
||||
"text": "Your struggle with your temper"
|
||||
}
|
||||
]
|
||||
},
|
||||
"b98aff0fa16a": {
|
||||
"stage": "TARGET_BONDING",
|
||||
"tint": "blue",
|
||||
"backdrop": "clearing",
|
||||
"label": "TARGET_BONDING · blue",
|
||||
"options": [
|
||||
{
|
||||
"id": "6bde02709a",
|
||||
"text": "Seize the opportunity to mount"
|
||||
},
|
||||
{
|
||||
"id": "f93b47698d",
|
||||
"text": "Stand strong, waiting for an invitation"
|
||||
},
|
||||
{
|
||||
"id": "7d564d5caf",
|
||||
"text": "Move forward slowly, waiting for an invitation"
|
||||
}
|
||||
]
|
||||
},
|
||||
"bbc8a53dc679": {
|
||||
"stage": "ENTER_THRESHING",
|
||||
"tint": null,
|
||||
"backdrop": "forest",
|
||||
"label": "ENTER_THRESHING",
|
||||
"options": [
|
||||
{
|
||||
"id": "05d19abb5d",
|
||||
"text": "Head toward the center of the forest"
|
||||
},
|
||||
{
|
||||
"id": "5f7eefac34",
|
||||
"text": "Head east toward the roar"
|
||||
},
|
||||
{
|
||||
"id": "9c613e0d47",
|
||||
"text": "Head west toward the scent"
|
||||
}
|
||||
]
|
||||
},
|
||||
"bc4ee4754b9c": {
|
||||
"stage": "ENTER_THRESHING",
|
||||
"tint": "red",
|
||||
"backdrop": "forest",
|
||||
"label": "First sighting: Red (forest centre)",
|
||||
"options": [
|
||||
{
|
||||
"id": "a31cbcb659",
|
||||
"text": "Lower your eyes in respect"
|
||||
},
|
||||
{
|
||||
"id": "14181c8e32",
|
||||
"text": "Show your bravery by meeting its gaze"
|
||||
},
|
||||
{
|
||||
"id": "1859b3cd4a",
|
||||
"text": "Hide behind a tree"
|
||||
}
|
||||
]
|
||||
},
|
||||
"c62f1f1a2b3a": {
|
||||
"stage": "FORK_IN_FOREST",
|
||||
"tint": "green",
|
||||
"backdrop": "clearing",
|
||||
"label": "Let the Red pass: two Greens in the clearing",
|
||||
"options": [
|
||||
{
|
||||
"id": "d7f4b4e9da",
|
||||
"text": "Lower your eyes and turn your body toward the right"
|
||||
},
|
||||
{
|
||||
"id": "bafcacfd8c",
|
||||
"text": "Lower your eyes and turn your body toward the left"
|
||||
},
|
||||
{
|
||||
"id": "9da997c847",
|
||||
"text": "Lower your eyes but keep your body neutral, letting them decide"
|
||||
}
|
||||
]
|
||||
},
|
||||
"d25f2759ace0": {
|
||||
"stage": "FIRST_SIGHTING",
|
||||
"tint": null,
|
||||
"backdrop": "forest",
|
||||
"label": "Deeper in the forest: a scream",
|
||||
"options": [
|
||||
{
|
||||
"id": "2b6d16a461",
|
||||
"text": "Investigate the scream"
|
||||
},
|
||||
{
|
||||
"id": "8e03986d31",
|
||||
"text": "Keep walking. The cadets are just as dangerous as the dragons today"
|
||||
}
|
||||
]
|
||||
},
|
||||
"db7786392626": {
|
||||
"stage": "ENTER_THRESHING",
|
||||
"tint": null,
|
||||
"backdrop": "forest",
|
||||
"label": "Start: choose company",
|
||||
"options": [
|
||||
{
|
||||
"id": "571af425c8",
|
||||
"text": "Enter the valley with two of your squadmates"
|
||||
},
|
||||
{
|
||||
"id": "3da794f136",
|
||||
"text": "Enter the valley with one of your squadmates"
|
||||
},
|
||||
{
|
||||
"id": "c18f80dd1e",
|
||||
"text": "Enter the valley alone"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ea9997720545": {
|
||||
"stage": "TARGET_BONDING",
|
||||
"tint": "blue",
|
||||
"backdrop": "clearing",
|
||||
"label": "TARGET_BONDING · blue",
|
||||
"options": [
|
||||
{
|
||||
"id": "ea7c0027e7",
|
||||
"text": "Lower your eyes for the cadet’s dignity"
|
||||
},
|
||||
{
|
||||
"id": "973f57cd35",
|
||||
"text": "Show your honor by helping the cadet"
|
||||
},
|
||||
{
|
||||
"id": "80e3020dea",
|
||||
"text": "Hold the dragon’s glare and watch as it crushes the cadet to death"
|
||||
}
|
||||
]
|
||||
},
|
||||
"f0fb1451568a": {
|
||||
"stage": "FORK_IN_FOREST",
|
||||
"tint": "green",
|
||||
"backdrop": "clearing",
|
||||
"label": "FORK_IN_FOREST · green",
|
||||
"options": [
|
||||
{
|
||||
"id": "6e46acb832",
|
||||
"text": "Don’t move a muscle. Holding your ground is imperative"
|
||||
},
|
||||
{
|
||||
"id": "f50fb7bd4c",
|
||||
"text": "Take a single step back. Getting speared won’t get you bonded"
|
||||
}
|
||||
]
|
||||
},
|
||||
"f0fc086c6590": {
|
||||
"stage": "FORK_IN_FOREST",
|
||||
"tint": "red",
|
||||
"backdrop": "clearing",
|
||||
"label": "FORK_IN_FOREST · red",
|
||||
"options": [
|
||||
{
|
||||
"id": "871b243a92",
|
||||
"text": "Continue your approach. You’re certain this is your path"
|
||||
},
|
||||
{
|
||||
"id": "8e79717d1b",
|
||||
"text": "That growl changes everything, and it’s time to exit gracefully"
|
||||
}
|
||||
]
|
||||
},
|
||||
"f4b4944d3f3b": {
|
||||
"stage": "SCREAM_AND_CADETS",
|
||||
"tint": null,
|
||||
"backdrop": "forest",
|
||||
"label": "Beat the smaller cadet: bullies’ fate",
|
||||
"options": [
|
||||
{
|
||||
"id": "e579a5cd9f",
|
||||
"text": "Allow your squadmate to exact their own revenge"
|
||||
},
|
||||
{
|
||||
"id": "43fb669800",
|
||||
"text": "End the lives of the bullies yourself"
|
||||
},
|
||||
{
|
||||
"id": "2fba1113c6",
|
||||
"text": "Leave the bullies alive. The dragons will sort them out"
|
||||
}
|
||||
]
|
||||
},
|
||||
"f72199f24b91": {
|
||||
"stage": "SCREAM_AND_CADETS",
|
||||
"tint": null,
|
||||
"backdrop": "forest",
|
||||
"label": "Clearing: squadmate vs two bullies",
|
||||
"options": [
|
||||
{
|
||||
"id": "c5719ec9a7",
|
||||
"text": "Help your squadmate"
|
||||
},
|
||||
{
|
||||
"id": "5e4947fde1",
|
||||
"text": "Play it safe and leave them to their own defense so you can find your dragon"
|
||||
}
|
||||
]
|
||||
},
|
||||
"f82683b20f3b": {
|
||||
"stage": "FORK_IN_FOREST",
|
||||
"tint": "brown",
|
||||
"backdrop": "clearing",
|
||||
"label": "FORK_IN_FOREST · brown",
|
||||
"options": [
|
||||
{
|
||||
"id": "8b53b3dfbf",
|
||||
"text": "Run after the brown dragon"
|
||||
},
|
||||
{
|
||||
"id": "939b596a85",
|
||||
"text": "Try your luck with the remaining orange"
|
||||
}
|
||||
]
|
||||
},
|
||||
"f8b8d90014f1": {
|
||||
"stage": "TARGET_BONDING",
|
||||
"tint": "blue",
|
||||
"backdrop": "clearing",
|
||||
"label": "TARGET_BONDING · blue",
|
||||
"options": [
|
||||
{
|
||||
"id": "1437cd23ea",
|
||||
"text": "I want to bring down an empire"
|
||||
},
|
||||
{
|
||||
"id": "2237667d16",
|
||||
"text": "You already know"
|
||||
},
|
||||
{
|
||||
"id": "cf4766824b",
|
||||
"text": "I seek revenge"
|
||||
},
|
||||
{
|
||||
"id": "16ca950973",
|
||||
"text": "I want to defend the helpless"
|
||||
}
|
||||
]
|
||||
},
|
||||
"fbe0f0bea700": {
|
||||
"stage": "SCREAM_AND_CADETS",
|
||||
"tint": null,
|
||||
"backdrop": "forest",
|
||||
"label": "Bully fight: smaller cadet has a dagger",
|
||||
"options": [
|
||||
{
|
||||
"id": "40b2e3202f",
|
||||
"text": "Daggers or not, your squadmate is in danger, so you charge the bigger cadet"
|
||||
},
|
||||
{
|
||||
"id": "dd20bac96c",
|
||||
"text": "Engage the smaller cadet"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,6 @@
|
||||
{"id":"bot-288b72e52f","source":"bot","meta":{"attempt":2,"startedAt":"2026-10-29T16:25:29.185Z","accountKey":null,"target":null,"decisionMode":null},"steps":[{"scene":"a68f681076c6","stage":"ENTER_THRESHING","tint":null,"option":"05d19abb5d","optionText":"Head toward the center of the forest","offered":["5f7eefac34","9c613e0d47","05d19abb5d"],"rule":"ENTER_TOWARDS_FOREST_CENTER","decisionMode":null,"manual":false,"at":"2026-10-29T16:25:29.185Z","to":"bc4ee4754b9c"},{"scene":"bc4ee4754b9c","stage":"FIRST_SIGHTING","tint":"red","option":"a31cbcb659","optionText":"Lower your eyes in respect","offered":["a31cbcb659","14181c8e32","1859b3cd4a"],"rule":"SIGHTING_LOWER_EYES_RESPECT","decisionMode":null,"manual":false,"at":"2026-10-29T16:25:31.387Z","to":"84780dab01e3"},{"scene":"84780dab01e3","stage":"ENTER_THRESHING","tint":"red","option":"6913c7fb2c","optionText":"Head deeper into the forest","offered":["6913c7fb2c"],"rule":"SINGLE_CHOICE_ADVANCE","decisionMode":"guide","manual":false,"at":"2026-10-29T19:55:36.225Z","to":"d25f2759ace0"},{"scene":"d25f2759ace0","stage":"SCREAM_AND_CADETS","tint":null,"option":"2b6d16a461","optionText":"Investigate the scream","offered":["2b6d16a461","8e03986d31"],"rule":"SCREAM_INVESTIGATE","decisionMode":"guide","manual":false,"at":"2026-10-29T19:55:38.219Z","to":"f72199f24b91"},{"scene":"f72199f24b91","stage":"BLUE_DRAGON_ROUTE","tint":null,"option":"c5719ec9a7","optionText":"Help your squadmate","offered":["c5719ec9a7","5e4947fde1"],"rule":"BLUE_7_HELP_CADET","decisionMode":"guide","manual":false,"at":"2026-10-29T19:55:45.720Z","to":"b209bacacec3"},{"scene":"b209bacacec3","stage":"SCREAM_AND_CADETS","tint":null,"option":"6dc46afcb2","optionText":"Pause to assess the situation even though it may risk your squadmate’s life","offered":["6dc46afcb2","483000d9b9","249cab536f"],"rule":null,"decisionMode":"manual","manual":true,"at":"2026-10-29T19:56:20.518Z","to":"fbe0f0bea700"},{"scene":"fbe0f0bea700","stage":"SCREAM_AND_CADETS","tint":null,"option":"40b2e3202f","optionText":"Daggers or not, your squadmate is in danger, so you charge the bigger cadet","offered":["40b2e3202f","dd20bac96c"],"rule":null,"decisionMode":"manual","manual":true,"at":"2026-10-29T19:56:29.785Z","to":"a2368b0dc212"},{"scene":"a2368b0dc212","stage":"SCREAM_AND_CADETS","tint":null,"option":"43fb669800","optionText":"End the lives of the bullies yourself","offered":["2fba1113c6","43fb669800","e579a5cd9f"],"rule":null,"decisionMode":"manual","manual":true,"at":"2026-10-29T19:56:36.498Z","to":"0cfd06cf8939"},{"scene":"0cfd06cf8939","stage":"SCREAM_AND_CADETS","tint":null,"option":"3929adfa07","optionText":"Walk farther into the forest","offered":["d79c512261","cfe44a775d","3929adfa07"],"rule":null,"decisionMode":"manual","manual":true,"at":"2026-10-29T19:56:42.280Z","to":"0a561d53ad19"},{"scene":"0a561d53ad19","stage":"THORN_WALK","tint":null,"option":"7276f2fd9a","optionText":"Find the tallest tree and climb for a better view","offered":["f0700810bf","7276f2fd9a"],"rule":null,"decisionMode":"manual","manual":true,"at":"2026-10-29T19:56:51.226Z","to":"96b68612eaf4"},{"scene":"96b68612eaf4","stage":"FORK_IN_FOREST","tint":null,"option":"c71ea9e2b6","optionText":"Descend quickly in preparation for whatever’s coming your way","offered":["c71ea9e2b6","2c5af7e978"],"rule":null,"decisionMode":"manual","manual":true,"at":"2026-10-29T19:57:01.275Z","to":"10bc7353b8eb"},{"scene":"10bc7353b8eb","stage":"FORK_IN_FOREST","tint":"red","option":"2991a60b20","optionText":"Jump in a few seconds and you’ll land closer to its tail, farther from the teeth","offered":["714e3abd94","2991a60b20","40c171677e"],"rule":null,"decisionMode":"manual","manual":true,"at":"2026-10-29T19:57:08.857Z","to":"BURNED"}],"outcome":{"type":"BURNED","colour":null,"intentional":false}}
|
||||
{"id":"bot-a181b520f1","source":"bot","meta":{"attempt":3,"startedAt":"2026-10-30T01:21:31.420Z","accountKey":null,"target":null,"decisionMode":null},"steps":[{"scene":"db7786392626","stage":"ENTER_THRESHING","tint":null,"option":"c18f80dd1e","optionText":"Enter the valley alone","offered":["571af425c8","3da794f136","c18f80dd1e"],"rule":"ENTER_GO_ALONE","decisionMode":"guide","manual":false,"at":"2026-10-30T01:21:31.420Z","to":"a68f681076c6"},{"scene":"a68f681076c6","stage":"ENTER_THRESHING","tint":null,"option":"05d19abb5d","optionText":"Head toward the center of the forest","offered":["05d19abb5d","9c613e0d47","5f7eefac34"],"rule":"ENTER_TOWARDS_FOREST_CENTER","decisionMode":"guide","manual":false,"at":"2026-10-30T01:21:34.893Z","to":"bc4ee4754b9c"},{"scene":"bc4ee4754b9c","stage":"FIRST_SIGHTING","tint":"red","option":"a31cbcb659","optionText":"Lower your eyes in respect","offered":["14181c8e32","a31cbcb659","1859b3cd4a"],"rule":"SIGHTING_LOWER_EYES_RESPECT","decisionMode":"guide","manual":false,"at":"2026-10-30T01:21:38.316Z","to":"84780dab01e3"},{"scene":"84780dab01e3","stage":"FIRST_SIGHTING","tint":"red","option":"6913c7fb2c","optionText":"Head deeper into the forest","offered":["6913c7fb2c"],"rule":"SINGLE_CHOICE_ADVANCE","decisionMode":"guide","manual":false,"at":"2026-10-30T01:21:41.767Z","to":"d25f2759ace0"},{"scene":"d25f2759ace0","stage":"SCREAM_AND_CADETS","tint":null,"option":"2b6d16a461","optionText":"Investigate the scream","offered":["2b6d16a461","8e03986d31"],"rule":"SCREAM_INVESTIGATE","decisionMode":"guide","manual":false,"at":"2026-10-30T01:21:45.219Z","to":"f72199f24b91"},{"scene":"f72199f24b91","stage":"SCREAM_AND_CADETS","tint":null,"option":"c5719ec9a7","optionText":"Help your squadmate","offered":["c5719ec9a7","5e4947fde1"],"rule":"BULLY_1_HELP_THEM","decisionMode":"guide","manual":false,"at":"2026-10-30T01:21:48.695Z","to":"b209bacacec3"},{"scene":"b209bacacec3","stage":"BLUE_DRAGON_ROUTE","tint":null,"option":"6dc46afcb2","optionText":"Pause to assess the situation even though it may risk your squadmate’s life","offered":["483000d9b9","249cab536f","6dc46afcb2"],"rule":"LEARNED_EDGE","decisionMode":"learned","manual":false,"at":"2026-10-30T01:21:52.196Z","to":"fbe0f0bea700"},{"scene":"fbe0f0bea700","stage":"BLUE_DRAGON_ROUTE","tint":null,"option":"40b2e3202f","optionText":"Daggers or not, your squadmate is in danger, so you charge the bigger cadet","offered":["40b2e3202f","dd20bac96c"],"rule":"LEARNED_DASHBOARD","decisionMode":"learned","manual":false,"at":"2026-10-30T01:21:55.696Z","to":"a2368b0dc212"},{"scene":"a2368b0dc212","stage":"BLUE_DRAGON_ROUTE","tint":null,"option":"43fb669800","optionText":"End the lives of the bullies yourself","offered":["e579a5cd9f","43fb669800","2fba1113c6"],"rule":"LEARNED_DASHBOARD","decisionMode":"learned","manual":false,"at":"2026-10-30T01:22:00.378Z","to":"0cfd06cf8939"},{"scene":"0cfd06cf8939","stage":"BLUE_DRAGON_ROUTE","tint":null,"option":"3929adfa07","optionText":"Walk farther into the forest","offered":["cfe44a775d","d79c512261","3929adfa07"],"rule":"LEARNED_DASHBOARD","decisionMode":"learned","manual":false,"at":"2026-10-30T01:22:03.881Z","to":"0a561d53ad19"},{"scene":"0a561d53ad19","stage":"THORN_WALK","tint":null,"option":"7276f2fd9a","optionText":"Find the tallest tree and climb for a better view","offered":["7276f2fd9a","f0700810bf"],"rule":"LEARNED_DASHBOARD","decisionMode":"learned","manual":false,"at":"2026-10-30T01:22:08.585Z","to":"96b68612eaf4"},{"scene":"96b68612eaf4","stage":"FORK_IN_FOREST","tint":null,"option":"c71ea9e2b6","optionText":"Descend quickly in preparation for whatever’s coming your way","offered":["2c5af7e978","c71ea9e2b6"],"rule":"LEARNED_DASHBOARD","decisionMode":"learned","manual":false,"at":"2026-10-30T01:22:13.279Z","to":"10bc7353b8eb"},{"scene":"10bc7353b8eb","stage":"INTENTIONAL_BURN","tint":"red","option":"714e3abd94","optionText":"Reds are too hot-tempered. You’d rather take your chance with that green","offered":["714e3abd94","40c171677e","2991a60b20"],"rule":"RED_TREE_DIVERT_GREEN_FOR_SAFE_BURN","decisionMode":"guide","manual":false,"at":"2026-10-30T01:22:16.740Z","to":"c62f1f1a2b3a"},{"scene":"c62f1f1a2b3a","stage":"INTENTIONAL_BURN","tint":"green","option":"9da997c847","optionText":"Lower your eyes but keep your body neutral, letting them decide","offered":["d7f4b4e9da","bafcacfd8c","9da997c847"],"rule":"BURN_GUARANTEED_INCINERATION","decisionMode":"guide","manual":false,"at":"2026-10-30T01:22:21.450Z","to":"BURNED"}],"outcome":{"type":"BURNED","colour":null,"intentional":true}}
|
||||
{"id":"bot-bb707b0816","source":"bot","meta":{"attempt":4,"startedAt":"2026-10-30T12:31:02.233Z","accountKey":null,"target":null,"decisionMode":null},"steps":[{"scene":"db7786392626","stage":"ENTER_THRESHING","tint":null,"option":"c18f80dd1e","optionText":"Enter the valley alone","offered":["571af425c8","c18f80dd1e","3da794f136"],"rule":"ENTER_GO_ALONE","decisionMode":"guide","manual":false,"at":"2026-10-30T12:31:02.233Z","to":"a68f681076c6"},{"scene":"a68f681076c6","stage":"ENTER_THRESHING","tint":null,"option":"05d19abb5d","optionText":"Head toward the center of the forest","offered":["5f7eefac34","05d19abb5d","9c613e0d47"],"rule":"ENTER_TOWARDS_FOREST_CENTER","decisionMode":"guide","manual":false,"at":"2026-10-30T12:31:05.712Z","to":"abe3011378ac"},{"scene":"abe3011378ac","stage":"FIRST_SIGHTING","tint":"brown","option":"bab6a76e8b","optionText":"Lower your eyes and hold still","offered":["1c97464061","bab6a76e8b","f6fc843ffc"],"rule":"SIGHTING_BROWN_A_HOLD_STILL","decisionMode":"guide","manual":false,"at":"2026-10-30T12:31:09.211Z","to":"84780dab01e3"},{"scene":"84780dab01e3","stage":"FIRST_SIGHTING","tint":"red","option":"6913c7fb2c","optionText":"Head deeper into the forest","offered":["6913c7fb2c"],"rule":"SINGLE_CHOICE_ADVANCE","decisionMode":"guide","manual":false,"at":"2026-10-30T12:31:12.622Z","to":"d25f2759ace0"},{"scene":"d25f2759ace0","stage":"SCREAM_AND_CADETS","tint":null,"option":"2b6d16a461","optionText":"Investigate the scream","offered":["8e03986d31","2b6d16a461"],"rule":"SCREAM_INVESTIGATE","decisionMode":"guide","manual":false,"at":"2026-10-30T12:31:16.054Z","to":"f72199f24b91"},{"scene":"f72199f24b91","stage":"SCREAM_AND_CADETS","tint":null,"option":"c5719ec9a7","optionText":"Help your squadmate","offered":["c5719ec9a7","5e4947fde1"],"rule":"BULLY_1_HELP_THEM","decisionMode":"guide","manual":false,"at":"2026-10-30T12:31:19.501Z","to":"b209bacacec3"},{"scene":"b209bacacec3","stage":"SCREAM_AND_CADETS","tint":null,"option":"6dc46afcb2","optionText":"Pause to assess the situation even though it may risk your squadmate’s life","offered":["249cab536f","483000d9b9","6dc46afcb2"],"rule":"BULLY_2_ASSESS_SITUATION","decisionMode":"guide","manual":false,"at":"2026-10-30T12:31:22.943Z","to":"fbe0f0bea700"},{"scene":"fbe0f0bea700","stage":"SCREAM_AND_CADETS","tint":null,"option":"dd20bac96c","optionText":"Engage the smaller cadet","offered":["40b2e3202f","dd20bac96c"],"rule":"BULLY_3_ENGAGE_SMALLER","decisionMode":"guide","manual":false,"at":"2026-10-30T12:31:26.363Z","to":"f4b4944d3f3b"},{"scene":"f4b4944d3f3b","stage":"SCREAM_AND_CADETS","tint":null,"option":"43fb669800","optionText":"End the lives of the bullies yourself","offered":["e579a5cd9f","43fb669800","2fba1113c6"],"rule":"BULLY_4_KILL_BULLIES","decisionMode":"guide","manual":false,"at":"2026-10-30T12:31:31.012Z","to":"0cfd06cf8939"},{"scene":"0cfd06cf8939","stage":"SCREAM_AND_CADETS","tint":null,"option":"3929adfa07","optionText":"Walk farther into the forest","offered":["cfe44a775d","d79c512261","3929adfa07"],"rule":"ROAD_FORK_DEEPER_FOREST","decisionMode":"guide","manual":false,"at":"2026-10-30T12:31:34.462Z","to":"0a561d53ad19"},{"scene":"0a561d53ad19","stage":"FORK_IN_FOREST","tint":null,"option":"7276f2fd9a","optionText":"Find the tallest tree and climb for a better view","offered":["f0700810bf","7276f2fd9a"],"rule":"FORK_CLIMB_TALLEST_TREE","decisionMode":"guide","manual":false,"at":"2026-10-30T12:31:39.140Z","to":"96b68612eaf4"},{"scene":"96b68612eaf4","stage":"TREE_SHADOW_CHECK","tint":null,"option":"2c5af7e978","optionText":"Climb down slowly to pursue the green","offered":["c71ea9e2b6","2c5af7e978"],"rule":"TREE_NO_SHADOW_AUTO_BURN","decisionMode":"guide","manual":false,"at":"2026-10-30T12:31:43.809Z","to":"07e24681e3b3"},{"scene":"07e24681e3b3","stage":"INTENTIONAL_BURN","tint":"green","option":"9da997c847","optionText":"Lower your eyes but keep your body neutral, letting them decide","offered":["d7f4b4e9da","9da997c847","bafcacfd8c"],"rule":"BURN_GUARANTEED_INCINERATION","decisionMode":"guide","manual":false,"at":"2026-10-30T12:31:49.673Z","to":"BURNED"}],"outcome":{"type":"BURNED","colour":null,"intentional":true}}
|
||||
{"id":"bot-7e96467867","source":"bot","meta":{"attempt":5,"startedAt":"2026-10-30T16:32:01.623Z","accountKey":null,"target":"black","decisionMode":"auto_learn","policyId":null,"experimentId":null,"arm":null},"steps":[{"scene":"db7786392626","stage":"ENTER_THRESHING","tint":null,"option":"c18f80dd1e","optionText":"Enter the valley alone","offered":["c18f80dd1e","3da794f136","571af425c8"],"rule":"ENTER_GO_ALONE","decisionMode":"guide","manual":false,"at":"2026-10-30T16:32:01.623Z","to":"a68f681076c6"},{"scene":"a68f681076c6","stage":"ENTER_THRESHING","tint":null,"option":"05d19abb5d","optionText":"Head toward the center of the forest","offered":["5f7eefac34","9c613e0d47","05d19abb5d"],"rule":"ENTER_TOWARDS_FOREST_CENTER","decisionMode":"guide","manual":false,"at":"2026-10-30T16:32:05.186Z","to":"bc4ee4754b9c"},{"scene":"bc4ee4754b9c","stage":"FIRST_SIGHTING","tint":"red","option":"a31cbcb659","optionText":"Lower your eyes in respect","offered":["a31cbcb659","14181c8e32","1859b3cd4a"],"rule":"SIGHTING_LOWER_EYES_RESPECT","decisionMode":"guide","manual":false,"at":"2026-10-30T16:32:08.740Z","to":"84780dab01e3"},{"scene":"84780dab01e3","stage":"FIRST_SIGHTING","tint":"red","option":"6913c7fb2c","optionText":"Head deeper into the forest","offered":["6913c7fb2c"],"rule":"SINGLE_CHOICE_ADVANCE","decisionMode":"guide","manual":false,"at":"2026-10-30T16:32:12.292Z","to":"d25f2759ace0"},{"scene":"d25f2759ace0","stage":"SCREAM_AND_CADETS","tint":null,"option":"2b6d16a461","optionText":"Investigate the scream","offered":["8e03986d31","2b6d16a461"],"rule":"SCREAM_INVESTIGATE","decisionMode":"guide","manual":false,"at":"2026-10-30T16:32:15.815Z","to":"f72199f24b91"},{"scene":"f72199f24b91","stage":"SCREAM_AND_CADETS","tint":null,"option":"c5719ec9a7","optionText":"Help your squadmate","offered":["c5719ec9a7","5e4947fde1"],"rule":"BULLY_1_HELP_THEM","decisionMode":"guide","manual":false,"at":"2026-10-30T16:32:19.408Z","to":"b209bacacec3"},{"scene":"b209bacacec3","stage":"SCREAM_AND_CADETS","tint":null,"option":"6dc46afcb2","optionText":"Pause to assess the situation even though it may risk your squadmate’s life","offered":["249cab536f","6dc46afcb2","483000d9b9"],"rule":"BULLY_2_ASSESS_SITUATION","decisionMode":"guide","manual":false,"at":"2026-10-30T16:32:22.937Z","to":"fbe0f0bea700"},{"scene":"fbe0f0bea700","stage":"SCREAM_AND_CADETS","tint":null,"option":"dd20bac96c","optionText":"Engage the smaller cadet","offered":["dd20bac96c","40b2e3202f"],"rule":"BULLY_3_ENGAGE_SMALLER","decisionMode":"guide","manual":false,"at":"2026-10-30T16:32:26.473Z","to":"f4b4944d3f3b"},{"scene":"f4b4944d3f3b","stage":"SCREAM_AND_CADETS","tint":null,"option":"43fb669800","optionText":"End the lives of the bullies yourself","offered":["43fb669800","2fba1113c6","e579a5cd9f"],"rule":"BULLY_4_KILL_BULLIES","decisionMode":"guide","manual":false,"at":"2026-10-30T16:32:31.222Z","to":"0cfd06cf8939"},{"scene":"0cfd06cf8939","stage":"SCREAM_AND_CADETS","tint":null,"option":"3929adfa07","optionText":"Walk farther into the forest","offered":["3929adfa07","cfe44a775d","d79c512261"],"rule":"ROAD_FORK_DEEPER_FOREST","decisionMode":"guide","manual":false,"at":"2026-10-30T16:32:34.782Z","to":"0a561d53ad19"},{"scene":"0a561d53ad19","stage":"FORK_IN_FOREST","tint":null,"option":"7276f2fd9a","optionText":"Find the tallest tree and climb for a better view","offered":["7276f2fd9a","f0700810bf"],"rule":"FORK_CLIMB_TALLEST_TREE","decisionMode":"guide","manual":false,"at":"2026-10-30T16:32:39.593Z","to":"96b68612eaf4"},{"scene":"96b68612eaf4","stage":"TREE_SHADOW_CHECK","tint":null,"option":"2c5af7e978","optionText":"Climb down slowly to pursue the green","offered":["2c5af7e978","c71ea9e2b6"],"rule":"TREE_NO_SHADOW_AUTO_BURN","decisionMode":"guide","manual":false,"at":"2026-10-30T16:32:44.371Z","to":"07e24681e3b3"},{"scene":"07e24681e3b3","stage":"INTENTIONAL_BURN","tint":"green","option":"9da997c847","optionText":"Lower your eyes but keep your body neutral, letting them decide","offered":["9da997c847","d7f4b4e9da","bafcacfd8c"],"rule":"BURN_GUARANTEED_INCINERATION","decisionMode":"guide","manual":false,"at":"2026-10-30T16:32:50.391Z","to":"BURNED"}],"outcome":{"type":"BURNED","colour":null,"intentional":true}}
|
||||
{"id":"bot-a4f8157ecf","source":"bot","meta":{"attempt":6,"startedAt":"2026-10-30T20:41:16.681Z","accountKey":null,"target":"black","decisionMode":"auto_learn","policyId":null,"experimentId":null,"arm":null},"steps":[{"scene":"db7786392626","stage":"ENTER_THRESHING","tint":null,"option":"c18f80dd1e","optionText":"Enter the valley alone","offered":["3da794f136","c18f80dd1e","571af425c8"],"rule":"ENTER_GO_ALONE","decisionMode":"guide","manual":false,"at":"2026-10-30T20:41:16.681Z","to":"a68f681076c6"},{"scene":"a68f681076c6","stage":"ENTER_THRESHING","tint":null,"option":"05d19abb5d","optionText":"Head toward the center of the forest","offered":["5f7eefac34","9c613e0d47","05d19abb5d"],"rule":"ENTER_TOWARDS_FOREST_CENTER","decisionMode":"guide","manual":false,"at":"2026-10-30T20:41:20.259Z","to":"abe3011378ac"},{"scene":"abe3011378ac","stage":"FIRST_SIGHTING","tint":"brown","option":"bab6a76e8b","optionText":"Lower your eyes and hold still","offered":["bab6a76e8b","f6fc843ffc","1c97464061"],"rule":"SIGHTING_BROWN_A_HOLD_STILL","decisionMode":"guide","manual":false,"at":"2026-10-30T20:41:23.740Z","to":"84780dab01e3"},{"scene":"84780dab01e3","stage":"FIRST_SIGHTING","tint":"red","option":"6913c7fb2c","optionText":"Head deeper into the forest","offered":["6913c7fb2c"],"rule":"SINGLE_CHOICE_ADVANCE","decisionMode":"guide","manual":false,"at":"2026-10-30T20:41:27.302Z","to":"d25f2759ace0"},{"scene":"d25f2759ace0","stage":"SCREAM_AND_CADETS","tint":null,"option":"2b6d16a461","optionText":"Investigate the scream","offered":["8e03986d31","2b6d16a461"],"rule":"SCREAM_INVESTIGATE","decisionMode":"guide","manual":false,"at":"2026-10-30T20:41:30.816Z","to":"f72199f24b91"},{"scene":"f72199f24b91","stage":"SCREAM_AND_CADETS","tint":null,"option":"c5719ec9a7","optionText":"Help your squadmate","offered":["c5719ec9a7","5e4947fde1"],"rule":"BULLY_1_HELP_THEM","decisionMode":"guide","manual":false,"at":"2026-10-30T20:41:34.353Z","to":"b209bacacec3"},{"scene":"b209bacacec3","stage":"SCREAM_AND_CADETS","tint":null,"option":"6dc46afcb2","optionText":"Pause to assess the situation even though it may risk your squadmate’s life","offered":["483000d9b9","6dc46afcb2","249cab536f"],"rule":"BULLY_2_ASSESS_SITUATION","decisionMode":"guide","manual":false,"at":"2026-10-30T20:41:37.937Z","to":"fbe0f0bea700"},{"scene":"fbe0f0bea700","stage":"SCREAM_AND_CADETS","tint":null,"option":"dd20bac96c","optionText":"Engage the smaller cadet","offered":["40b2e3202f","dd20bac96c"],"rule":"BULLY_3_ENGAGE_SMALLER","decisionMode":"guide","manual":false,"at":"2026-10-30T20:41:41.455Z","to":"f4b4944d3f3b"},{"scene":"f4b4944d3f3b","stage":"SCREAM_AND_CADETS","tint":null,"option":"43fb669800","optionText":"End the lives of the bullies yourself","offered":["43fb669800","2fba1113c6","e579a5cd9f"],"rule":"BULLY_4_KILL_BULLIES","decisionMode":"guide","manual":false,"at":"2026-10-30T20:41:46.182Z","to":"0cfd06cf8939"},{"scene":"0cfd06cf8939","stage":"SCREAM_AND_CADETS","tint":null,"option":"3929adfa07","optionText":"Walk farther into the forest","offered":["3929adfa07","cfe44a775d","d79c512261"],"rule":"ROAD_FORK_DEEPER_FOREST","decisionMode":"guide","manual":false,"at":"2026-10-30T20:41:49.692Z","to":"0a561d53ad19"},{"scene":"0a561d53ad19","stage":"FORK_IN_FOREST","tint":null,"option":"7276f2fd9a","optionText":"Find the tallest tree and climb for a better view","offered":["7276f2fd9a","f0700810bf"],"rule":"FORK_CLIMB_TALLEST_TREE","decisionMode":"guide","manual":false,"at":"2026-10-30T20:41:54.419Z","to":"96b68612eaf4"},{"scene":"96b68612eaf4","stage":"TREE_SHADOW_CHECK","tint":null,"option":"2c5af7e978","optionText":"Climb down slowly to pursue the green","offered":["2c5af7e978","c71ea9e2b6"],"rule":"TREE_NO_SHADOW_AUTO_BURN","decisionMode":"guide","manual":false,"at":"2026-10-30T20:41:59.186Z","to":"07e24681e3b3"},{"scene":"07e24681e3b3","stage":"INTENTIONAL_BURN","tint":"green","option":"9da997c847","optionText":"Lower your eyes but keep your body neutral, letting them decide","offered":["9da997c847","d7f4b4e9da","bafcacfd8c"],"rule":"BURN_GUARANTEED_INCINERATION","decisionMode":"guide","manual":false,"at":"2026-10-30T20:42:05.900Z","to":"BURNED"}],"outcome":{"type":"BURNED","colour":null,"intentional":true}}
|
||||
{"id":"bot-c95f035604","source":"bot","meta":{"attempt":7,"startedAt":"2026-10-31T00:42:16.218Z","accountKey":null,"target":"black","decisionMode":"auto_learn","policyId":null,"experimentId":null,"arm":null},"steps":[{"scene":"db7786392626","stage":"ENTER_THRESHING","tint":null,"option":"c18f80dd1e","optionText":"Enter the valley alone","offered":["571af425c8","c18f80dd1e","3da794f136"],"rule":"ENTER_GO_ALONE","decisionMode":"guide","manual":false,"at":"2026-10-31T00:42:16.218Z","to":"a68f681076c6"},{"scene":"a68f681076c6","stage":"ENTER_THRESHING","tint":null,"option":"05d19abb5d","optionText":"Head toward the center of the forest","offered":["9c613e0d47","05d19abb5d","5f7eefac34"],"rule":"ENTER_TOWARDS_FOREST_CENTER","decisionMode":"guide","manual":false,"at":"2026-10-31T00:42:19.802Z","to":"bc4ee4754b9c"},{"scene":"bc4ee4754b9c","stage":"FIRST_SIGHTING","tint":"red","option":"a31cbcb659","optionText":"Lower your eyes in respect","offered":["a31cbcb659","1859b3cd4a","14181c8e32"],"rule":"SIGHTING_LOWER_EYES_RESPECT","decisionMode":"guide","manual":false,"at":"2026-10-31T00:42:23.442Z","to":"84780dab01e3"},{"scene":"84780dab01e3","stage":"FIRST_SIGHTING","tint":"red","option":"6913c7fb2c","optionText":"Head deeper into the forest","offered":["6913c7fb2c"],"rule":"SINGLE_CHOICE_ADVANCE","decisionMode":"guide","manual":false,"at":"2026-10-31T00:42:26.976Z","to":"d25f2759ace0"},{"scene":"d25f2759ace0","stage":"SCREAM_AND_CADETS","tint":null,"option":"2b6d16a461","optionText":"Investigate the scream","offered":["8e03986d31","2b6d16a461"],"rule":"SCREAM_INVESTIGATE","decisionMode":"guide","manual":false,"at":"2026-10-31T00:42:30.510Z","to":"f72199f24b91"},{"scene":"f72199f24b91","stage":"SCREAM_AND_CADETS","tint":null,"option":"c5719ec9a7","optionText":"Help your squadmate","offered":["c5719ec9a7","5e4947fde1"],"rule":"BULLY_1_HELP_THEM","decisionMode":"guide","manual":false,"at":"2026-10-31T00:42:34.122Z","to":"b209bacacec3"},{"scene":"b209bacacec3","stage":"SCREAM_AND_CADETS","tint":null,"option":"6dc46afcb2","optionText":"Pause to assess the situation even though it may risk your squadmate’s life","offered":["483000d9b9","6dc46afcb2","249cab536f"],"rule":"BULLY_2_ASSESS_SITUATION","decisionMode":"guide","manual":false,"at":"2026-10-31T00:42:37.643Z","to":"fbe0f0bea700"},{"scene":"fbe0f0bea700","stage":"SCREAM_AND_CADETS","tint":null,"option":"dd20bac96c","optionText":"Engage the smaller cadet","offered":["40b2e3202f","dd20bac96c"],"rule":"BULLY_3_ENGAGE_SMALLER","decisionMode":"guide","manual":false,"at":"2026-10-31T00:42:41.219Z","to":"f4b4944d3f3b"},{"scene":"f4b4944d3f3b","stage":"SCREAM_AND_CADETS","tint":null,"option":"43fb669800","optionText":"End the lives of the bullies yourself","offered":["43fb669800","2fba1113c6","e579a5cd9f"],"rule":"BULLY_4_KILL_BULLIES","decisionMode":"guide","manual":false,"at":"2026-10-31T00:42:46.033Z","to":"0cfd06cf8939"},{"scene":"0cfd06cf8939","stage":"SCREAM_AND_CADETS","tint":null,"option":"3929adfa07","optionText":"Walk farther into the forest","offered":["3929adfa07","d79c512261","cfe44a775d"],"rule":"ROAD_FORK_DEEPER_FOREST","decisionMode":"guide","manual":false,"at":"2026-10-31T00:42:50.332Z","to":"0a561d53ad19"},{"scene":"0a561d53ad19","stage":"FORK_IN_FOREST","tint":null,"option":"7276f2fd9a","optionText":"Find the tallest tree and climb for a better view","offered":["7276f2fd9a","f0700810bf"],"rule":"FORK_CLIMB_TALLEST_TREE","decisionMode":"guide","manual":false,"at":"2026-10-31T00:42:55.134Z","to":"96b68612eaf4"},{"scene":"96b68612eaf4","stage":"TREE_SHADOW_CHECK","tint":null,"option":"2c5af7e978","optionText":"Climb down slowly to pursue the green","offered":["c71ea9e2b6","2c5af7e978"],"rule":"TREE_NO_SHADOW_AUTO_BURN","decisionMode":"guide","manual":false,"at":"2026-10-31T00:42:59.963Z","to":"07e24681e3b3"},{"scene":"07e24681e3b3","stage":"INTENTIONAL_BURN","tint":"green","option":"9da997c847","optionText":"Lower your eyes but keep your body neutral, letting them decide","offered":["9da997c847","d7f4b4e9da","bafcacfd8c"],"rule":"BURN_GUARANTEED_INCINERATION","decisionMode":"guide","manual":false,"at":"2026-10-31T00:43:06.002Z","to":"BURNED"}],"outcome":{"type":"BURNED","colour":null,"intentional":true}}
|
||||
+33
-68
@@ -46,8 +46,8 @@
|
||||
"conformsTo": "http://mlcommons.org/croissant/1.0",
|
||||
"name": "Threshing Atlas",
|
||||
"description": "Community-logged runs of the Dragonkind \"threshing\" (the dragon-bonding game based on Fourth Wing), coded into one record per run: every choice, what the game rolled, and how the run ended. Also the route model built from them, the statistics shown on the Threshing Atlas page, and the route graph shared with a DragonKind bot.",
|
||||
"url": "https://git.kenschiano.net/DragonKind/threshing-atlas",
|
||||
"sameAs": "https://git.kenschiano.net/DragonKind/threshing-atlas",
|
||||
"url": "https://git.kenschiano.net/kathleen/threshing-atlas",
|
||||
"sameAs": "https://git.kenschiano.net/kathleen/threshing-atlas",
|
||||
"license": "https://creativecommons.org/licenses/by/4.0/",
|
||||
"creator": {
|
||||
"@type": "sc:Person",
|
||||
@@ -61,38 +61,23 @@
|
||||
"route planning",
|
||||
"community data"
|
||||
],
|
||||
"citeAs": "ekcSchiano and contributors (2026). Threshing Atlas. https://git.kenschiano.net/DragonKind/threshing-atlas",
|
||||
"citeAs": "ekcSchiano and contributors (2026). Threshing Atlas. https://git.kenschiano.net/kathleen/threshing-atlas",
|
||||
"isLiveDataset": true,
|
||||
"isBasedOn": [
|
||||
{
|
||||
"@type": "sc:CreativeWork",
|
||||
"url": "https://docs.google.com/spreadsheets/d/1gnw1AdRg1XT4JsOfRM6QTA0jSaS3n9ZF-rPWnYewzv0",
|
||||
"name": "Threshing Routes form and spreadsheet (u/ClumsyBadger, linked from the r/fourthwing megathreads)"
|
||||
"name": "Threshing Routes form and spreadsheet (u/ClumsyBadger, linked from the r/fourthwing megathreads)",
|
||||
"url": "https://docs.google.com/spreadsheets/d/1gnw1AdRg1XT4JsOfRM6QTA0jSaS3n9ZF-rPWnYewzv0"
|
||||
},
|
||||
{
|
||||
"@type": "sc:CreativeWork",
|
||||
"url": "https://docs.google.com/spreadsheets/d/1KMiE9sec0l597Pzue1OhGYf07NF4howtQ_lPeqx7jXQ",
|
||||
"name": "Unofficial Dragon Register (which dragon each rider bonded)"
|
||||
"name": "Unofficial Dragon Register (which dragon each rider bonded)",
|
||||
"url": "https://docs.google.com/spreadsheets/d/1KMiE9sec0l597Pzue1OhGYf07NF4howtQ_lPeqx7jXQ"
|
||||
},
|
||||
{
|
||||
"@type": "sc:CreativeWork",
|
||||
"url": "https://www.reddit.com/r/fourthwing/comments/1wvwfp9/",
|
||||
"name": "Runs posted in the r/fourthwing Dragonkind megathreads (part 3)"
|
||||
},
|
||||
{
|
||||
"@type": "sc:CreativeWork",
|
||||
"url": "https://www.reddit.com/r/fourthwing/comments/1wz5cnj/",
|
||||
"name": "Runs posted in the r/fourthwing Dragonkind megathreads (part 4)"
|
||||
},
|
||||
{
|
||||
"@type": "sc:CreativeWork",
|
||||
"url": "https://www.reddit.com/r/fourthwing/comments/1wvwfp9/",
|
||||
"name": "Runs riders describe in the r/fourthwing Dragonkind megathread comments (part 3)"
|
||||
},
|
||||
{
|
||||
"@type": "sc:CreativeWork",
|
||||
"url": "https://www.reddit.com/r/fourthwing/comments/1wz5cnj/",
|
||||
"name": "Runs riders describe in the r/fourthwing Dragonkind megathread comments (part 4)"
|
||||
"name": "Runs posted in the r/fourthwing Dragonkind megathreads",
|
||||
"url": "https://www.reddit.com/r/fourthwing/comments/1wvwfp9/"
|
||||
}
|
||||
],
|
||||
"distribution": [
|
||||
@@ -101,90 +86,70 @@
|
||||
"@id": "runs_clean",
|
||||
"name": "runs_clean",
|
||||
"description": "Every run from every source, one per row, coded into the same columns (collection/etl/runs.py; the form's rules are core/spec/form.yaml). The `source` column says where each run came from.",
|
||||
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/runs_clean.csv",
|
||||
"contentUrl": "https://git.kenschiano.net/kathleen/threshing-atlas/raw/branch/main/data/public/runs_clean.csv",
|
||||
"encodingFormat": "text/csv",
|
||||
"sha256": "6938f1a62d1f855ab6abbceb305b9f9388945ec44ef53a16c21d3f3d0c740fbb",
|
||||
"contentSize": "3986165 B"
|
||||
"sha256": "7171151ab23a31d29ffbb30cbde62b29183e6f04c2edf46577aa04f649fe2c68",
|
||||
"contentSize": "3354446 B"
|
||||
},
|
||||
{
|
||||
"@type": "cr:FileObject",
|
||||
"@id": "form_responses",
|
||||
"name": "form_responses",
|
||||
"description": "The community \"Threshing Routes\" form export as published (headers and rows), with email addresses in free-text answers redacted. The source of runs_clean.",
|
||||
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/form_responses.json",
|
||||
"contentUrl": "https://git.kenschiano.net/kathleen/threshing-atlas/raw/branch/main/data/public/form_responses.json",
|
||||
"encodingFormat": "application/json",
|
||||
"sha256": "d5b235f28ad3d1ba91c431328007576251e47294fd8af2ebe7a2cb29e008afef",
|
||||
"contentSize": "13413071 B"
|
||||
},
|
||||
{
|
||||
"@type": "cr:FileObject",
|
||||
"@id": "reddit_comments",
|
||||
"name": "reddit_comments",
|
||||
"description": "Runs described in the r/fourthwing megathread comments, read into the \"Report a run\" answers: comment id, day and answers only, no usernames or comment text.",
|
||||
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/reddit_comments.json",
|
||||
"encodingFormat": "application/json",
|
||||
"sha256": "b169d157e731db23c99f2f8317a9718d31801b7d64336b3d414511ac13f32493",
|
||||
"contentSize": "23174 B"
|
||||
},
|
||||
{
|
||||
"@type": "cr:FileObject",
|
||||
"@id": "overlap",
|
||||
"name": "overlap",
|
||||
"description": "How many Reddit comment runs may also be in the community form (the same answers within a day), against what chance alone gives (analysis/overlap/overlap.py). Measured only: no run is removed.",
|
||||
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/overlap.json",
|
||||
"encodingFormat": "application/json",
|
||||
"sha256": "e7511cccf9e8379d8e892639cb38772269ac228756b984e9e0d4d8e9a583a9dd",
|
||||
"contentSize": "2544 B"
|
||||
"sha256": "4e80832e94cf1c7da4b9e7d508d86144385feefe0fce044862d0a0a0ff611b32",
|
||||
"contentSize": "11996965 B"
|
||||
},
|
||||
{
|
||||
"@type": "cr:FileObject",
|
||||
"@id": "reports",
|
||||
"name": "reports",
|
||||
"description": "Runs reported through the Atlas's \"Report a run\" form (issues on its repository), answers only, no usernames.",
|
||||
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/reports.json",
|
||||
"contentUrl": "https://git.kenschiano.net/kathleen/threshing-atlas/raw/branch/main/data/public/reports.json",
|
||||
"encodingFormat": "application/json",
|
||||
"sha256": "51510ed7a0b4016501fe4e0324a352842e831a48773a08b084dec6ff7dde2d14",
|
||||
"contentSize": "112 B"
|
||||
"sha256": "d42eb04b9923eb1d2a8e5c356452f52daab78293be5a29a448cfb69c974eab30",
|
||||
"contentSize": "92 B"
|
||||
},
|
||||
{
|
||||
"@type": "cr:FileObject",
|
||||
"@id": "register",
|
||||
"name": "register",
|
||||
"description": "The Unofficial Dragon Register (which dragon each rider bonded), without rider names.",
|
||||
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/register.json",
|
||||
"contentUrl": "https://git.kenschiano.net/kathleen/threshing-atlas/raw/branch/main/data/public/register.json",
|
||||
"encodingFormat": "application/json",
|
||||
"sha256": "71457db37c12b2e76190480c1aab9fa00347985b5556a40e877093ddb5635750",
|
||||
"contentSize": "118558 B"
|
||||
"sha256": "c925044f5d49b02a7d6c5b1ee23154e9a3db54f6f1a96f4686be71a3d52fca61",
|
||||
"contentSize": "118171 B"
|
||||
},
|
||||
{
|
||||
"@type": "cr:FileObject",
|
||||
"@id": "stats",
|
||||
"name": "stats",
|
||||
"description": "Every number the Atlas page shows, for six filter presets (analysis/stats/site_stats.py; what is measured is analysis/stats/measures.yaml).",
|
||||
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/stats.json",
|
||||
"contentUrl": "https://git.kenschiano.net/kathleen/threshing-atlas/raw/branch/main/data/public/stats.json",
|
||||
"encodingFormat": "application/json",
|
||||
"sha256": "aa0a7726cbb1a96b0167329200cf6399ddaec4c4d7c8bf4c2f42045d22fd568e",
|
||||
"contentSize": "5195088 B"
|
||||
"sha256": "663b95519cd639365c0e69ae3205bbdcb112f492ad4bbfae9deff5b845f0208d",
|
||||
"contentSize": "5322125 B"
|
||||
},
|
||||
{
|
||||
"@type": "cr:FileObject",
|
||||
"@id": "policy",
|
||||
"name": "policy",
|
||||
"description": "The route model: the game (core/spec/game.yaml), the count tables behind every roll, and the best decision tree for every dragon colour under two goals, with posterior intervals (planner/build_policy.py).",
|
||||
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/policy.json",
|
||||
"contentUrl": "https://git.kenschiano.net/kathleen/threshing-atlas/raw/branch/main/data/public/policy.json",
|
||||
"encodingFormat": "application/json",
|
||||
"sha256": "b0bb5f5cb233b976b5184f121844efa765c9c3f0440d59d4fe95c7b6eeb76514",
|
||||
"contentSize": "987608 B"
|
||||
"sha256": "596126746819e221dd7d3caf4de0bbcc43170cf649c5ef763866f23b9a553abf",
|
||||
"contentSize": "1107643 B"
|
||||
},
|
||||
{
|
||||
"@type": "cr:FileObject",
|
||||
"@id": "graph",
|
||||
"name": "graph",
|
||||
"description": "The route graph over every run in runs_clean.csv, counted per source (analysis/network/build-graph.js).",
|
||||
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/graph.json",
|
||||
"contentUrl": "https://git.kenschiano.net/kathleen/threshing-atlas/raw/branch/main/data/public/graph.json",
|
||||
"encodingFormat": "application/json",
|
||||
"sha256": "8817eea999eb8ffd4848638096fd1e8f06c73fe7d6d75e4ec7ea5e0c8859c842",
|
||||
"contentSize": "84523 B"
|
||||
"sha256": "f1e2070e01fe484ab17812b13390910bd22b17837c64421d3e4a225bc80a7c27",
|
||||
"contentSize": "74031 B"
|
||||
}
|
||||
],
|
||||
"recordSet": [
|
||||
@@ -201,7 +166,7 @@
|
||||
"@type": "cr:Field",
|
||||
"@id": "runs/run_id",
|
||||
"name": "run_id",
|
||||
"description": "Unique id of the run, stable when rows are deleted or re-sorted: sheet-<hash of the form row's answers and timestamp>, register-<hash of the register row>, thread-<result id>, comment-<Reddit comment id>, reported-<issue number> or bot-<hash>.",
|
||||
"description": "Unique id of the run: sheet-<row of the form export>, thread-<result id>, reported-<issue number> or bot-<hash>.",
|
||||
"dataType": "sc:Text",
|
||||
"source": {
|
||||
"fileObject": {
|
||||
@@ -216,7 +181,7 @@
|
||||
"@type": "cr:Field",
|
||||
"@id": "runs/source",
|
||||
"name": "source",
|
||||
"description": "Where the run came from. \"reddit spreadsheet\": the community Threshing Routes form and spreadsheet linked from the r/fourthwing megathreads. \"reddit thread\": a dragonkind.com result page posted in a megathread (bonded, route not recorded). \"reddit comment\": a run a rider described in a megathread comment, read automatically into the \"Report a run\" answers by the threshing-reddit scraper, which delivers them by pull request (hand corrections in collection/manual/reddit_comments.yaml). \"reported\": the Atlas's own \"Report a run\" form. \"bot\": an attempt logged by the DragonKind bot. \"register\": a bonded dragon entered in the community's Unofficial Dragon Register (outcome only, no route; the same run may also be in the spreadsheet). \"reddit pdf\": the community route PDF (a flowchart of the routes, not a log of runs, so it adds no rows today). Values: reddit spreadsheet; reddit thread; reddit comment; register; reported; bot; reddit pdf.",
|
||||
"description": "Where the run came from. \"reddit spreadsheet\": the community Threshing Routes form and spreadsheet linked from the r/fourthwing megathreads. \"reddit thread\": a dragonkind.com result page posted in a megathread (bonded, route not recorded). \"reported\": the Atlas's own \"Report a run\" form. \"bot\": an attempt logged by the DragonKind bot. \"register\": a bonded dragon entered in the community's Unofficial Dragon Register (outcome only, no route; the same run may also be in the spreadsheet). \"reddit pdf\": the community route PDF (a flowchart of the routes, not a log of runs, so it adds no rows today). Values: reddit spreadsheet; reddit thread; register; reported; bot; reddit pdf.",
|
||||
"dataType": "sc:Text",
|
||||
"source": {
|
||||
"fileObject": {
|
||||
@@ -231,7 +196,7 @@
|
||||
"@type": "cr:Field",
|
||||
"@id": "runs/entry",
|
||||
"name": "entry",
|
||||
"description": "For spreadsheet runs, the sheet's own row label: \"Form\" for a form submission (it has a timestamp); bulk-pasted logs keep the label they were pasted with. Bulk logs record every run of the players who kept them, so they are the least selectively reported rows. Empty for other sources. Values: Form; Data Import; BulkUpload3; Manual Upload; Historical import; Unknown import; Unknown.",
|
||||
"description": "For spreadsheet runs, the sheet's own row label: \"Form\" for a form submission (it has a timestamp); bulk-pasted logs keep the label they were pasted with. Bulk logs record every run of the players who kept them, so they are the least selectively reported rows. Empty for other sources. Values: Form; Data Import; BulkUpload3; Manual Upload; Historical import; Unknown import.",
|
||||
"dataType": "sc:Text",
|
||||
"source": {
|
||||
"fileObject": {
|
||||
|
||||
@@ -0,0 +1,490 @@
|
||||
{
|
||||
"sha256": "99953503376b54ee2ca2061bc277c712681a66add4d62737535e4afca11ba03e",
|
||||
"bytes": 638678,
|
||||
"pages": 1,
|
||||
"page_hashes": [
|
||||
"513739c2cb809008"
|
||||
],
|
||||
"line_hashes": [
|
||||
"0005ef79b6b0",
|
||||
"013509f3baab",
|
||||
"01a32ae0ea35",
|
||||
"01ff39e78d46",
|
||||
"021bb8f33946",
|
||||
"0309a521e7cd",
|
||||
"033394145a6f",
|
||||
"0340ff1da1bc",
|
||||
"061bdd1646d2",
|
||||
"06845f929ace",
|
||||
"06deac5b8d4a",
|
||||
"070e3c5097ec",
|
||||
"07422fff191a",
|
||||
"075f329cca76",
|
||||
"0844df8fee9e",
|
||||
"084d9c75411f",
|
||||
"08dbea2e99c7",
|
||||
"093e7d5fdbaa",
|
||||
"09ede21a5670",
|
||||
"0a6389a6b822",
|
||||
"0c3e015009e5",
|
||||
"0c6edb02c260",
|
||||
"0caca604d8ec",
|
||||
"0d00728c456e",
|
||||
"0d063950e5cb",
|
||||
"0d2b6043baa9",
|
||||
"0e00db4dcc8a",
|
||||
"0e4e929314bc",
|
||||
"0e5021c854fd",
|
||||
"0fa4700b553a",
|
||||
"0fb542ca6733",
|
||||
"1060c135e592",
|
||||
"106a5842fc5f",
|
||||
"115b5cad43c0",
|
||||
"119a95345c45",
|
||||
"126b59a70f14",
|
||||
"1290a0a97b80",
|
||||
"14558e7e73c8",
|
||||
"14e2d4c37b5b",
|
||||
"1584dc810a09",
|
||||
"16367aacb67a",
|
||||
"16477688c0e0",
|
||||
"16486a0e2e7e",
|
||||
"16552853f950",
|
||||
"167a79b5d437",
|
||||
"16872ead1390",
|
||||
"16a87122c069",
|
||||
"17fce8dabd41",
|
||||
"18136e0d6414",
|
||||
"18f42f5e8e05",
|
||||
"1a1d05853cee",
|
||||
"1aefe47e20eb",
|
||||
"1b4c9133da73",
|
||||
"1fa9e3998e8b",
|
||||
"1fbdd6f48a30",
|
||||
"20539cda4fc1",
|
||||
"21499b8293b5",
|
||||
"21e4274038e8",
|
||||
"2287d8613d2a",
|
||||
"2309d4da946e",
|
||||
"24613f13905f",
|
||||
"24c668f6df98",
|
||||
"25135325b8a1",
|
||||
"25f6f2b99e6c",
|
||||
"27042f4e6eca",
|
||||
"27058a345f0b",
|
||||
"27259f1f9d9b",
|
||||
"27a37ec8b577",
|
||||
"2840a5c2ef51",
|
||||
"28fdae8deae3",
|
||||
"29ba6947875f",
|
||||
"29bdb54f41e3",
|
||||
"2ad8a7049d7c",
|
||||
"2af59eff1aba",
|
||||
"2bd88b225a02",
|
||||
"2bfd396cd229",
|
||||
"2d306ed42cd7",
|
||||
"2de7de149983",
|
||||
"2e8e7a08f162",
|
||||
"2f251aff0a77",
|
||||
"2f501595d6f2",
|
||||
"2f63258bd7ea",
|
||||
"2f943c163229",
|
||||
"2fe14cd5feca",
|
||||
"306a70a396b4",
|
||||
"306c9b061933",
|
||||
"310ff200149b",
|
||||
"31365ab9453d",
|
||||
"3253cfe4c152",
|
||||
"32e48995f98c",
|
||||
"331306fab15d",
|
||||
"3342b7db5f17",
|
||||
"33b6aa152d23",
|
||||
"3495806a7d6c",
|
||||
"34bbac2c759b",
|
||||
"34bef004e7fe",
|
||||
"351421b8bac7",
|
||||
"3650b7f3b7c5",
|
||||
"3693c0f2d9d6",
|
||||
"36bddc3a241f",
|
||||
"370b1d50ab9e",
|
||||
"3ad433972874",
|
||||
"3af12ce68cd1",
|
||||
"3af395aa2538",
|
||||
"3beeaab32ac7",
|
||||
"3c482346f375",
|
||||
"3c6120e7558f",
|
||||
"3ccce1f4da94",
|
||||
"3cf48f3ba37d",
|
||||
"3d5d5ba737e9",
|
||||
"3d7505bbaadb",
|
||||
"3d7f757f5e80",
|
||||
"3daa8653d747",
|
||||
"3e213b2a24a7",
|
||||
"3e249a6cfd1e",
|
||||
"3fc4ccfe7458",
|
||||
"4062a9f595aa",
|
||||
"40c432addf51",
|
||||
"40d56877304e",
|
||||
"40efa81686c6",
|
||||
"414805731daf",
|
||||
"41b0c91ed6d1",
|
||||
"41bc7b0a9de2",
|
||||
"41f20dee5da8",
|
||||
"429e5436f520",
|
||||
"42a21ed159ef",
|
||||
"42ff6957f0a3",
|
||||
"447048356f8c",
|
||||
"453962996160",
|
||||
"45847b618b88",
|
||||
"45b162d4052f",
|
||||
"466b733c13e3",
|
||||
"46b86c91e7dc",
|
||||
"4743a7d9869f",
|
||||
"489620cdfe3f",
|
||||
"491004bb0c9c",
|
||||
"4945a70fa7f9",
|
||||
"4978c1d21cf6",
|
||||
"49c7fc30c959",
|
||||
"4ac67444801e",
|
||||
"4acde18a14fe",
|
||||
"4b7e2845d537",
|
||||
"4c3598c88d72",
|
||||
"4cd1594422d4",
|
||||
"4d0705fe0a43",
|
||||
"4d74e17e5162",
|
||||
"4e00a0ada947",
|
||||
"4e7841613cc7",
|
||||
"4f253b49f165",
|
||||
"5066f3a82472",
|
||||
"509a7aea82f7",
|
||||
"510e291d89cb",
|
||||
"519735f7b50e",
|
||||
"532ef4c15de8",
|
||||
"53d2eb410d18",
|
||||
"53f62454ac36",
|
||||
"5586092a2a2e",
|
||||
"56100f08de18",
|
||||
"574516c105b3",
|
||||
"5751e048eb6f",
|
||||
"57ae2b2ab747",
|
||||
"59b6221a51c1",
|
||||
"5a785c0c26ab",
|
||||
"5a8a1e3f617e",
|
||||
"5b3975651c3c",
|
||||
"5c2b4df891b0",
|
||||
"5c385ea2003b",
|
||||
"5c6039c55d3e",
|
||||
"5d09fad99d0b",
|
||||
"5df17b0e4664",
|
||||
"5e9c9ea87d06",
|
||||
"5eb67f9f8409",
|
||||
"5ed0a10b951b",
|
||||
"5f3f6470bb31",
|
||||
"6038ac4d7893",
|
||||
"618cef59e81d",
|
||||
"626a5a89e9aa",
|
||||
"62db96bae199",
|
||||
"63a1d7c638d4",
|
||||
"6415fae65a2b",
|
||||
"65ddfc96e288",
|
||||
"668fea7bbc6f",
|
||||
"680dce633db1",
|
||||
"696a74e35192",
|
||||
"69dacd6c8b7f",
|
||||
"6a3432dd57a9",
|
||||
"6a7ef134f235",
|
||||
"6b32aa9d4ff4",
|
||||
"6b46e167e442",
|
||||
"6bb9c00e0aa5",
|
||||
"6c45cb72a36e",
|
||||
"6c8a73953696",
|
||||
"6ca23bf7ced0",
|
||||
"6d19ba36e0fe",
|
||||
"6d1ef368012c",
|
||||
"6d4a1297d150",
|
||||
"6da5700a5639",
|
||||
"6dca03cf2f51",
|
||||
"6eb4b60a51cf",
|
||||
"70e0378cb382",
|
||||
"718b3ba4d288",
|
||||
"7316da8715b2",
|
||||
"73493e3a688b",
|
||||
"73d41a094816",
|
||||
"743b4e8706ef",
|
||||
"7488af2a0881",
|
||||
"75ad72417087",
|
||||
"75fdd9027b0a",
|
||||
"7692c3ad3540",
|
||||
"76a796208b71",
|
||||
"771b94c11b83",
|
||||
"77aa50b9631e",
|
||||
"77b8d989055a",
|
||||
"793080bb3a18",
|
||||
"79ea70ff1e9b",
|
||||
"7b02bb57a565",
|
||||
"7b78cfa89480",
|
||||
"7d9d2e568dc6",
|
||||
"7e125ce01532",
|
||||
"7e5056bd90f6",
|
||||
"806112b3adcd",
|
||||
"812f1ac36f2e",
|
||||
"817286c6b049",
|
||||
"81f8bd569345",
|
||||
"821343c8782b",
|
||||
"826efdadff57",
|
||||
"82b8b62bc350",
|
||||
"844c6714bd43",
|
||||
"844cae5956bf",
|
||||
"846e18aeea60",
|
||||
"84ce9897665f",
|
||||
"8577b991fbf8",
|
||||
"860ce7852dc3",
|
||||
"87094fc18528",
|
||||
"877de8ebb965",
|
||||
"87ad118c11e5",
|
||||
"87c3e080dcb4",
|
||||
"8838a3634b92",
|
||||
"883caeb7ca11",
|
||||
"88f682991696",
|
||||
"89045a19abd3",
|
||||
"8950aeb7bd2e",
|
||||
"899b7c875126",
|
||||
"8bab6b875ef7",
|
||||
"8c25ea741f54",
|
||||
"8d988fa37098",
|
||||
"8d9f59690970",
|
||||
"8e465d332643",
|
||||
"8ff7f746ad0b",
|
||||
"902e6d1a2e41",
|
||||
"9160990b5196",
|
||||
"91918d7d290f",
|
||||
"919bc9b8d743",
|
||||
"920a5924f124",
|
||||
"935f14ac67b6",
|
||||
"94ab1f4a7216",
|
||||
"954f0ca1b653",
|
||||
"95a14ed2a7fc",
|
||||
"95d77302ee47",
|
||||
"961836168b5b",
|
||||
"964954c9200c",
|
||||
"984814d47989",
|
||||
"987777fb002e",
|
||||
"997b80a62167",
|
||||
"99b5f979b8f6",
|
||||
"9a43a6e28ae1",
|
||||
"9a72012b0738",
|
||||
"9b6cdd23ebfd",
|
||||
"9b74bfb78b8a",
|
||||
"9c4180730556",
|
||||
"9c96829a8db2",
|
||||
"9d8368e07ec1",
|
||||
"9dbb8ef0cfbe",
|
||||
"9dc08e403382",
|
||||
"9e13d99f2ec9",
|
||||
"9e6242783cf6",
|
||||
"9f56d2f4cae6",
|
||||
"9fef67eeac85",
|
||||
"a00b1ba9e0fb",
|
||||
"a060335c66cf",
|
||||
"a093d3f5ecff",
|
||||
"a0f941fee4c0",
|
||||
"a2972765764c",
|
||||
"a2a92faf51c6",
|
||||
"a35c9fb774e6",
|
||||
"a36373ed77ba",
|
||||
"a3d7a6bf2036",
|
||||
"a3f146576c0e",
|
||||
"a5973cf86c17",
|
||||
"a69a4139b340",
|
||||
"a6e0a42de76e",
|
||||
"a6e8ab03915b",
|
||||
"a7937b64b8ca",
|
||||
"a7cdf72224c0",
|
||||
"a7dbeb539e04",
|
||||
"a854942a3868",
|
||||
"a8892d94fb8f",
|
||||
"a8ac9cbce523",
|
||||
"a8faaccd9225",
|
||||
"a908043ed469",
|
||||
"a9c43be948c5",
|
||||
"a9c9cca61f97",
|
||||
"a9d4b2eeab21",
|
||||
"a9f6216a0284",
|
||||
"a9fc9e5a9392",
|
||||
"aa43aff07d84",
|
||||
"ab455d73f4e1",
|
||||
"abfc412ce6e5",
|
||||
"acba25512100",
|
||||
"ace6f6b30de2",
|
||||
"aceee3c152b4",
|
||||
"ad485b06c7ff",
|
||||
"adb35344b704",
|
||||
"aea01b0f80d4",
|
||||
"aeb8e7b22c53",
|
||||
"aee408847d35",
|
||||
"aeee13ca5367",
|
||||
"aef0f56e108d",
|
||||
"af07ff91ab7c",
|
||||
"af6ee9910675",
|
||||
"afa54821283c",
|
||||
"afda0d03d5a4",
|
||||
"b00a0d1bf844",
|
||||
"b02c92648f0c",
|
||||
"b0c1e513d4a4",
|
||||
"b2081dd581e8",
|
||||
"b23641a50841",
|
||||
"b23a6a8439c0",
|
||||
"b26da2826c7d",
|
||||
"b32c487e019c",
|
||||
"b3b8898b5da9",
|
||||
"b3d9c50e24f4",
|
||||
"b4fbbe802d67",
|
||||
"b5afeb8db3aa",
|
||||
"b627f4168840",
|
||||
"b724cc07becf",
|
||||
"b7bd4220ff85",
|
||||
"b8ab74d65421",
|
||||
"b8b0e7effd20",
|
||||
"b95206531cb4",
|
||||
"ba4788b226aa",
|
||||
"bac081e175b0",
|
||||
"bb0e505c6386",
|
||||
"bb36f57782ca",
|
||||
"bb6db2fb1f33",
|
||||
"bc807bf2a135",
|
||||
"be5ba8fe14a3",
|
||||
"bec9019352b4",
|
||||
"bf1563e43ef8",
|
||||
"bf973180096e",
|
||||
"bfdb888b8751",
|
||||
"c0119487dd61",
|
||||
"c0ac6a7adbc9",
|
||||
"c176f96fff0c",
|
||||
"c1a6320ab4ad",
|
||||
"c1c369840b67",
|
||||
"c29277f55fb3",
|
||||
"c35c812678a2",
|
||||
"c4bc2e4b5d80",
|
||||
"c524989dd971",
|
||||
"c54dbcd6c9a7",
|
||||
"c5afb84019c7",
|
||||
"c5d35286c108",
|
||||
"c68fef1abac6",
|
||||
"c78a686d7cf5",
|
||||
"c78f34b0d79b",
|
||||
"c84d205e4185",
|
||||
"c897882a79aa",
|
||||
"c95ca8650396",
|
||||
"c98e94e2a5f1",
|
||||
"caa6a9ced701",
|
||||
"cb28392914d1",
|
||||
"cc2e668bb959",
|
||||
"cca94b79f1f1",
|
||||
"cd1bb3012bcf",
|
||||
"ce8371563887",
|
||||
"ce8e9aa287dc",
|
||||
"cebb73212de0",
|
||||
"cec9111de36d",
|
||||
"cee6d39a9dae",
|
||||
"d00d825bba6b",
|
||||
"d036316da911",
|
||||
"d06e32ad1536",
|
||||
"d0a7f376d907",
|
||||
"d0bf30710858",
|
||||
"d15a1edfb23c",
|
||||
"d1dbecdfe93d",
|
||||
"d2fa0e68a582",
|
||||
"d3774d36d6cb",
|
||||
"d3acc6861a0d",
|
||||
"d413d29b87df",
|
||||
"d4536f255583",
|
||||
"d5a0d90574d5",
|
||||
"d61483fb5f57",
|
||||
"d76d5e7a3df7",
|
||||
"d88c2c2a6831",
|
||||
"d8fe183f5b8e",
|
||||
"d90b4f86d5e0",
|
||||
"d942f0a84262",
|
||||
"d978e0e48792",
|
||||
"d9a847a1a79a",
|
||||
"d9ae6af36f3c",
|
||||
"dab3df07f542",
|
||||
"dab61aea1eb7",
|
||||
"db875b25b06f",
|
||||
"dbb3b50e59c7",
|
||||
"dc439b56f090",
|
||||
"dc6784c12e4a",
|
||||
"dc934fe30a94",
|
||||
"dc9c5edb8b2d",
|
||||
"dcebdc7c87c1",
|
||||
"dd0cb2944980",
|
||||
"dd6222c3b730",
|
||||
"dddb00ed93b8",
|
||||
"ddef924cf594",
|
||||
"de0e10e162e2",
|
||||
"de44be0064f1",
|
||||
"df3f3c5b4066",
|
||||
"e10ff24d56e9",
|
||||
"e1d67a1ebbc7",
|
||||
"e256ee8e7aff",
|
||||
"e37f279ac396",
|
||||
"e3f8ef6845ac",
|
||||
"e40dfff1a71e",
|
||||
"e4bcc131d644",
|
||||
"e4d6190e25b9",
|
||||
"e53bac8ba854",
|
||||
"e564b4081d7a",
|
||||
"e566c53e48ba",
|
||||
"e596899f114b",
|
||||
"e5a05ee2bbba",
|
||||
"e644b77bfa11",
|
||||
"e6c66d78c859",
|
||||
"e6e6263ada92",
|
||||
"e76566a6d54c",
|
||||
"e774d221fc45",
|
||||
"e7c0d9c5bc32",
|
||||
"e84978ebc645",
|
||||
"e8902e5de81c",
|
||||
"e9c5da6aa913",
|
||||
"ea28f8974142",
|
||||
"ea436127abfb",
|
||||
"ea6c1c7a7a76",
|
||||
"ea7fc9c5ea1c",
|
||||
"eb04474cc31f",
|
||||
"ec017cadac18",
|
||||
"ec17f572de06",
|
||||
"ed6f7162410b",
|
||||
"eded8d613508",
|
||||
"eeeb42e33061",
|
||||
"eef98a799e12",
|
||||
"ef379363dd0c",
|
||||
"efd8ebf4f438",
|
||||
"f0dce65b5798",
|
||||
"f179a509d32b",
|
||||
"f1cb18decbab",
|
||||
"f2a49ad419d2",
|
||||
"f35864389230",
|
||||
"f39dda09980e",
|
||||
"f3c7807d4750",
|
||||
"f3e394c8b9dc",
|
||||
"f4909e20a51e",
|
||||
"f51563619474",
|
||||
"f6a4807a956f",
|
||||
"f70b7769ae02",
|
||||
"f763b9be2dc9",
|
||||
"f8c25133ee80",
|
||||
"f96ae5d430a6",
|
||||
"fac6a3243ed4",
|
||||
"facf8b54e5c0",
|
||||
"faebbd710849",
|
||||
"fbd161e2c059",
|
||||
"fca413c36342",
|
||||
"fd5cd809e2aa",
|
||||
"fdbbfc2be926",
|
||||
"fe4c73974e0e",
|
||||
"ff06886f82e3",
|
||||
"ff1f017072cc",
|
||||
"ffe503ead4e4"
|
||||
],
|
||||
"checked": "2026-11-16"
|
||||
}
|
||||
+4
-18
@@ -35,18 +35,6 @@ files:
|
||||
description: >-
|
||||
The community "Threshing Routes" form export as published (headers and rows), with email addresses in
|
||||
free-text answers redacted. The source of runs_clean.
|
||||
reddit_comments:
|
||||
path: data/public/reddit_comments.json
|
||||
format: application/json
|
||||
description: >-
|
||||
Runs described in the r/fourthwing megathread comments, read into the "Report a run" answers: comment id, day
|
||||
and answers only, no usernames or comment text.
|
||||
overlap:
|
||||
path: data/public/overlap.json
|
||||
format: application/json
|
||||
description: >-
|
||||
How many Reddit comment runs may also be in the community form (the same answers within a day), against what
|
||||
chance alone gives (analysis/overlap/overlap.py). Measured only: no run is removed.
|
||||
reports:
|
||||
path: data/public/reports.json
|
||||
format: application/json
|
||||
@@ -75,27 +63,25 @@ files:
|
||||
# The columns of runs_clean. type: text, integer, boolean or date. values: every value the column may take
|
||||
# (empty cells are always allowed and mean "does not apply" or "not recorded").
|
||||
columns:
|
||||
run_id: { type: text, required: true, description: "Unique id of the run, stable when rows are deleted or re-sorted: sheet-<hash of the form row's answers and timestamp>, register-<hash of the register row>, thread-<result id>, comment-<Reddit comment id>, reported-<issue number> or bot-<hash>." }
|
||||
run_id: { type: text, required: true, description: "Unique id of the run: sheet-<row of the form export>, thread-<result id>, reported-<issue number> or bot-<hash>." }
|
||||
source:
|
||||
type: text
|
||||
required: true
|
||||
description: >-
|
||||
Where the run came from. "reddit spreadsheet": the community Threshing Routes form and spreadsheet linked from
|
||||
the r/fourthwing megathreads. "reddit thread": a dragonkind.com result page posted in a megathread (bonded,
|
||||
route not recorded). "reddit comment": a run a rider described in a megathread comment, read automatically into
|
||||
the "Report a run" answers by the threshing-reddit scraper, which delivers them by pull request (hand
|
||||
corrections in collection/manual/reddit_comments.yaml). "reported": the Atlas's own "Report a run" form. "bot": an attempt logged by the
|
||||
route not recorded). "reported": the Atlas's own "Report a run" form. "bot": an attempt logged by the
|
||||
DragonKind bot. "register": a bonded dragon entered in the community's Unofficial Dragon Register (outcome
|
||||
only, no route; the same run may also be in the spreadsheet). "reddit pdf": the community route PDF (a
|
||||
flowchart of the routes, not a log of runs, so it adds no rows today).
|
||||
values: [reddit spreadsheet, reddit thread, reddit comment, register, reported, bot, reddit pdf]
|
||||
values: [reddit spreadsheet, reddit thread, register, reported, bot, reddit pdf]
|
||||
entry:
|
||||
type: text
|
||||
description: >-
|
||||
For spreadsheet runs, the sheet's own row label: "Form" for a form submission (it has a timestamp);
|
||||
bulk-pasted logs keep the label they were pasted with. Bulk logs record every run of the players who kept
|
||||
them, so they are the least selectively reported rows. Empty for other sources.
|
||||
values: [Form, Data Import, BulkUpload3, Manual Upload, Historical import, Unknown import, Unknown]
|
||||
values: [Form, Data Import, BulkUpload3, Manual Upload, Historical import, Unknown import]
|
||||
bot_mode:
|
||||
type: text
|
||||
description: >-
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"bot": {
|
||||
"sha256": "fc3fbf23e39d29985d73a4693824c9b9bbadfc5b86361f8f5bd160aad094b1df",
|
||||
"bytes": 11742294,
|
||||
"changed": "2026-11-10"
|
||||
},
|
||||
"reddit_pdf": {
|
||||
"sha256": "99953503376b54ee2ca2061bc277c712681a66add4d62737535e4afca11ba03e",
|
||||
"bytes": 638678,
|
||||
"changed": "2026-11-16"
|
||||
},
|
||||
"reddit_spreadsheet": {
|
||||
"sha256": "ad57c66b6cb0574717a1c76124ae5f451766e979a6178febda268a2a5fc738d8",
|
||||
"bytes": 6384851,
|
||||
"changed": "2026-11-17"
|
||||
},
|
||||
"register": {
|
||||
"sha256": "6671704e3cc197593365a92e637a8bbbed14f8c17cf1c493de66be6beb9ee863",
|
||||
"bytes": 51191,
|
||||
"changed": "2026-11-17"
|
||||
},
|
||||
"reported": {
|
||||
"sha256": "4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945",
|
||||
"bytes": 2,
|
||||
"changed": "2026-11-04"
|
||||
}
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
{
|
||||
"schema": 1,
|
||||
"rule": {
|
||||
"min_answers": 4,
|
||||
"window_days": 1,
|
||||
"baseline_shifts_days": [
|
||||
-28,
|
||||
-21,
|
||||
-14,
|
||||
14,
|
||||
21,
|
||||
28
|
||||
]
|
||||
},
|
||||
"comment_runs": 82,
|
||||
"comparable": 36,
|
||||
"matched": 9,
|
||||
"expected_by_chance": 7.3,
|
||||
"likely_double": 1.7,
|
||||
"matches": [
|
||||
{
|
||||
"comment": "comment-pdjr7gm",
|
||||
"form": [
|
||||
"sheet-e42d078df15a",
|
||||
"sheet-d930d7c3533d"
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "comment-pdq6tsw",
|
||||
"form": [
|
||||
"sheet-e588ea82d6f9",
|
||||
"sheet-410e2db3f2df",
|
||||
"sheet-af47d3ca8ef8"
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "comment-pe0kwol",
|
||||
"form": [
|
||||
"sheet-bea7c3c25e85"
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "comment-pe2l6mz",
|
||||
"form": [
|
||||
"sheet-7a526f9f5956",
|
||||
"sheet-8191a69798de",
|
||||
"sheet-0d56c45763b7",
|
||||
"sheet-c51873588c6d",
|
||||
"sheet-b8d6d0a2ce4c",
|
||||
"sheet-34e592789d1b",
|
||||
"sheet-66e8fda4be49",
|
||||
"sheet-1922bb0d7397",
|
||||
"sheet-37f31b85732d"
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "comment-pe2n3j1",
|
||||
"form": [
|
||||
"sheet-807397c3d7e2",
|
||||
"sheet-ff44440c3570"
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "comment-pev3uge",
|
||||
"form": [
|
||||
"sheet-9c848ba4c9a9",
|
||||
"sheet-65c505bb553d",
|
||||
"sheet-93077866d5b5",
|
||||
"sheet-f4ba657cd34c",
|
||||
"sheet-2fa18d22a1eb",
|
||||
"sheet-4602a99ee254",
|
||||
"sheet-5320d71ea890",
|
||||
"sheet-55b901b0c666",
|
||||
"sheet-94b17052d8c3",
|
||||
"sheet-8924c5206376",
|
||||
"sheet-81124318fbca",
|
||||
"sheet-1346c5ddbeb6",
|
||||
"sheet-c8670abfd8b3",
|
||||
"sheet-913d430db3ed",
|
||||
"sheet-2fa9c70f091d",
|
||||
"sheet-19e5e9069e3b",
|
||||
"sheet-19ecd172b18a",
|
||||
"sheet-62484835c1c0",
|
||||
"sheet-86e585f7994e",
|
||||
"sheet-ad2265128708",
|
||||
"sheet-f65261b3b1f7",
|
||||
"sheet-cead6ddb0272",
|
||||
"sheet-dd7216ed25e8",
|
||||
"sheet-60a2410b997e",
|
||||
"sheet-93303aaac8a1",
|
||||
"sheet-aac64def431c",
|
||||
"sheet-a62003707841",
|
||||
"sheet-76d43e939528",
|
||||
"sheet-ca945bc0e4f7",
|
||||
"sheet-83270750d93e",
|
||||
"sheet-7cb7c22a757e",
|
||||
"sheet-1598950786a0",
|
||||
"sheet-0d44ea821771",
|
||||
"sheet-cc3275c111d3",
|
||||
"sheet-899c141a899c"
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "comment-pf22tpj",
|
||||
"form": [
|
||||
"sheet-3fdbb179c709",
|
||||
"sheet-08a79a6ae907",
|
||||
"sheet-73d9e41fee8d",
|
||||
"sheet-172fec1dedc4",
|
||||
"sheet-792cc1632e55",
|
||||
"sheet-e97b3363e32f",
|
||||
"sheet-d81d1b4b8c65",
|
||||
"sheet-bcb8e109f973",
|
||||
"sheet-8d6f20b09b5e",
|
||||
"sheet-3848c3443c4e",
|
||||
"sheet-ff87178ef296",
|
||||
"sheet-5819e3882bec",
|
||||
"sheet-aba89201ba1e"
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "comment-pfhmw5d",
|
||||
"form": [
|
||||
"sheet-b03b79966bdb"
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "comment-pgzz9hc",
|
||||
"form": [
|
||||
"sheet-344751923fc3"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,737 +0,0 @@
|
||||
{
|
||||
"_about": "The answers inside each bonding encounter, transcribed by hand from the community route PDF (see source). Data, not the flowchart: each option's answer (say), the guide's printed rate (pct), whether it is on the guide's recommended dark-tile path (best), whether the guide marks it untested or unconfirmed (unconfirmed), and what follows (then) or how it ends (end); roll marks a step the guide calls an unknown chance or decision. route_encounters: which encounters each bonding encounter of the route model shows. Edit this file when the PDF changes (the daily check opens a pull request on the bot's repo when it does).",
|
||||
"version": 1,
|
||||
"source": {
|
||||
"title": "Threshing Options (community route PDF)",
|
||||
"authors": [
|
||||
"u/ClumsyBadger",
|
||||
"u/Old_Regular3018",
|
||||
"u/Smart_Trifle_2099"
|
||||
],
|
||||
"version": "2026-11-16",
|
||||
"link": "https://drive.google.com/file/d/17o72ehHsSPW4UdsKF-sXTxMLEuinWeEg/view",
|
||||
"note": "Percentages are the guide's, from documented runs; options off the recommended path often rest on fewer than three records."
|
||||
},
|
||||
"encounters": {
|
||||
"valley-Red": {
|
||||
"title": "The valley Red",
|
||||
"scene": "You're moved by an instinctual feeling that this...",
|
||||
"options": [
|
||||
{
|
||||
"say": "Is your dragon",
|
||||
"best": true,
|
||||
"then": [
|
||||
{
|
||||
"say": "You're sure",
|
||||
"best": true,
|
||||
"then": [
|
||||
{
|
||||
"say": "Continue approach",
|
||||
"best": true,
|
||||
"then": [
|
||||
{
|
||||
"say": "Touch its talon",
|
||||
"best": true,
|
||||
"pct": "93%",
|
||||
"end": "Bonded"
|
||||
},
|
||||
{
|
||||
"say": "Run to mount its foreleg",
|
||||
"end": "Bonded"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Exit gracefully",
|
||||
"end": "That was close (on to the meadow)"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "On second thought…",
|
||||
"end": "That was close (on to the meadow)"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Is not your dragon, leave",
|
||||
"end": "That was close (on to the meadow)"
|
||||
}
|
||||
]
|
||||
},
|
||||
"tree-Red": {
|
||||
"title": "The Red below the tree",
|
||||
"scene": "A red dragon prowls ten feet beneath you.",
|
||||
"warning": "The guide gives a 98% chance of dying if you engage this dragon.",
|
||||
"options": [
|
||||
{
|
||||
"say": "Jump on its back, or jump to land by its tail",
|
||||
"then": [
|
||||
{
|
||||
"roll": "Some unknown chance or decision roll"
|
||||
},
|
||||
{
|
||||
"say": "Hold the Red's gaze",
|
||||
"then": [
|
||||
{
|
||||
"say": "Jump off and hope",
|
||||
"end": "Incinerated"
|
||||
},
|
||||
{
|
||||
"say": "Drop to your stomach",
|
||||
"then": [
|
||||
{
|
||||
"say": "Hang tight",
|
||||
"end": "Incinerated"
|
||||
},
|
||||
{
|
||||
"say": "Crawl to the seat",
|
||||
"pct": "2%",
|
||||
"end": "Bonded"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Lower your eyes",
|
||||
"end": "Incinerated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Wait and pursue the Green",
|
||||
"end": "On to the two Greens"
|
||||
}
|
||||
]
|
||||
},
|
||||
"tree-Greens": {
|
||||
"title": "The two Greens",
|
||||
"scene": "You enter a clearing with two Green dragons.",
|
||||
"options": [
|
||||
{
|
||||
"say": "Turn to the right dragon",
|
||||
"best": true,
|
||||
"then": [
|
||||
{
|
||||
"say": "Glance to the left dragon",
|
||||
"end": "Incinerated"
|
||||
},
|
||||
{
|
||||
"say": "Don't move a muscle",
|
||||
"best": true,
|
||||
"then": [
|
||||
{
|
||||
"say": "Stay still",
|
||||
"best": true,
|
||||
"then": [
|
||||
{
|
||||
"say": "Decapitation isn't scary",
|
||||
"best": true,
|
||||
"then": [
|
||||
{
|
||||
"say": "You respect their nature",
|
||||
"best": true,
|
||||
"end": "Bonded (Right Green)"
|
||||
},
|
||||
{
|
||||
"say": "You don't know",
|
||||
"end": "Incinerated"
|
||||
},
|
||||
{
|
||||
"say": "Greens have the best magic",
|
||||
"best": true,
|
||||
"end": "Bonded (Left Green)"
|
||||
},
|
||||
{
|
||||
"say": "Intellect match",
|
||||
"best": true,
|
||||
"end": "A Brown saves you: Bonded (Brown)"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Sidestep out of its mouth",
|
||||
"end": "Incinerated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Sidestep out of its mouth",
|
||||
"end": "Incinerated"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Turn to the left dragon",
|
||||
"best": true,
|
||||
"then": [
|
||||
{
|
||||
"say": "Glance to the right dragon",
|
||||
"end": "Incinerated"
|
||||
},
|
||||
{
|
||||
"say": "Don't move a muscle",
|
||||
"best": true,
|
||||
"then": [
|
||||
{
|
||||
"say": "Hold your ground",
|
||||
"best": true,
|
||||
"then": [
|
||||
{
|
||||
"say": "You always overextend",
|
||||
"best": true,
|
||||
"end": "Bonded (Right Green)"
|
||||
},
|
||||
{
|
||||
"say": "You lack flaws",
|
||||
"end": "Incinerated"
|
||||
},
|
||||
{
|
||||
"say": "You struggle with temper",
|
||||
"best": true,
|
||||
"end": "Bonded (Left Green)"
|
||||
},
|
||||
{
|
||||
"say": "You're always right",
|
||||
"best": true,
|
||||
"end": "An Orange saves you: Bonded (Orange)"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Step back",
|
||||
"end": "Incinerated"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Stay neutral",
|
||||
"end": "Incinerated"
|
||||
}
|
||||
]
|
||||
},
|
||||
"meadow-Orange": {
|
||||
"title": "The meadow Orange",
|
||||
"scene": "You approach the Orange dragon.",
|
||||
"options": [
|
||||
{
|
||||
"say": "Absolutely sure, Orange",
|
||||
"best": true,
|
||||
"pct": "90%",
|
||||
"then": [
|
||||
{
|
||||
"say": "Roar right back at it",
|
||||
"best": true,
|
||||
"pct": "69%",
|
||||
"then": [
|
||||
{
|
||||
"say": "Flee",
|
||||
"end": "Incinerated"
|
||||
},
|
||||
{
|
||||
"say": "Attempt to mount",
|
||||
"best": true,
|
||||
"end": "Bonded"
|
||||
},
|
||||
{
|
||||
"roll": "Possibly an unknown decision or chance mechanic (20%)"
|
||||
},
|
||||
{
|
||||
"say": "Hit the ground",
|
||||
"best": true,
|
||||
"then": [
|
||||
{
|
||||
"say": "Run to mount its foreleg",
|
||||
"best": true,
|
||||
"end": "Bonded"
|
||||
},
|
||||
{
|
||||
"say": "Look it in the eye",
|
||||
"then": [
|
||||
{
|
||||
"say": "Run to mount",
|
||||
"end": "Bonded"
|
||||
},
|
||||
{
|
||||
"say": "Maintain eye contact",
|
||||
"end": "Incinerated"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Run at the claw",
|
||||
"then": [
|
||||
{
|
||||
"say": "Hold tight for balance",
|
||||
"end": "Incinerated"
|
||||
},
|
||||
{
|
||||
"say": "Climb with strength",
|
||||
"end": "Bonded"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Run, this was a mistake",
|
||||
"end": "Incinerated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "On second thought…",
|
||||
"pct": "10%",
|
||||
"end": "Incinerated"
|
||||
}
|
||||
]
|
||||
},
|
||||
"meadow-Brown": {
|
||||
"title": "The meadow Brown",
|
||||
"scene": "You approach the Brown dragon.",
|
||||
"options": [
|
||||
{
|
||||
"say": "Run after the Brown",
|
||||
"best": true,
|
||||
"then": [
|
||||
{
|
||||
"say": "On second thought…",
|
||||
"end": "Incinerated"
|
||||
},
|
||||
{
|
||||
"say": "Your heart is sure",
|
||||
"best": true,
|
||||
"then": [
|
||||
{
|
||||
"say": "Shout at it to stop",
|
||||
"pct": "50%",
|
||||
"then": [
|
||||
{
|
||||
"say": "Apologise immediately",
|
||||
"pct": "50%",
|
||||
"end": "Incinerated"
|
||||
},
|
||||
{
|
||||
"say": "Await judgment, or pray",
|
||||
"pct": "90%",
|
||||
"then": [
|
||||
{
|
||||
"say": "Mud fight!",
|
||||
"then": [
|
||||
{
|
||||
"say": "Wipe off the mud",
|
||||
"pct": "90%",
|
||||
"then": [
|
||||
{
|
||||
"say": "The dragon speaks",
|
||||
"then": [
|
||||
{
|
||||
"say": "Defend the kingdom",
|
||||
"end": "Death 50/50"
|
||||
},
|
||||
{
|
||||
"say": "Defend the powerless",
|
||||
"end": "Bonded"
|
||||
},
|
||||
{
|
||||
"say": "Seek revenge",
|
||||
"end": "Incinerated"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Throw mud at the dragon",
|
||||
"pct": "60%",
|
||||
"end": "Bonded"
|
||||
},
|
||||
{
|
||||
"say": "Find a better dragon",
|
||||
"end": "Not recorded"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Indecisively chase it",
|
||||
"end": "Incinerated"
|
||||
},
|
||||
{
|
||||
"say": "Mount the Brown's tail",
|
||||
"best": true,
|
||||
"then": [
|
||||
{
|
||||
"say": "Throw your weight",
|
||||
"best": true,
|
||||
"then": [
|
||||
{
|
||||
"say": "You'll charm it",
|
||||
"best": true,
|
||||
"end": "Bonded"
|
||||
},
|
||||
{
|
||||
"say": "Hope for a clean death",
|
||||
"end": "Incinerated"
|
||||
},
|
||||
{
|
||||
"say": "It's already talking to you",
|
||||
"end": "Bonded"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Wait for a better angle",
|
||||
"end": "Incinerated"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Turn to the Orange",
|
||||
"end": "Incinerated"
|
||||
}
|
||||
]
|
||||
},
|
||||
"meadow-Blue": {
|
||||
"title": "The meadow Blue",
|
||||
"scene": "You approach the Blue dragon.",
|
||||
"options": [
|
||||
{
|
||||
"say": "Change to Orange",
|
||||
"pct": "?",
|
||||
"unconfirmed": true,
|
||||
"end": "Not tested"
|
||||
},
|
||||
{
|
||||
"say": "Change to Brown",
|
||||
"pct": "?",
|
||||
"unconfirmed": true,
|
||||
"end": "Not tested"
|
||||
},
|
||||
{
|
||||
"say": "Absolutely, Blue Dragon",
|
||||
"best": true,
|
||||
"pct": "90%",
|
||||
"then": [
|
||||
{
|
||||
"say": "Hold glare and advance",
|
||||
"best": true,
|
||||
"pct": "80%",
|
||||
"then": [
|
||||
{
|
||||
"say": "Do nothing",
|
||||
"best": true,
|
||||
"pct": "83%",
|
||||
"then": [
|
||||
{
|
||||
"say": "Lower your eyes",
|
||||
"pct": "?",
|
||||
"unconfirmed": true,
|
||||
"end": "Incinerated"
|
||||
},
|
||||
{
|
||||
"say": "Help the cadet",
|
||||
"pct": "0%",
|
||||
"end": "Incinerated"
|
||||
},
|
||||
{
|
||||
"say": "Hold glare and watch",
|
||||
"best": true,
|
||||
"pct": "80%",
|
||||
"then": [
|
||||
{
|
||||
"say": "Straighten your spine",
|
||||
"best": true,
|
||||
"pct": "82%",
|
||||
"then": [
|
||||
{
|
||||
"say": "Hold steady",
|
||||
"pct": "0%",
|
||||
"unconfirmed": true,
|
||||
"end": "Incinerated"
|
||||
},
|
||||
{
|
||||
"say": "Launch yourself right",
|
||||
"best": true,
|
||||
"pct": "85%",
|
||||
"then": [
|
||||
{
|
||||
"say": "You already know",
|
||||
"pct": "?",
|
||||
"unconfirmed": true,
|
||||
"end": "Not tested"
|
||||
},
|
||||
{
|
||||
"say": "Bring down an empire",
|
||||
"best": true,
|
||||
"pct": "80%",
|
||||
"then": [
|
||||
{
|
||||
"say": "Seize the chance to mount",
|
||||
"pct": "50%",
|
||||
"end": "Incinerated"
|
||||
},
|
||||
{
|
||||
"say": "Move slowly forward",
|
||||
"best": true,
|
||||
"pct": "80%",
|
||||
"end": "Bonded"
|
||||
},
|
||||
{
|
||||
"say": "Hold still",
|
||||
"pct": "50%",
|
||||
"end": "Incinerated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "I want revenge",
|
||||
"pct": "?",
|
||||
"unconfirmed": true,
|
||||
"end": "Not tested"
|
||||
},
|
||||
{
|
||||
"say": "Defend the helpless",
|
||||
"pct": "?",
|
||||
"unconfirmed": true,
|
||||
"end": "Not tested"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Speak first",
|
||||
"pct": "20%",
|
||||
"end": "Incinerated"
|
||||
},
|
||||
{
|
||||
"say": "Do nothing",
|
||||
"pct": "?",
|
||||
"end": "Incinerated"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Intervene and help",
|
||||
"pct": "?",
|
||||
"end": "Incinerated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Lower gaze, halt advance",
|
||||
"pct": "0%",
|
||||
"end": "Incinerated"
|
||||
},
|
||||
{
|
||||
"say": "Lower gaze, advance",
|
||||
"pct": "0%",
|
||||
"end": "Incinerated"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"shadow": {
|
||||
"title": "The shadow",
|
||||
"scene": "You've seen a shadow, where will it lead...",
|
||||
"options": [
|
||||
{
|
||||
"say": "A green sounds good",
|
||||
"unconfirmed": true,
|
||||
"end": "Not tested"
|
||||
},
|
||||
{
|
||||
"say": "Stay the course",
|
||||
"best": true,
|
||||
"then": [
|
||||
{
|
||||
"say": "Well this is intriguing",
|
||||
"best": true,
|
||||
"then": [
|
||||
{
|
||||
"say": "Curiosity sated, retreat",
|
||||
"then": [
|
||||
{
|
||||
"say": "Find that Green",
|
||||
"end": "On to the two Greens"
|
||||
},
|
||||
{
|
||||
"say": "Go towards the valley",
|
||||
"unconfirmed": true,
|
||||
"end": "Not tested"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Freeze and lower your eyes",
|
||||
"best": true,
|
||||
"then": [
|
||||
{
|
||||
"say": "Warn the cadet",
|
||||
"end": "Incinerated"
|
||||
},
|
||||
{
|
||||
"say": "Hold still",
|
||||
"best": true,
|
||||
"then": [
|
||||
{
|
||||
"say": "Aid the cadet",
|
||||
"unconfirmed": true,
|
||||
"end": "Not tested"
|
||||
},
|
||||
{
|
||||
"say": "Hold position",
|
||||
"best": true,
|
||||
"then": [
|
||||
{
|
||||
"say": "Approach the Blue",
|
||||
"then": [
|
||||
{
|
||||
"say": "On second thought…",
|
||||
"unconfirmed": true,
|
||||
"end": "Not tested"
|
||||
},
|
||||
{
|
||||
"say": "You're sure",
|
||||
"unconfirmed": true,
|
||||
"end": "Incinerated?"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Await judgement",
|
||||
"best": true,
|
||||
"then": [
|
||||
{
|
||||
"say": "Help the cadet",
|
||||
"best": true,
|
||||
"then": [
|
||||
{
|
||||
"say": "Use your dagger",
|
||||
"best": true,
|
||||
"then": [
|
||||
{
|
||||
"say": "Head south and hope",
|
||||
"best": true,
|
||||
"end": "On to the Black"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Take them to cold water",
|
||||
"end": "Head back for the Greens, or explore other dragons"
|
||||
},
|
||||
{
|
||||
"say": "Clean their uniform",
|
||||
"end": "Head back for the Greens, or explore other dragons"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Leave to find your dragon",
|
||||
"end": "Head back for the Greens, or explore other dragons"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Run towards the other cadet",
|
||||
"unconfirmed": true,
|
||||
"end": "Not tested"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Last chance to escape",
|
||||
"end": "Head back for the Greens, or explore other dragons"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Leave while it's distracted",
|
||||
"end": "Head back for the Greens, or explore other dragons"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"say": "Too big, you're out",
|
||||
"end": "Head back for the Greens, or explore other dragons"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"black": {
|
||||
"title": "The Black",
|
||||
"scene": "A branch snaps behind you...",
|
||||
"note": "Lowering your eyes has frequently ended in incineration; what follows it is unconfirmed.",
|
||||
"options": [
|
||||
{
|
||||
"say": "Ignore it, keep walking",
|
||||
"end": "Incinerated"
|
||||
},
|
||||
{
|
||||
"say": "Turn to face the threat",
|
||||
"best": true,
|
||||
"then": [
|
||||
{
|
||||
"say": "Lower your eyes",
|
||||
"end": "Incinerated"
|
||||
},
|
||||
{
|
||||
"say": "Hold its gaze",
|
||||
"best": true,
|
||||
"end": "Bonded"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"route_encounters": {
|
||||
"valley-Red": [
|
||||
"valley-Red"
|
||||
],
|
||||
"tree-Red": [
|
||||
"tree-Red"
|
||||
],
|
||||
"tree-Greens": [
|
||||
"tree-Greens"
|
||||
],
|
||||
"meadow-Orange": [
|
||||
"meadow-Orange"
|
||||
],
|
||||
"meadow-Brown": [
|
||||
"meadow-Brown"
|
||||
],
|
||||
"meadow-Blue": [
|
||||
"meadow-Blue"
|
||||
],
|
||||
"shadow-Blue": [
|
||||
"shadow"
|
||||
],
|
||||
"shadow-Black": [
|
||||
"shadow",
|
||||
"black"
|
||||
]
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -3,34 +3,34 @@
|
||||
"by_attempt": {
|
||||
"form": {
|
||||
"1": [
|
||||
97,
|
||||
973
|
||||
90,
|
||||
892
|
||||
],
|
||||
"2": [
|
||||
0,
|
||||
301
|
||||
290
|
||||
],
|
||||
"3": [
|
||||
0,
|
||||
198
|
||||
187
|
||||
],
|
||||
"4-10": [
|
||||
0,
|
||||
574
|
||||
510
|
||||
],
|
||||
"11-30": [
|
||||
0,
|
||||
706
|
||||
574
|
||||
],
|
||||
"31 or more": [
|
||||
1,
|
||||
847
|
||||
621
|
||||
]
|
||||
},
|
||||
"bulk logs": {
|
||||
"1": [
|
||||
0,
|
||||
29
|
||||
28
|
||||
],
|
||||
"2": [
|
||||
0,
|
||||
@@ -46,11 +46,11 @@
|
||||
],
|
||||
"11-30": [
|
||||
0,
|
||||
58
|
||||
57
|
||||
],
|
||||
"31 or more": [
|
||||
0,
|
||||
57
|
||||
0
|
||||
]
|
||||
},
|
||||
"bot": {
|
||||
@@ -76,55 +76,24 @@
|
||||
],
|
||||
"31 or more": [
|
||||
0,
|
||||
333
|
||||
]
|
||||
},
|
||||
"Reddit comments": {
|
||||
"1": [
|
||||
1,
|
||||
1
|
||||
],
|
||||
"2": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"3": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"4-10": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"11-30": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"31 or more": [
|
||||
0,
|
||||
0
|
||||
54
|
||||
]
|
||||
}
|
||||
},
|
||||
"reddit_shadows": {
|
||||
"all": 17,
|
||||
"gated": 3,
|
||||
"first_attempt": 3
|
||||
},
|
||||
"same_route": {
|
||||
"routes": 334,
|
||||
"first_shadows": 93,
|
||||
"expected": 38.0,
|
||||
"odds_ratio": 111.1,
|
||||
"z": 12.7
|
||||
"routes": 325,
|
||||
"first_shadows": 86,
|
||||
"expected": 36.5,
|
||||
"odds_ratio": 637.7,
|
||||
"z": 12.0
|
||||
},
|
||||
"form_first": [
|
||||
97,
|
||||
973
|
||||
90,
|
||||
892
|
||||
],
|
||||
"form_later": [
|
||||
1,
|
||||
2626
|
||||
2182
|
||||
],
|
||||
"best_route": {
|
||||
"route": [
|
||||
@@ -136,28 +105,27 @@
|
||||
"West"
|
||||
],
|
||||
"first": [
|
||||
23,
|
||||
114
|
||||
22,
|
||||
92
|
||||
],
|
||||
"later": [
|
||||
0,
|
||||
113
|
||||
90
|
||||
]
|
||||
},
|
||||
"shadow_routes": {
|
||||
"runs": 99,
|
||||
"routes": 48,
|
||||
"off_gate": 3,
|
||||
"gates_unstated": 14
|
||||
"runs": 94,
|
||||
"routes": 45,
|
||||
"off_gate": 3
|
||||
},
|
||||
"after_shadow": {
|
||||
"reached_black": 91,
|
||||
"bonded_black": 67,
|
||||
"died_at_blue": 19,
|
||||
"reached_black": 77,
|
||||
"bonded_black": 55,
|
||||
"died_at_blue": 15,
|
||||
"answers": {
|
||||
"held its gaze": [
|
||||
29,
|
||||
41
|
||||
30,
|
||||
42
|
||||
],
|
||||
"lowered eyes": [
|
||||
0,
|
||||
@@ -170,9 +138,9 @@
|
||||
}
|
||||
},
|
||||
"bot": {
|
||||
"attempts": 878,
|
||||
"accounts": 27,
|
||||
"gated_tree": 515,
|
||||
"attempts": 415,
|
||||
"accounts": 14,
|
||||
"gated_tree": 236,
|
||||
"shadows": 0,
|
||||
"earliest_attempt": 2
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"repo": "https://git.kenschiano.net/kathleen/threshing-atlas",
|
||||
"repo_label": "git.kenschiano.net/kathleen/threshing-atlas",
|
||||
"host": "git.kenschiano.net",
|
||||
"kind": "gitea",
|
||||
"visibility": "limited",
|
||||
"report": "https://git.kenschiano.net/kathleen/threshing-atlas/issues/new?template=.github/ISSUE_TEMPLATE/report-a-run.yml",
|
||||
"form": "https://forms.gle/DRpj9tG8gb5E4Hcu7",
|
||||
"sheet": "https://docs.google.com/spreadsheets/d/1gnw1AdRg1XT4JsOfRM6QTA0jSaS3n9ZF-rPWnYewzv0"
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
{"source":"Runs reported on the Atlas (\"Report a run\", a GitHub issue form)","reports":[]}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
-11303
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -1,97 +0,0 @@
|
||||
/*
|
||||
* Rolls of the dice. Wherever the page shows a step the game decides at random (not the rider's choice), a pair of
|
||||
* dice sits next to it. Clicking the dice shows the odds of every outcome of that roll.
|
||||
*
|
||||
* Dice.html(roll) an inline button for HTML text
|
||||
* Dice.svg(parent, x, y, roll) the same glyph inside an SVG map
|
||||
* Dice.legend(text?) the legend line ("a roll: the game decides ...")
|
||||
*
|
||||
* roll = { title, options: [[label, p], ...], note?, n? } (p between 0 and 1; options may be empty with a note)
|
||||
*/
|
||||
(function () {
|
||||
"use strict";
|
||||
const NS = "http://www.w3.org/2000/svg";
|
||||
// two dice, the back one showing two, the front one five
|
||||
const GLYPH = `<svg class="dice-glyph" viewBox="0 0 22 16" width="22" height="16" aria-hidden="true">
|
||||
<rect x="1" y="1.5" width="10" height="10" rx="2.2" transform="rotate(-12 6 6.5)" fill="var(--raised)" stroke="currentColor" stroke-width="1.2"/>
|
||||
<circle cx="4" cy="4.8" r="1.05" fill="currentColor" transform="rotate(-12 6 6.5)"/><circle cx="8" cy="8.6" r="1.05" fill="currentColor" transform="rotate(-12 6 6.5)"/>
|
||||
<rect x="9.5" y="4.5" width="10.5" height="10.5" rx="2.2" fill="var(--raised)" stroke="currentColor" stroke-width="1.2"/>
|
||||
<circle cx="12.4" cy="7.4" r="1.05" fill="currentColor"/><circle cx="17.1" cy="7.4" r="1.05" fill="currentColor"/>
|
||||
<circle cx="14.75" cy="9.75" r="1.05" fill="currentColor"/>
|
||||
<circle cx="12.4" cy="12.1" r="1.05" fill="currentColor"/><circle cx="17.1" cy="12.1" r="1.05" fill="currentColor"/></svg>`;
|
||||
const TIP = "A roll: the game decides, not you. Click for the odds of each outcome.";
|
||||
|
||||
const esc = (s) => String(s).replace(/[&<>"]/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """ }[c]));
|
||||
const pack = (roll) => encodeURIComponent(JSON.stringify(roll || {}));
|
||||
const pct = (p) => (p == null ? "–" : p < 0.001 && p > 0 ? "<0.1%" : `${(100 * p).toFixed(p < 0.1 ? 1 : 0)}%`);
|
||||
|
||||
function html(roll) {
|
||||
return `<button type="button" class="dice" data-roll="${pack(roll)}" title="${TIP}" aria-label="${esc((roll && roll.title) || "A roll")}: show the odds">${GLYPH}</button>`;
|
||||
}
|
||||
|
||||
function svg(parent, x, y, roll) {
|
||||
const g = document.createElementNS(NS, "g");
|
||||
g.setAttribute("class", "dice dice-svg");
|
||||
g.setAttribute("data-roll", pack(roll));
|
||||
g.setAttribute("transform", `translate(${x - 11},${y - 8})`);
|
||||
g.setAttribute("tabindex", "0");
|
||||
g.setAttribute("role", "button");
|
||||
g.setAttribute("aria-label", `${(roll && roll.title) || "A roll"}: show the odds`);
|
||||
const t = document.createElementNS(NS, "title");
|
||||
t.textContent = TIP;
|
||||
g.appendChild(t);
|
||||
const halo = document.createElementNS(NS, "rect");
|
||||
for (const [k, v] of Object.entries({ x: -3, y: -3, width: 28, height: 22, rx: 6, fill: "var(--map-halo, var(--bg))", "fill-opacity": 0.9 })) halo.setAttribute(k, v);
|
||||
g.appendChild(halo);
|
||||
g.insertAdjacentHTML("beforeend", GLYPH.replace(/^<svg[^>]*>/, "").replace(/<\/svg>$/, ""));
|
||||
parent.appendChild(g);
|
||||
return g;
|
||||
}
|
||||
|
||||
function legend(text) {
|
||||
return `<span class="dice-legend">${GLYPH.replace('class="dice-glyph"', 'class="dice-glyph legend" style="display:inline-block;vertical-align:-3px"')} ${text || "= a roll: the game decides at random, not your choice. Click any dice for the odds of each outcome."}</span>`;
|
||||
}
|
||||
|
||||
// ---- the popover
|
||||
let pop = null;
|
||||
function hide() { if (pop) pop.hidden = true; }
|
||||
function show(roll, x, y) {
|
||||
if (!pop) {
|
||||
pop = document.createElement("div");
|
||||
pop.id = "dice-pop";
|
||||
pop.setAttribute("role", "dialog");
|
||||
document.body.appendChild(pop);
|
||||
}
|
||||
const opts = (roll.options || []).filter(([, p]) => p != null).sort((a, b) => b[1] - a[1]);
|
||||
pop.innerHTML = `<b>${esc(roll.title || "A roll")}</b>
|
||||
${opts.length ? `<ul>${opts.map(([k, p]) => `<li><span>${esc(k)}</span><span class="bar"><i style="width:${Math.max(1, 100 * p).toFixed(1)}%"></i></span><span class="p">${pct(p)}</span></li>`).join("")}</ul>` : ""}
|
||||
<p>${esc(roll.note || "The game decides this at random. Your earlier choices can change the odds, but not the outcome.")}${roll.n ? ` From ${Number(roll.n).toLocaleString()} runs.` : ""}</p>`;
|
||||
pop.hidden = false;
|
||||
const r = pop.getBoundingClientRect();
|
||||
pop.style.left = `${Math.max(8, Math.min(window.innerWidth - r.width - 8, x - r.width / 2))}px`;
|
||||
pop.style.top = `${y + 14 + r.height > window.innerHeight ? Math.max(8, y - r.height - 14) : y + 14}px`;
|
||||
}
|
||||
|
||||
function open(e, t) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
let roll = {};
|
||||
try { roll = JSON.parse(decodeURIComponent(t.getAttribute("data-roll"))); } catch { /* an empty roll */ }
|
||||
const b = t.getBoundingClientRect();
|
||||
show(roll, b.left + b.width / 2, b.bottom - 6);
|
||||
}
|
||||
// capture phase: a dice inside a map or a card must not also select what is under it
|
||||
document.addEventListener("click", (e) => {
|
||||
const t = e.target.closest && e.target.closest("[data-roll]");
|
||||
if (t) return open(e, t);
|
||||
if (pop && !pop.hidden && !pop.contains(e.target)) hide();
|
||||
}, true);
|
||||
document.addEventListener("keydown", (e) => {
|
||||
if (e.key === "Escape") return hide();
|
||||
const t = (e.key === "Enter" || e.key === " ") && e.target.closest && e.target.closest(".dice-svg[data-roll]");
|
||||
if (t) open(e, t);
|
||||
}, true);
|
||||
window.addEventListener("scroll", hide, { passive: true });
|
||||
|
||||
window.Dice = { html, svg, legend };
|
||||
})();
|
||||
@@ -0,0 +1,99 @@
|
||||
# For Ken: what the bot needs for the automated cycle
|
||||
|
||||
The Atlas side is done (branch `first-attempt-cycle`). This is the bot's side. Details and code are in
|
||||
`docs/BOT_INTEGRATION.md`, "The automated cycle". Nothing here was changed in the bot's repository.
|
||||
|
||||
## Why
|
||||
|
||||
Two things changed the plan (16 November).
|
||||
|
||||
**The developer says the Black is not dice** (`planner/knowledge.yaml`). The seed plays no part in whether it shows:
|
||||
it shows when the rider's choices meet its conditions, and a rider who knows them bonds with certainty. There is no
|
||||
single route; the bullies encounter and the tree are gates; there are a handful of conditions, not dozens.
|
||||
|
||||
**The runs say it is close to a first-attempt event** (`analysis/reports/BLACK.md`). On one and the same recorded
|
||||
route, riders report the shadow on 21 of 79 first attempts and 1 of 80 later ones. The bot has 236 tree runs and no
|
||||
shadow, all on attempt 2 or later; it has never logged a first attempt.
|
||||
|
||||
So the bot stops estimating a rate and starts looking for the rule: one exact path on every fresh account, then
|
||||
one choice changed at a time. If the answer is not dice, a few accounts per question are enough.
|
||||
|
||||
## The five changes
|
||||
|
||||
1. **Play attempt 1 with the bot and log it** (`accountAttempt: 1`). Today the records start at attempt 2.
|
||||
2. **Give every account a number** in the order the accounts are made (`accountSeq`: 0, 1, 2, ...), fixed for
|
||||
its life. The plan uses it to balance the arms across accounts.
|
||||
3. **At the start of every attempt**, load the kit from `vendor/threshing-atlas/` (when `atlas-kit.json` changed),
|
||||
then:
|
||||
|
||||
```js
|
||||
const a = Solver.assign(plan, { accountSeq, attempt, facts: { sawShadowBefore } }); // what this attempt is for
|
||||
const adv = Solver.advisor(policy.samples.all, a.target, a.objective,
|
||||
{ attempt, fix: a.fix, sampling: a.sampling, seed: a.seed });
|
||||
```
|
||||
|
||||
and log `experimentId`, `arm`, `planId`, `policyId`, `accountAttempt` and the propensity on the run. Never
|
||||
reload the kit in the middle of an attempt.
|
||||
4. **The account's life** (`plan.lifecycle`): attempt 1 is the Black attempt; then three days of research
|
||||
attempts; then retire the account, except when `accountSeq % 10` is 0 or 1 (those keep running).
|
||||
5. **Run the cycle on a timer** on the bot's machine, from a clone of the Atlas:
|
||||
|
||||
```
|
||||
# every hour; does nothing but deliver when there are no new runs
|
||||
17 * * * * cd ~/threshing-atlas && git pull -q && DK_ACCOUNT_SALT=... python -m collection cycle \
|
||||
--bot ~/DragonKind --deliver ~/DragonKind/vendor/threshing-atlas >> ~/atlas-cycle.log 2>&1
|
||||
```
|
||||
|
||||
or as the Gitea workflow `.gitea/workflows/bot-cycle.yml` on a runner on that machine, which also opens the
|
||||
pull request with the new public data. Use Kathleen's salt (sent privately), so the accounts keep the hashes
|
||||
they already have in the data.
|
||||
|
||||
## What the plan asks for now (`planner/experiments.yaml`)
|
||||
|
||||
| Attempts | Experiment | What the bot does |
|
||||
|---|---|---|
|
||||
| 1 | `fresh-replicate` (60 accounts) | One exact path: alone, west, hold still, investigate, help, pause to assess, engage the smaller cadet, squadmate's revenge, fork west, tree. Burn when there is no shadow. |
|
||||
| 1, afterwards | `fresh-ablate` (12 arms, 15 accounts each) | The same path with one choice changed. Starts by itself when the replication is complete. |
|
||||
| 2 to 4, accounts that saw the shadow and died | `shadow-again` | The same path again. |
|
||||
| 2, half of the other accounts | `second-attempt-same-path` | The same path again. |
|
||||
| 3 onward, one account in ten | `veteran-repeat` | The same path on every attempt, indefinitely. |
|
||||
| 3 onward, one account in ten | `veteran-variety` | A different combination of company, direction, fight, fate and fork on every attempt, both gates kept. |
|
||||
| 2 onward, the rest | `meadow-blue-route` 50%, `mapping` 35%, `sentinel` 15% | As before. |
|
||||
|
||||
`assign()` now takes the account's facts: `Solver.assign(plan, { accountSeq, attempt, facts: { sawShadowBefore } })`.
|
||||
|
||||
## When the shadow shows
|
||||
|
||||
The bot has never seen these screens, so `experiments.json` carries the sequence riders report for a bonded Black
|
||||
(`plan.scripts.shadow`): for each screen in order, a pattern for the option to take and one for options never to
|
||||
take. In riders' notes, approaching the Blue or warning the other cadet has always been fatal, lowering your eyes to
|
||||
the Black has never bonded (0 of 7), and holding its gaze bonded 27 of 39. Where a screen matches nothing in the
|
||||
script, stop and notify a person: do not guess. Log every screen, its options and the pick; the 12 failures while
|
||||
holding its gaze are unexplained, and the screens before it are where the explanation should be.
|
||||
|
||||
## What to record about the account
|
||||
|
||||
`plan.record` lists it: `accountSeq`, `accountAttempt`, `accountCreatedAt`, the cadet's `wing`, `section` and
|
||||
`squad` as the site shows them, and `sawShadowBefore`. If identical paths on fresh accounts disagree about the shadow,
|
||||
the difference is something the site knows about the account, and these are the candidates we can see.
|
||||
|
||||
The plan updates itself from the runs: a finished experiment stops being assigned and its share goes to the others.
|
||||
|
||||
## The screen tree, and two things found in the logs (16 November)
|
||||
|
||||
`tree.json` is now in the kit: every screen the bot has stood on, every option on it, how often each was played and
|
||||
where it led (`analysis/reports/TREE.md` is the readable version). 47 of the 116 options seen have never been played.
|
||||
|
||||
- **Picking from the tree.** `Solver.screenPick(tree, sceneId, offeredTexts, { mode, seed })` returns the option to
|
||||
pick. `plan.screenPicks` says when: `least-tried` in the mapping experiment (fills the gaps first), `thompson`
|
||||
while bonding the target dragon (tries untested answers, drops the ones that kill). The four deadly screens of the
|
||||
Blue encounter have only ever been answered one way each, so their other answers are unknown.
|
||||
- **Overridden picks are in the logs as if they were played.** In 37 runs the bot logged the atlas's pick with
|
||||
`to: "BURNED"` and then, on the same screen, the pick its own rule made (91 steps: first direction 37, the fork 33,
|
||||
the dagger 11, the first dragon 9). The atlas now drops such steps, in the importer and in `graph.js`
|
||||
(`playedSteps`), so the runs are coded with the choices that were made. Two things for the bot: log an overridden
|
||||
recommendation as something other than a step, and note that in those runs the atlas's direction and fork advice
|
||||
never took effect (`ENTER_TOWARDS_FOREST_CENTER` and `ROAD_FORK_DEEPER_FOREST` won). The experiments need the
|
||||
plan's picks to win over those rules.
|
||||
- **The best-reported route has already been played 64 times on later attempts** (alone, west, engage the smaller
|
||||
cadet, squadmate's revenge, fork west) with no shadow, which matches riders' 1 in 80.
|
||||
@@ -0,0 +1,152 @@
|
||||
# Bot data protocol
|
||||
|
||||
How the DragonKind bot should run and log its threshing attempts so that the Threshing Atlas can
|
||||
estimate route probabilities, including history effects, and find the best route to each dragon colour.
|
||||
|
||||
Goal: bond a Blue and bond a Black, and know the best route for every colour.
|
||||
|
||||
## 1. Why the bot matters
|
||||
|
||||
Community data are observational. People copy routes from guides, so most choices are correlated
|
||||
with each other and with what people chose to report. That correlation is copied behaviour, not game
|
||||
mechanics. Only the bot can choose at random, and random assignment is what tells us that an earlier
|
||||
choice *causes* a later dragon to appear. The bot is the experiment. The community data are the prior.
|
||||
|
||||
Two facts shape everything below:
|
||||
|
||||
- **An attempt is the scarce resource.** Each one costs a cooldown, and a bond is permanent for that
|
||||
account. A run must never risk bonding the wrong colour.
|
||||
- **Seeing a dragon is usually not the same as bonding it.** If the colour is visible before the step
|
||||
where the player commits, the bot can record what appeared and then burn deliberately. Spawn rates
|
||||
for every colour can then be learned without using up an account. Only the final "does this choice
|
||||
actually bond?" step needs real bonds, and that step is close to deterministic.
|
||||
|
||||
## 2. What to log
|
||||
|
||||
`src/runhistory.js` already records one structured record per attempt. That is the right shape. These
|
||||
additions turn it into data the solver can use. The most important ones come first.
|
||||
|
||||
| # | Field | Why |
|
||||
|---|-------|-----|
|
||||
| 1 | `steps[].offered`: every option on screen, as `[{text, norm, hash}]`, plus the index that was picked | Shows "every option at every point", and detects options that only appear after certain earlier choices (that is itself history dependence) |
|
||||
| 2 | `steps[].observed`: what the scene showed, e.g. `{dragons: ["red"], shadow: false, cadetWounded: true}` | Chance outcomes are the core data. Today a burned run has `dragonColor: null`, and the tree check does not say whether the shadow was there |
|
||||
| 3 | `steps[].propensity`: the probability with which the bot picked this option (1.0 for a fixed rule, 0.5 for a coin flip) | Lets runs from different policies be pooled without bias (inverse-propensity weighting) |
|
||||
| 4 | `policyId` / `experimentId` / `arm` per run, plus `botCommit` (git short hash) | Says which policy or experiment produced the run. The learner changes over time, so this is not optional |
|
||||
| 5 | `burn: {reason, stage, nodeId}` for intentional burns | A deliberate burn cuts the run short on purpose (censoring). The model must know where and why |
|
||||
| 6 | `accountKey`: a salted hash of the account id, plus `accountAttempt` (that account's attempt number) | Separates account effects from route effects. Never log the account name or email |
|
||||
| 7 | `startedAt` in UTC, plus the in-game hour if the scene shows one | Time-of-day and patch effects |
|
||||
| 8 | `manual: true` on any step a human picked, and `decisionMode` on every step (not only the run) | `ai_pilot` and manual picks have no known propensity, so they are analysed separately |
|
||||
| 9 | `ABORTED` runs kept, with `abortReason` | Dropping failures biases rates |
|
||||
| 10 | `sceneFp` (the existing sha1 node id) and a short `label` | The public data carry fingerprints and labels only, never the game's prose |
|
||||
|
||||
A step would then look like this:
|
||||
|
||||
```json
|
||||
{
|
||||
"nodeId": "bc4ee4754b9c", "stage": "FIRST_SIGHTING", "label": "first sighting, forest centre",
|
||||
"observed": { "dragons": ["brown"] },
|
||||
"offered": [
|
||||
{ "norm": "lower your eyes in respect", "hash": "9a1c…" },
|
||||
{ "norm": "meet its gaze", "hash": "41fe…" }
|
||||
],
|
||||
"picked": 0, "propensity": 0.5, "decisionMode": "explore", "rule": "EXP-03:arm-A",
|
||||
"outcome": "SCENE", "toKey": "84780dab01e3", "at": "2026-11-01T21:03:11Z"
|
||||
}
|
||||
```
|
||||
|
||||
Parsing `observed` from the prose can start as simple keyword rules (colour words, "shadow", "wounded")
|
||||
kept in one table. The atlas will flag scenes where the rules return nothing.
|
||||
|
||||
## 3. How to run the accounts
|
||||
|
||||
### Two kinds of account
|
||||
|
||||
- **Goal accounts** (the ones meant to bond Blue or Black) run the current best policy for their target
|
||||
colour from `policy.json`, with the existing Account Lock Guard and intentional-burn protection.
|
||||
They still log everything. Their runs are data too, with propensity 1.0.
|
||||
- **Research accounts** run experiments. They also never accept a non-target bond. They observe and
|
||||
then burn. If one reaches a genuine Blue or Black bonding choice, that is a real result: let it bond
|
||||
and log it.
|
||||
|
||||
### Freeze the policy during an experiment
|
||||
|
||||
`auto_learn` rewrites its own rules from its own results. While an experiment is running, that mixes up
|
||||
the effect of the experiment with the bot's learning, and makes the data non-stationary. For research
|
||||
runs, use `explore` with a fixed experiment file, and record `policyId`. Update the policy between
|
||||
batches, not during them.
|
||||
|
||||
### Randomize one decision point against a fixed baseline
|
||||
|
||||
- The **baseline** is the community guide route (the PDF route) for the target colour.
|
||||
- In an experiment, exactly one decision point (or two, in a 2×2 design) is chosen by a coin flip with
|
||||
a known probability. Everything else follows the baseline.
|
||||
- Assign arms in **balanced blocks per account** (for example A, B, B, A, …), so every account
|
||||
contributes equally to both arms.
|
||||
- Use **pre-set run counts**. Do not stop because the results look good: stopping early on a good run
|
||||
inflates the effect.
|
||||
- Do not use `ai_pilot` for research runs. If it is used, the runs are tagged and kept out of the
|
||||
causal estimates.
|
||||
|
||||
### Phases
|
||||
|
||||
1. **Mapping (first week or two).** At every decision point, try each option a few times (about 5 to 10)
|
||||
so that every branch has at least been seen. This finds hidden options, dead ends and death scenes.
|
||||
It uses few runs, because the bot can burn as soon as a branch has been recorded.
|
||||
2. **Spawn rates (ongoing, nearly free).** Every run records which dragon appeared at the first
|
||||
sighting, the meadow and the valley, and whether the shadow was at the tree. This builds the
|
||||
colour-by-location table for all six colours as a by-product.
|
||||
3. **Targeted experiments.** The atlas produces an experiment list (`experiments.json`), ranked by how
|
||||
much each result could change the best route for each colour. That ranking is a value-of-information
|
||||
calculation. The bot runs the top items.
|
||||
|
||||
### Blue and Black need different strategies
|
||||
|
||||
**Blue (meadow, roughly 10% of meadow visits).** The question is whether anything earlier changes the
|
||||
Blue rate at the meadow: company, direction, how you met the first dragon, what happened with the
|
||||
cadets. Each research run goes to the meadow, records the colour, and burns unless it is Blue. Telling a
|
||||
10% rate from a 20% rate needs about **200 runs per arm**. That is achievable across a few accounts over
|
||||
a few weeks.
|
||||
|
||||
**Black (tree shadow, roughly 1%).** Too rare for full factorial experiments. Instead:
|
||||
|
||||
- Take the **shortest route to the tree check**, and burn immediately when there is no shadow. This is
|
||||
what the bot already does, and it maximizes tree visits per day.
|
||||
- At the same time, randomize **one** earlier factor 50/50 on every run, so each tree visit also counts
|
||||
towards a test. Run that one test until it reaches its planned count, then move on to the next factor.
|
||||
- Log the tree scene's fingerprint and options carefully even when there is no shadow. A change in the
|
||||
prose or options may be an early sign.
|
||||
- Telling 1% from 2% needs thousands of runs per arm. This is where pooling with community logs, and
|
||||
later Discord, will matter most.
|
||||
|
||||
### Other colours
|
||||
|
||||
Red, Brown, Orange and Green come mostly from the spawn-rate logging in phase 2. Green also needs the
|
||||
rescue branch (the wounded cadet) to be tried in both directions in phase 1.
|
||||
|
||||
## 4. Getting data to the atlas
|
||||
|
||||
- The atlas repo already has the exporter: `DRAGONKIND_BOT_DIR=/path/to/DragonKind python -m collection update --source bot`. It reads
|
||||
`data/knowledge.json`, `data/runs.jsonl` and `logs/encounters.jsonl` from the bot folder and writes
|
||||
`data/bot/scenes.json` and `data/bot/trajectories-<date>.jsonl`, with:
|
||||
- prose removed (scene fingerprints, short labels, choice text and outcomes only). The importer
|
||||
refuses to write any field or string that looks like prose,
|
||||
- account ids replaced by salted hashes. Set `DK_ACCOUNT_SALT` in your environment; never commit it,
|
||||
- nothing read from `.browser-profile*/`, `data/accounts.json`, `data/integrations.json` or
|
||||
`data/state.json`.
|
||||
- Its scene fingerprints are computed exactly as the bot's `computeSceneFingerprint()` does, so they
|
||||
match the bot's node ids. If the bot's `normalize()` or fingerprint changes, the importer must change too.
|
||||
- Commit the result to `threshing-atlas` by pull request. CI rebuilds the graph and runs the tests.
|
||||
- In return, the atlas publishes `policy.json` (the best decision tree per colour, under both goals)
|
||||
and `experiments.json`. The bot reads them as a strategy source. The bot's own guards still have the
|
||||
final say.
|
||||
|
||||
## 5. Checklist for Ken
|
||||
|
||||
- [ ] Add `offered`, `picked`, `observed`, `propensity` and per-step `decisionMode` to `noteChoice()`.
|
||||
- [ ] Add `policyId`, `experimentId`, `arm`, `botCommit`, `accountKey` and `accountAttempt` to `beginRun()`.
|
||||
- [ ] Add `burn.reason` and `abortReason` to `endRun()`.
|
||||
- [ ] Write the keyword table that fills `observed` (dragon colours, shadow, wounded cadet).
|
||||
- [ ] Add an `explore` mode that reads an experiment file, assigns arms in balanced blocks per account, and freezes learning.
|
||||
- [ ] Add the export script, with the account salt in `.env`.
|
||||
- [ ] Split the accounts into goal accounts and research accounts.
|
||||
- [ ] Run phase 1 (mapping). Then keep phase 2 logging on for every run, goal accounts included.
|
||||
@@ -0,0 +1,268 @@
|
||||
# Connecting the DragonKind bot to the atlas
|
||||
|
||||
Data flows both ways:
|
||||
|
||||
```
|
||||
community sources, reports ─────┐
|
||||
├─► threshing-atlas ──► policy.json + solver.js ──► bot (advice per screen)
|
||||
bot runs (anonymised) ──────────┘ ▲ │
|
||||
└──────────── collection --source bot + PR ◄┘
|
||||
```
|
||||
|
||||
## The automated cycle
|
||||
|
||||
One command closes the loop, and it is meant to run on a timer on the machine that has the bot's folder:
|
||||
|
||||
```
|
||||
python -m collection cycle --bot /path/to/DragonKind --deliver /path/to/DragonKind/vendor/threshing-atlas
|
||||
```
|
||||
|
||||
1. **Ingest.** It imports the bot's new runs (anonymised: no prose, no account names; set `DK_ACCOUNT_SALT`, the
|
||||
same value every time, so an account keeps its hash).
|
||||
2. **Refit.** When there are new runs it rebuilds the coded runs, the route model (`policy.json`) and
|
||||
3. **Re-plan:** the experiment plan (`experiments.json`): progress per arm, and which experiments are still
|
||||
running (`planner/experiments.yaml` is the design).
|
||||
4. **Deliver.** It copies `policy.json`, `experiments.json`, `tree.json`, `solver.js` and `graph.js` into the `--deliver` folder,
|
||||
each file whole, then writes `atlas-kit.json` (`policyId`, `planId`, checksums) last. The bot should load the
|
||||
kit at the start of an attempt, never in the middle of one, and log both ids on the run.
|
||||
|
||||
With no new runs it only delivers, so running it every hour costs nothing. `exports/last-cycle.md` says what
|
||||
changed (ids, headline odds, experiment progress). `--community` also checks the community sources first.
|
||||
On Gitea, `.gitea/workflows/bot-cycle.yml` runs the same command on a runner that can see the bot's folder and
|
||||
opens the pull request with the new data.
|
||||
|
||||
### What each attempt is for: the plan
|
||||
|
||||
```js
|
||||
const plan = require('../vendor/threshing-atlas/experiments.json');
|
||||
// accountSeq: the account's number in the order accounts were made (0, 1, 2, ...), fixed for its life
|
||||
// attempt: the account's attempt number (1 = its first threshing)
|
||||
const a = Solver.assign(plan, { accountSeq, attempt, facts: { sawShadowBefore } });
|
||||
// -> { experimentId, arm, fix, target, objective, sampling, seed, propensity, burn, planId } (null: no experiment)
|
||||
const advisor = Solver.advisor(policy.samples.all, a.target, a.objective,
|
||||
{ attempt, fix: a.fix, sampling: a.sampling, seed: a.seed });
|
||||
```
|
||||
|
||||
- **`attempt` matters.** The shadow is close to a first-attempt event, so `advisor(..., { attempt: 1 })` uses the
|
||||
first attempt's odds. Without `attempt` a later attempt is assumed. **Attempt 1 must be played by the bot and
|
||||
logged** (today the bot's records start at attempt 2).
|
||||
- **`fix`** holds some decisions to the arm's options; the advisor plays its best around them.
|
||||
- **`sampling: "uniform"`** (the mapping experiment): `recommendOption()` picks one of the options on the screen
|
||||
at random and returns its propensity.
|
||||
- Log on the run: `experimentId`, `arm`, `planId: plan.id`, `policyId: policy.id`, `accountAttempt`, and the
|
||||
propensity. On the steps an arm fixes, the propensity is `a.propensity`.
|
||||
- `burn` names the deliberate-burn rule the experiment expects (`TREE_NO_SHADOW_AUTO_BURN`,
|
||||
`MEADOW_NO_BLUE_AUTO_BURN`). A genuine Black or Blue bond is always accepted.
|
||||
- The account's life (`plan.lifecycle`): attempt 1 is the Black attempt; then about three days of research
|
||||
attempts; then the account retires, except two in ten, which keep going (one repeating a path, one varying it).
|
||||
- `plan.record` lists what to log about the account on every run; `plan.scripts.shadow` is the sequence to follow
|
||||
once the shadow shows (`docs/BOT_CYCLE_FOR_KEN.md`).
|
||||
- `tree.json` is the screen tree (every screen, every option, where each led). `plan.screenPicks` says where the
|
||||
bot picks from it with `Solver.screenPick(tree, sceneId, offeredTexts, { mode, seed })`.
|
||||
- With squadmates, staying together and the direction are one screen; `recommendOption()` answers both at once
|
||||
and says so in `also`.
|
||||
|
||||
An experiment that reaches its planned count becomes `complete`, one that meets its stopping rule becomes `paused`;
|
||||
either way `assign()` stops giving it out and its share goes to the others. Nothing in the bot changes.
|
||||
|
||||
## From the Atlas's Gitea repository
|
||||
|
||||
Both repositories live on git.kenschiano.net. The bot can read the atlas files straight from the repository with a
|
||||
Gitea token that can read it (the repository is "limited": signed-in users only), instead of a zip:
|
||||
|
||||
```
|
||||
https://git.kenschiano.net/<owner>/threshing-atlas/raw/branch/main/data/public/policy.json
|
||||
https://git.kenschiano.net/<owner>/threshing-atlas/raw/branch/main/core/solver.js
|
||||
https://git.kenschiano.net/<owner>/threshing-atlas/raw/branch/main/core/graph.js
|
||||
```
|
||||
|
||||
(header `Authorization: token <token>`), plus `data/public/experiments.json`. Keep the files together: solver.js
|
||||
reads the game from policy.json.
|
||||
|
||||
## Without a shared repository: swapping zips
|
||||
|
||||
When GitHub Pages is not available, the same files travel as zips:
|
||||
|
||||
- **Atlas → bot:** `python -m collection export-bot-kit` writes `exports/atlas-for-bot-<date>-<policy id>.zip`
|
||||
(`policy.json`, `solver.js`, `graph.js`, a README with checksums). Unzip it into the bot's `vendor/threshing-atlas/`.
|
||||
- **Bot → atlas:** zip the bot's `data/` and `logs/` folders (folder names kept; a zip of the whole repo works too;
|
||||
screenshots are not needed) and send it. The importer reads `data/knowledge.json` and, for every account,
|
||||
`data/accounts/<account>/runs.jsonl` and `logs/accounts/<account>/encounters.jsonl` (with one folder per
|
||||
account, the top-level `data/runs.jsonl` and `logs/encounters.jsonl` mirror the first account and are skipped).
|
||||
Run records that carry their own steps (the bot's schema 2) are used as they are, including what the bot saw
|
||||
(shadow, meadow dragons), its decision mode and the policy id; older runs are rebuilt from the decision log.
|
||||
Account names become salted hashes. Put it in the atlas's `inbox/` and run
|
||||
`python -m collection refresh --bot inbox/<the zip>`: it imports the runs (anonymised: no prose, no account names),
|
||||
rebuilds everything, and then `export-bot-kit` makes the new zip to send back.
|
||||
|
||||
## 1. From the atlas to the bot
|
||||
|
||||
### What is published
|
||||
|
||||
GitHub Pages serves these files (they update whenever new data is merged):
|
||||
|
||||
| File | What it is |
|
||||
|---|---|
|
||||
| `https://ekcschiano.github.io/threshing-atlas/data/policy.json` | The model: count tables, fitted shrinkage, allowed options, and for every colour the recommended decision tree under both objectives, with credible intervals. About 400 KB. Has an `id` (content hash). |
|
||||
| `https://ekcschiano.github.io/threshing-atlas/solver.js` | The solver and the bot helper (`advisor`, `recommendOption`, `solverHistory`). No dependencies, CommonJS or browser. |
|
||||
| `https://ekcschiano.github.io/threshing-atlas/graph.js` | `trajectoryVariables()`: turns the bot's step trail into the community form's variables. |
|
||||
|
||||
### Getting them into the bot
|
||||
|
||||
Keep a pinned local copy, so a bad publish can never change the bot mid-run. A small sync script in the bot
|
||||
repo (for example `scripts/sync-atlas.js`):
|
||||
|
||||
```js
|
||||
// node scripts/sync-atlas.js -> vendor/threshing-atlas/{solver.js,graph.js,policy.json}
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const BASE = 'https://ekcschiano.github.io/threshing-atlas/';
|
||||
const OUT = path.join(__dirname, '..', 'vendor', 'threshing-atlas');
|
||||
(async () => {
|
||||
fs.mkdirSync(OUT, { recursive: true });
|
||||
for (const f of ['solver.js', 'graph.js', 'data/policy.json']) {
|
||||
const res = await fetch(BASE + f);
|
||||
if (!res.ok) throw new Error(`${f}: HTTP ${res.status}`);
|
||||
const body = await res.text();
|
||||
if (f.endsWith('.json')) JSON.parse(body); // refuse a broken file
|
||||
fs.writeFileSync(path.join(OUT, path.basename(f)), body);
|
||||
}
|
||||
const { id } = JSON.parse(fs.readFileSync(path.join(OUT, 'policy.json'), 'utf8'));
|
||||
console.log('atlas policy', id);
|
||||
})();
|
||||
```
|
||||
|
||||
Run it by hand, or once a day before the first attempt. Commit `vendor/threshing-atlas/` in the bot repo if you
|
||||
want the exact policy in its history.
|
||||
|
||||
### What changed in November 2026
|
||||
|
||||
The calls above are unchanged, but `solver.js` is now a small advisor (about 250 lines) that reads the game itself
|
||||
from `policy.json` (`samples.*.model.game`, from `core/spec/game.yaml`) instead of having it written into the code.
|
||||
For the bot that means:
|
||||
|
||||
- Histories (`h`) use the game's step names: `company`, `leave`, `direction`, `fs`, `react`, `scream`, `clearing`,
|
||||
`fight`, `dagger`, `fate` or `wounded`, `post`, `hour`, `shadow`, `shadowColour`, `descend`, `red`, `valley`,
|
||||
`meadow`, `encounter`. `solverHistory()` already produces these; the old `cadet` and `left` keys are no longer read.
|
||||
- New choices the bot will be asked about: leaving your squadmates (`leave`), how you react to the first dragon
|
||||
(`react`), and, below the tree, jumping onto the Red or letting it pass (`red`). The text the bot sees for each
|
||||
option is in `game.yaml` under `bot_text`, so new screens can be matched by editing that file.
|
||||
- If a history skips a decision but already has a later step (an older record, say), the recommended option is
|
||||
assumed for the skipped one.
|
||||
- Re-sync `solver.js`, `graph.js` and `policy.json` together: the new `solver.js` needs the game inside the new
|
||||
`policy.json`.
|
||||
|
||||
### Asking for advice on a screen
|
||||
|
||||
```js
|
||||
const Solver = require('../vendor/threshing-atlas/solver.js');
|
||||
const Graph = require('../vendor/threshing-atlas/graph.js');
|
||||
const policy = require('../vendor/threshing-atlas/policy.json');
|
||||
|
||||
// once per attempt: target colour from settings, "eventually" because the bot burns on purpose
|
||||
const advisor = Solver.advisor(policy.samples.all, 'Black', 'eventually');
|
||||
|
||||
// on every decision screen
|
||||
function atlasAdvice(run, offeredChoiceTexts, seen) {
|
||||
const { vars } = Graph.trajectoryVariables({ steps: run.steps, outcome: {} });
|
||||
const h = Solver.solverHistory(vars, seen); // seen: { shadow: 'yes'|'no', shadowColour, meadow }
|
||||
return Solver.recommendOption(advisor, h, offeredChoiceTexts);
|
||||
}
|
||||
```
|
||||
|
||||
`recommendOption` returns `null` when the next step is chance (nothing to decide), or
|
||||
`{ index, decision, choice, margin, options, reason }`:
|
||||
|
||||
- `index` is the option to click, or `null` when the advice cannot be matched to this screen. Then use the bot's own rules.
|
||||
- `decision === 'encounter'` comes without an index: `choice` is `"Attempt the bond"` or `"Die on purpose"`, and the
|
||||
bot already knows which of its options do each.
|
||||
- `margin` is the gap in P(target) between the best and second-best option. `options` has every option's value.
|
||||
|
||||
`seen` is what only the bot can observe: whether the shadow was at the treetop (`shadow: 'yes' | 'no'`), its colour
|
||||
(`shadowColour`), and the colour waiting in the meadow (`meadow`), all from the scene tint.
|
||||
|
||||
The advisor re-solves the model on the bot's machine (a few milliseconds), so it gives advice from any history,
|
||||
including runs that have already left the recommended route.
|
||||
|
||||
### Where it goes in the decision order
|
||||
|
||||
The atlas is advice. The bot's own safety rules stay in charge:
|
||||
|
||||
1. Account Lock Guard and the intentional-burn protection (never risk a non-target bond).
|
||||
2. Atlas advice, when `index` is not null and the margin is clear (see ties below).
|
||||
3. The bot's PDF strategy and learned rules.
|
||||
|
||||
Log every atlas pick with `rule: 'ATLAS_POLICY'`, `source: 'atlas'`, and the run-level `policyId: policy.id`
|
||||
(see `docs/BOT_DATA_PROTOCOL.md`), so we can tell which policy produced which runs.
|
||||
|
||||
### Learning: goal accounts follow the best route, research accounts sample
|
||||
|
||||
The atlas learns from the bot's own runs: every zip of the bot's data that is imported adds its rolls (first dragon,
|
||||
deaths, the shadow, the meadow dragon, bond results) to the route model, and the next `atlas-for-bot` zip carries
|
||||
the updated model. Deliberate burns (Malek, "no shadow", "no Blue") never count as failed bond attempts.
|
||||
|
||||
How the bot should choose depends on the account's role:
|
||||
|
||||
- **Goal accounts** (`accountRole: "goal"`): the best route under the model, as before:
|
||||
`Solver.advisor(policy.samples.all, target, 'eventually')`.
|
||||
- **Research accounts** (`accountRole: "research"`): Thompson sampling. Make a new advisor for every attempt with a
|
||||
new seed:
|
||||
|
||||
```js
|
||||
const adv = Solver.advisor(policy.samples.all, target, 'eventually', { sampling: 'thompson', seed: attemptNumber });
|
||||
```
|
||||
|
||||
Each attempt follows the best route of one plausible version of the odds, drawn from the model's uncertainty. An
|
||||
option that might be the best one gets tried about as often as it is likely to be the best, so the attempts go
|
||||
where the model is least sure; as the data firm up, sampling settles on the best route by itself.
|
||||
`recommendOption()` then returns a `propensity` (the chance this option was picked, from 40 other draws; set
|
||||
`draws` to change that). Log it on the step with `decisionMode: "atlas_thompson"`, so the runs can be re-weighted.
|
||||
Making the advisor takes a few seconds per attempt (it solves the game once per draw).
|
||||
|
||||
The tie rule below still works for goal accounts; research accounts don't need it.
|
||||
|
||||
### Ties are free experiments
|
||||
|
||||
### Which numbers to trust
|
||||
|
||||
`policy.json` has two samples:
|
||||
|
||||
- `samples.all`: every run. Use it for the advisor (more data, decisions are about relative differences).
|
||||
- `samples.lowBias`: bulk logs and riders not chasing a rare dragon. Use it for absolute expectations, such as how
|
||||
many attempts a Blue should take. Rare sightings are over-reported in form posts, so `all` is optimistic for Blue.
|
||||
|
||||
Current headline (November 2026): Black about 1.4% on an account's first attempt (95% range 0.7–2.2%; 0.8% in the
|
||||
low-bias sample) and about 0.07% on any later attempt; Blue about 1.9–2.5% per attempt (40–55 attempts), depending
|
||||
on the sample. The first-attempt figure rests on form submissions and an assumed reporting bias (see below): the
|
||||
bot and bulk logs have only 28 first attempts at the tree, and no shadow in about 570 tree runs in all.
|
||||
|
||||
The shadow is gated: it can only appear on runs that investigated the scream and helped the squadmate (the
|
||||
"Black Dragon Gates" of the community route PDF, and the runs agree). The model knows this
|
||||
(`core/spec/game.yaml`, `requires`), so it never sends a Black attempt off the gate.
|
||||
|
||||
Form submissions over-report rare sightings: riders report a meadow Blue about 4 times more readily than a meadow
|
||||
without one. The model estimates that bias for each kind of source and corrects for it (`planner/policy.yaml`,
|
||||
`reporting_bias`; the estimates are in `policy.json` under `model.reportingBias`). For the shadow the bias cannot be
|
||||
measured (complete logs have never seen one), so it is assumed equal to the meadow Blue's (`borrow`).
|
||||
|
||||
## 2. From the bot to the atlas
|
||||
|
||||
Already in place: `DRAGONKIND_BOT_DIR=/path/to/DragonKind python -m collection update --source bot` in the atlas repo converts the bot's
|
||||
`knowledge.json`, `runs.jsonl` and `logs/encounters.jsonl` into anonymised files under `data/bot/`, and refuses to
|
||||
write prose or account names. Commit them by pull request; CI rebuilds the graph and checks everything.
|
||||
|
||||
What would make the bot's data far more useful (details in `docs/BOT_DATA_PROTOCOL.md`):
|
||||
|
||||
- record the options on screen, what was seen (tint, shadow), `policyId`, `propensity` and `decisionMode` on every step;
|
||||
- split goal accounts (follow the advisor) from research accounts (run the tie experiments and the
|
||||
experiment list);
|
||||
- add `accountKey` (salted hash), and the reason for every deliberate burn.
|
||||
|
||||
## 3. Limits to keep in mind
|
||||
|
||||
- The community form does not record the answers inside each bonding encounter, so the bond chance at an encounter is
|
||||
the community average. The bot's own scene-level data will refine that over time.
|
||||
- The model learns how much history matters from the data. Today it finds that the meadow colour does not depend on
|
||||
earlier choices at all, and the shadow only weakly. The bot's randomised runs are what can confirm or overturn that.
|
||||
- The policy is only as good as the crosswalk between the bot's screen text and the form's variables. If the game
|
||||
changes its wording, `OPTION_PATTERNS` in `solver.js` and the crosswalk in `collection/specs/bot.yaml` (written into `graph.js` by `python -m collection build`) need updating.
|
||||
@@ -0,0 +1,32 @@
|
||||
# Dragon colours
|
||||
|
||||
Two palettes, one per background. Both were chosen so that every pair of dragon colours stays distinguishable for
|
||||
readers with the common colour-vision deficiencies, not only with normal vision. Check them with:
|
||||
|
||||
```
|
||||
python site/qa/check_colours.py
|
||||
```
|
||||
|
||||
It reports CIEDE2000 colour differences for every pair under normal vision and simulated protanopia, deuteranopia and
|
||||
tritanopia (Machado et al. 2009, full severity), and the contrast of each colour against its background.
|
||||
|
||||
| Dragon | Map ink (on the painted valley), `valley.js` `INK` | Page colour (on the dark page), `index.html` `--dr-*` |
|
||||
|---|---|---|
|
||||
| Red | `#cc3346` | `#e8435e` |
|
||||
| Orange | `#e08a2a` | `#ff9533` |
|
||||
| Brown | `#4e3020` | `#d1a47a` |
|
||||
| Green | `#2f8f6f` (a blue-leaning green) | `#3fc0a8` |
|
||||
| Blue | `#2a58b8` | `#7ea6ff` |
|
||||
| Black | `#22182a` | `#e0d8ea` (silver, so it shows on the dark page) |
|
||||
|
||||
**Before this check**, the map's Red and Green were nearly identical under deuteranopia (difference 1.4), and on the dark
|
||||
page Orange and Brown were too close even for normal vision (9.7). The worst pair is now about 12–13 on both palettes
|
||||
(roughly "clearly different side by side").
|
||||
|
||||
What still relies on more than colour, on purpose:
|
||||
|
||||
- every dragon also has its own pose and sits in its own place on the map, and every route and card is labelled with
|
||||
the dragon's name;
|
||||
- text on the map is always dark ink; the dragon colour is used for lines, silhouettes and label borders only
|
||||
(Orange and Green are too light to read as text on the paper background);
|
||||
- silhouettes carry a paper-coloured halo so dark dragons stay visible on the dark canopy.
|
||||
@@ -0,0 +1,44 @@
|
||||
# Privacy and licences
|
||||
|
||||
Rules every part of the project follows. If a change would break one, stop and ask first.
|
||||
|
||||
## What may be published
|
||||
|
||||
- **Code** is MIT (`LICENSE`). **Data this project produces** is CC BY 4.0 (`DATA_LICENSE.md`). Third-party
|
||||
sources keep their own terms.
|
||||
- **Community form responses:** published as exported, with email addresses in free-text answers redacted by
|
||||
the coding rules (`core/spec/form.yaml`, `core/atlas/coding.py`).
|
||||
- **Dragon Register:** only `data/public/register.json`. The raw export has rider names and stays local
|
||||
(`data/raw/register/` is git-ignored).
|
||||
- **The community route PDF:** never committed or redistributed. Only a fingerprint
|
||||
(`data/derived/pdf_fingerprint.json`) so we can tell when it changes, and a link to the original.
|
||||
- **Bot data:** only scene fingerprints, short labels, choice text and outcomes. Never game prose, never account
|
||||
names. The importer (`collection/etl/transform/bot.py`, rules in `collection/pipeline.yaml`) refuses to write anything that looks like either.
|
||||
|
||||
## The bot
|
||||
|
||||
- Ken's bot repository stays private. Only the anonymised import comes here.
|
||||
- Account ids are salted and hashed. The salt (`DK_ACCOUNT_SALT`) lives in the environment and is never
|
||||
committed.
|
||||
- The bot's browser profiles, `.env` and credential files are never committed or shared.
|
||||
|
||||
## Sources we do not scrape
|
||||
|
||||
- **Discord:** not without the server admins' consent; never with a personal account token.
|
||||
- **Reddit:** only through Reddit's official API with an app key (`REDDIT_CLIENT_ID` / `REDDIT_CLIENT_SECRET`),
|
||||
never by page scraping. Only dragonkind.com result links are taken from the threads; usernames and comment text
|
||||
are never kept, and each result page is read and added by hand (`collection/manual/reddit_results.yaml`).
|
||||
|
||||
## Run reports
|
||||
|
||||
"Report a run" creates an issue on the Atlas's repository (forge.yaml), visible to everyone who can see it. The pipeline keeps only the issue number, the date and the answers
|
||||
(`data/public/reports.json`); GitHub usernames are dropped. The form asks people not to include account names. A
|
||||
report closed as "not planned" or labelled `invalid` or `duplicate` is left out of the data.
|
||||
|
||||
## Secrets
|
||||
|
||||
- `ATLAS_BOT_TOKEN` (repository secret) lets the daily data update open and auto-merge its pull request
|
||||
(`docs/REPO_SETTINGS.md`).
|
||||
- `RAW_ARCHIVE_KEY` encrypts the raw store (the current and previous raw file of each source, which include the
|
||||
register's rider names) in the Actions cache between daily runs. Without it nothing is archived.
|
||||
- `REDDIT_CLIENT_ID` / `REDDIT_CLIENT_SECRET` let the daily update read the megathreads through the Reddit API. Tokens go in secrets only: never in a file, issue, chat or commit.
|
||||
@@ -0,0 +1,332 @@
|
||||
# Threshing Atlas: project context
|
||||
|
||||
A briefing for picking this project up in a new conversation. Written 2026-11-12 from the working state on
|
||||
Kathleen's Mac (`~/PycharmProjects/threshing-atlas`, latest commit `4837332`).
|
||||
|
||||
---
|
||||
|
||||
## 1. What this is
|
||||
|
||||
**Dragonkind** is a browser game set in the world of *Fourth Wing*. Its centrepiece, **the threshing**, is a short
|
||||
choose-your-path run: a cadet walks into a valley, makes a series of choices, the game rolls dice at certain points,
|
||||
and the run ends with the cadet either **bonded to a dragon** (Red, Orange, Brown, Green, Blue or Black) or
|
||||
**incinerated**. There's a cooldown of about four hours between attempts, Blue and Black are rare, and players want
|
||||
to know which choices give the best odds of the dragon they want.
|
||||
|
||||
The **Threshing Atlas** is a hobby, non-commercial, open-data project by **Kathleen Schiano (GitHub: ekcSchiano)**
|
||||
that:
|
||||
|
||||
1. **collects** every logged run it can find (a community Google Form and spreadsheet, Reddit, a bot, direct reports),
|
||||
2. **codes** them into one clean table, one run per row (`data/public/runs_clean.csv`),
|
||||
3. **analyses** them (factor tables, models, route rankings) for a public page,
|
||||
4. **plans** routes: a Bayesian model of the game's dice, solved as a decision tree, that recommends the best
|
||||
choice at every step for each target colour, and
|
||||
5. **feeds a bot**: Ken's DragonKind bot plays the game, uses the Atlas's route model to choose, and sends its runs
|
||||
back, so the model keeps learning.
|
||||
|
||||
Kathleen is a PhD researcher (informatics); she prefers **Python**, **declarative specs (YAML, data dictionaries,
|
||||
Croissant metadata)**, and JavaScript only where it must run in a browser or in Ken's Node bot.
|
||||
|
||||
## 2. People, places and accounts
|
||||
|
||||
| What | Where | Notes |
|
||||
|---|---|---|
|
||||
| The Atlas repo (canonical copy) | `~/PycharmProjects/threshing-atlas` on Kathleen's Mac | Python venv at `.venv` (Python 3.9); PyCharm. Has `scipy`; **Node is not installed** (so `graph.json` can't be rebuilt there; `brew install node` fixes it). |
|
||||
| GitHub repo | `github.com/ekcSchiano/threshing-atlas` (public) | **Account suspended** (flagged by GitHub's abuse detection, probably bursts of automated API activity from an AI assistant). Reinstatement request open with GitHub Support; they asked how she plans to use GitHub (answered: pet projects). GitHub Pages site paused. The Mac copy's `origin` still points here. |
|
||||
| Gitea | `git.kenschiano.net` (Ken's server) | The Atlas is prepared to move there (under Kathleen's own account, visibility "limited"), but **Ken's Gitea has a problem; skipped for now**. |
|
||||
| Ken | Gitea `kschiano`; GitHub issues author | Collaborator. Runs the **DragonKind bot** (private repo, now on his Gitea at `kschiano/DragonKind`). Kathleen has a local clone at `~/Desktop/DragonKind`: **read-only for us, never modify it** without asking. |
|
||||
| The page | Claude artifact "Threshing Route Atlas": https://claude.ai/artifact/Amr4D5Av7sBHkWvjJuXM8A | Last republished 2026-11-04 (older data). Kathleen will view new builds locally / as an artifact while GitHub Pages is paused. |
|
||||
| Community sources | u/ClumsyBadger's "Threshing Routes" Google Form (https://forms.gle/DRpj9tG8gb5E4Hcu7) and its responses spreadsheet; the "Unofficial Dragon Register"; the community route PDF; r/fourthwing Dragonkind megathreads (Part 3 `1wvwfp9`, Part 4 `1wz5cnj`) | Linked from the megathread post. u/Old_Regular3018 computes the PDF's percentages from the same spreadsheet; u/Smart_Trifle_2099 posted "precise Blue pathways" and Black theories. |
|
||||
| Backups | `threshing-atlas.bundle` sent in chat (git bundle of all branches) | `git clone threshing-atlas.bundle threshing-atlas` |
|
||||
|
||||
## 3. The game, as the Atlas models it
|
||||
|
||||
The game is written down declaratively in **`core/spec/game.yaml`** (the single source of truth for the route
|
||||
model, the advisor and the bot). In order:
|
||||
|
||||
1. **Company**: enter alone, with 1 or with 2 squadmates. **Leave** your squadmates or stay together.
|
||||
2. **First direction**: East, West or Center (the forest).
|
||||
3. **First dragon** (roll): Red, Brown, Green or Orange. **React**: hold still, respect/face it, run, hide, weapon,
|
||||
meet its gaze, protect squadmate (which reactions exist depends on the dragon). **Survive the first dragon** (roll).
|
||||
4. **The scream**: investigate it or keep walking.
|
||||
- **Investigate → the clearing** (your squadmate attacked by two bully cadets): help, or walk away.
|
||||
Help → **the fight**: pause to assess (then the dagger: engage the smaller cadet or charge the bigger one
|
||||
anyway), charge the smaller cadet ("even the numbers"), or charge the bigger one ("put yourself in the middle").
|
||||
**Survive the fight** (roll). Then **the bullies' fate**: kill them yourself, squadmate's revenge, or leave them
|
||||
to the dragons. Then a **fork**: Forest, West or East.
|
||||
- **Keep walking → the wounded cadet**: tourniquet, leave them to die, or take their weapons.
|
||||
5. **Survive the hour** (roll). **After an hour**: climb the tallest tree, or go to the valley centre.
|
||||
6. **Tree**: the **shadow** may appear (roll; **gated**, see below) → the shadow's colour (Black or Blue) → bonding
|
||||
encounter. If no shadow: **climb down quickly** (the Red below the tree: jump on it, or let it pass → the two
|
||||
Greens) or **slowly** (the two Greens).
|
||||
7. **Valley**: **face the Red**, or pass it into the **meadow**, where a dragon waits (roll: Orange, Brown, or a Blue).
|
||||
8. **Bonding encounters** (`encounters` in game.yaml): valley Red, tree Red, the two Greens (an Orange or Brown can
|
||||
swoop in and rescue/bond you), meadow Orange/Brown/Blue, the Blue at the redwood (shadow), the Black (shadow).
|
||||
A rider can attempt the bond or **die on purpose** ("seek Malek") rather than bond the wrong dragon.
|
||||
|
||||
Key modelling facts now in game.yaml:
|
||||
- **The shadow is gated**: it can only appear if you **investigated the scream and helped your squadmate** (the route
|
||||
PDF's "Black Dragon Gates"; data agree: 78 shadows in 4,199 gated tree runs vs 2 in 646 others, both likely
|
||||
mis-entered). A closed gate fixes the roll at "no" and those runs aren't counted for it.
|
||||
- **Possible bonds per encounter**: each encounter gives only its own colour (the two Greens also Orange/Brown).
|
||||
Anything else in the data is treated as a data-entry error (a form row once claimed a Green at the shadow's Blue,
|
||||
which broke the Green recommendation).
|
||||
|
||||
## 4. The four prongs + core (repo layout)
|
||||
|
||||
```
|
||||
core/ spec/form.yaml (how each form answer is coded), spec/game.yaml (the game)
|
||||
atlas/ (Python): coding.py (form → runs), model.py (counts, back-off, Params), solver.py (decision
|
||||
tree, posterior draws, policy export), bias.py (reporting bias), runs.py (read runs_clean.csv), spec.py
|
||||
solver.js (the small JS advisor), graph.js (route graph helpers + the bot crosswalk, generated block)
|
||||
collection/ pipeline.yaml (every source, declaratively), run.py (`python -m collection ...`),
|
||||
etl/ (extract, transform/*, validate, load, runs.py coders, metadata.py (Croissant), codegen.py,
|
||||
report_form.py, handoff.py (zips, local refresh), forge.py (Gitea/GitHub API)),
|
||||
specs/bot.yaml (bot labels + crosswalk), specs/report_form.yaml, manual/reddit_results.yaml
|
||||
analysis/ stats/measures.yaml (what the page measures), site_stats.py, stats_core.py;
|
||||
network/build-graph.js (graph.json); reports/POLICY.md (written by policy_report.py)
|
||||
planner/ policy.yaml (which runs the model learns from, low-bias sample, reporting-bias settings),
|
||||
build_policy.py, policy_report.py
|
||||
site/ atlas/ (index.html, app.js, ui.js, explorer.js (valley map), valley.js, dragons.js, register.js),
|
||||
build.js (→ dist/), qa/ (crawl.js, mapcheck.js: Playwright checks)
|
||||
data/ public/ (everything published: runs_clean.csv, form_responses.json, register.json, reports.json,
|
||||
stats.json, policy.json, graph.json, links.json), dictionary.yaml, croissant.json, manifest.json,
|
||||
bot/ (scenes.json, trajectories-*.jsonl: anonymised bot runs), derived/pdf_fingerprint.json,
|
||||
raw/ (git-ignored: current + previous raw file per source; never published)
|
||||
tests/ core/ (coding rules, game, solver, stats, bias + JS advisor/graph tests), collection/ (pipeline),
|
||||
fixtures/, parity/
|
||||
docs/ BOT_INTEGRATION.md, BOT_DATA_PROTOCOL.md, PRIVACY.md, REPO_SETTINGS.md, ROADMAP.md, COLOURS.md
|
||||
forge.yaml where the repo is hosted (gitea, git.kenschiano.net, repo: kathleen/threshing-atlas)
|
||||
.gitea/workflows/ CI + daily update for Gitea .github/workflows/ CI, daily update, Pages for GitHub (paused)
|
||||
```
|
||||
|
||||
### 4a. Data collection: ETL (`collection/`)
|
||||
|
||||
`collection/pipeline.yaml` declares every source: how to **extract** it, which **transform**, its **privacy** rules,
|
||||
where it **loads**, and which **coder** turns it into runs.
|
||||
|
||||
- **extract** only fetches into `data/raw/<source>/current.<ext>` (the replaced one becomes `previous.<ext>`;
|
||||
nothing older is kept). `data/manifest.json` records the current raw checksum and change date.
|
||||
- **transform** is pure (no network, no clock) → the public source file.
|
||||
- **validate** checks runs against `data/dictionary.yaml` (types, every allowed value, unique ids). A new answer the
|
||||
rules don't know **stops the load** and is reported (add it to `core/spec/form.yaml`).
|
||||
- **load** is the only stage that writes; byte-stable.
|
||||
- **build** codes every public source file into `data/public/runs_clean.csv` and writes generated files: the
|
||||
"Report a run" issue form, the crosswalk block in `core/graph.js`, `data/public/links.json`, `data/croissant.json`.
|
||||
|
||||
| `source` in runs_clean | Pipeline source | Runs now | Notes |
|
||||
|---|---|---|---|
|
||||
| reddit spreadsheet | `reddit_spreadsheet` (the Threshing Routes form + sheet) | 8,132 | coded by `core/spec/form.yaml`; `entry` column keeps the sheet's own label ("Form" = form submission; others = bulk-pasted logs) |
|
||||
| bot | `bot` (Ken's bot, imported from a folder or zip) | 421 | per-account folders; account names salted-hashed (salt in `data/raw/bot/account-salt.txt` on the Mac, never committed); `bot_mode` column |
|
||||
| reddit thread | `reddit_thread` | 12 | dragonkind.com result pages read by hand (`collection/manual/reddit_results.yaml`); Reddit API extractor ready but needs `REDDIT_CLIENT_ID/SECRET` |
|
||||
| reported | `reported` ("Report a run" issue form) | 0 | GitHub issues; switched to Gitea via forge.yaml (currently 404s: GitHub suspended, Gitea not set up) |
|
||||
| reddit pdf | `reddit_pdf` | 0 | the route PDF is a flowchart, not runs: only its **fingerprint** is kept (never redistributed); changes are reported line by line |
|
||||
| (none) | `register` (Unofficial Dragon Register) | 0 | bonded dragons without routes; names and photos dropped |
|
||||
|
||||
Every column is described in `data/dictionary.yaml`; `data/croissant.json` is Croissant 1.0 metadata built from it.
|
||||
|
||||
### 4b. Data analysis (`analysis/`)
|
||||
|
||||
`analysis/stats/site_stats.py` reads runs_clean (sources in `measures.yaml`: **spreadsheet only** for now) and writes
|
||||
`data/public/stats.json`: every number the page shows, for six fixed filter presets (all, form only, bulk only, not
|
||||
chasing Blue/Black, chasing, unflagged). Factor tables (Fisher/Mantel–Haenszel, BH q-values), ridge-logistic models,
|
||||
route rankings at thresholds 5/10/20/30, per-stage route map counts. The page computes nothing itself.
|
||||
`analysis/network/build-graph.js` writes `graph.json` (route graph per source + the bot's scene graph).
|
||||
|
||||
### 4c. Route planner (`planner/` + `core/atlas/`)
|
||||
|
||||
- **Model**: each roll (first dragon, survive sighting/fight/hour, shadow, shadow colour, meadow dragon) is a
|
||||
categorical with a **hierarchical Dirichlet back-off** over its context (earlier choices); the shrinkage strength
|
||||
(alpha) is fitted by empirical Bayes. Bond outcomes per encounter likewise. Malek/deliberate burns are not counted
|
||||
as failed bonds.
|
||||
- **Learns from** (`planner/policy.yaml`): reddit spreadsheet + reported + **bot** runs.
|
||||
- **Reporting-bias correction** (`core/atlas/bias.py`): form submitters over-report rare sightings. For each rare roll
|
||||
and each group, rho = odds(rare | group) / odds(rare | complete logs), where complete logs = **bot + bulk logs**.
|
||||
Rare outcomes from biased groups count 1/rho. Current estimates (meadow Blue): **form, chasing Blue/Black rho 3.85
|
||||
[2.98–5.14]; form, other 3.17 [2.33–4.41]**. For the shadow, complete logs have **0 shadows in 579 gated tree runs**,
|
||||
so the bias can't be estimated and the shadow is learned from complete logs only. A roll seen only one way is pooled
|
||||
fully (alpha max). Caveats: assumes the bias is the same on every route; intervals don't include rho's uncertainty.
|
||||
- **Solver** (`core/atlas/solver.py`): walks game.yaml as a decision tree; two goals per colour: "this attempt"
|
||||
(maximise P(colour)) and "eventually" (Dinkelbach ratio: P(X) / (P(X)+P(other bond)), i.e. dying on purpose
|
||||
otherwise). 200 posterior draws give intervals and **stillBest** (share of draws where the recommended choice is best).
|
||||
Two samples: **all** and **lowBias** (bot + bulk + riders not chasing rare dragons).
|
||||
- **Output**: `data/public/policy.json` (game, count tables, alphas, reportingBias, support, trees per colour).
|
||||
- **JS advisor** (`core/solver.js`): reads policy.json, re-solves, `advisor(sample, colour, objective, opts)`,
|
||||
`recommendOption()` maps on-screen text to options (game.yaml `bot_text`). **Thompson sampling**:
|
||||
`{ sampling: 'thompson', seed }` follows one posterior draw per attempt and returns a **propensity**.
|
||||
|
||||
Current odds per attempt (sample "all", latest build `538bc1e3d694`):
|
||||
|
||||
| Colour | Per attempt (90% range) | Low-bias sample | stillBest of first choice |
|
||||
|---|---|---|---|
|
||||
| Red | 93.1% (86.9–97.4) | 94.1% | 0.30 |
|
||||
| Green | 25.2% (21.7–28.8) | 24.2% | 0.42 |
|
||||
| Orange | 13.5% (11.3–15.7) | 16.7% | 0.55 |
|
||||
| Brown | 9.3% (7.7–11.2) | 10.7% | 0.52 |
|
||||
| Blue | 2.5% (2.1–3.0) | 1.9% | 0.45 |
|
||||
| Black | 0.05% (0.00–0.25) | 0.04% | 0.31 |
|
||||
|
||||
(Before the bot data and bias correction, the model said Blue 7.3% and Black 2.1%: inflated by reporting bias.)
|
||||
|
||||
### 4d. Data visualisation (`site/`)
|
||||
|
||||
A single static page (tabs: Valley map, Odds, Dragons, Deep dive, Data & Methods, **Report a run**). The **valley
|
||||
map** (`explorer.js`) uses progressive disclosure: key moments only, a point's options appear when selected, picking
|
||||
a dragon shows its best path and choices; later choices keep the path you picked. The page shows precomputed
|
||||
`stats.json` and runs the JS advisor on `policy.json`. Links come from `data/public/links.json` (filled in by
|
||||
`site/build.js`). Build: `node site/build.js` → `dist/`. QA: `site/qa/crawl.js` (needs a local server on :8765),
|
||||
`site/qa/mapcheck.js`. Published so far as the Claude artifact above.
|
||||
|
||||
## 5. The bot loop (Ken)
|
||||
|
||||
- **Atlas → bot**: `python3 -m collection export-bot-kit` → `exports/atlas-for-bot-<date>-<policy id>.zip`
|
||||
(policy.json, solver.js, graph.js, README with checksums). Ken unzips into the bot's `vendor/threshing-atlas/`.
|
||||
Latest: `atlas-for-bot-2026-11-12-538bc1e3d694.zip`.
|
||||
- **Bot → atlas**: Ken zips the bot's `data/` and `logs/` folders; save in `inbox/` and run
|
||||
`python3 -m collection refresh --bot inbox/<zip>`. The importer reads `data/knowledge.json` and every
|
||||
`data/accounts/<acct>/runs.jsonl` + `logs/accounts/<acct>/encounters.jsonl` (top-level files mirror the first
|
||||
account and are skipped). Bot **schema-2** run records carry steps, what was seen (shadow, dragons), propensity,
|
||||
decisionMode, policyId. No game prose or account names are published (`check_public` refuses them).
|
||||
- **How the bot should choose** (docs/BOT_INTEGRATION.md): goal accounts follow the best route
|
||||
(`advisor(policy.samples.all, target, 'eventually')`); **research accounts use Thompson sampling** with a new seed
|
||||
per attempt and log `propensity` with `decisionMode: "atlas_thompson"`.
|
||||
- Ken's data so far: 13 accounts, 415 attempts (to 2026-11-10); research accounts burn on purpose when no shadow at
|
||||
the tree / no Blue in the meadow (`TREE_NO_SHADOW_AUTO_BURN`, `MEADOW_NO_BLUE_AUTO_BURN`).
|
||||
|
||||
## 6. Findings so far
|
||||
|
||||
- **Reporting bias is large.** Meadow Blue: complete logs ~10% (bot 16/126, bulk 30/328) vs form ~33%.
|
||||
- **Black is very rare.** 0 shadows in 579 gated tree runs from complete logs; form data show ~2% (inflated). Model:
|
||||
~0.05% per attempt. Fits Smart_Trifle_2099's guess of 1/500–1/1000 tree runs for a Black sighting.
|
||||
- **Route doesn't seem to move the rare rolls.** Shadow rate doesn't differ across routes (chi² 44 on 40 df); the
|
||||
"precise Blue pathways" (Smart_Trifle_2099 and the megathread post's ~47%/~63% routes) did no better than other
|
||||
meadow routes (23–30% vs 30% in the spreadsheet). Reaching the meadow seems to be the "unlock".
|
||||
- **The gate is real**: the shadow needs investigate + help.
|
||||
- **Tree Red is the hardest bond**: 1.7% (38/2,207), matching the post's "2%".
|
||||
- **First attempts** see the meadow Blue less often (16% vs 31%), surviving adjustment in the site's model.
|
||||
- Weekly swings in rates (and "the game was patched" claims) are confounded by who reports when.
|
||||
|
||||
## 7. How to run things (on the Mac, PyCharm terminal, venv active)
|
||||
|
||||
```
|
||||
python3 -m collection refresh # the daily update locally (~3 min): sources → runs → graph* → model → stats → build
|
||||
python3 -m collection refresh --bot inbox/x.zip # same, importing a bot zip
|
||||
python3 -m collection update --source NAME # one source; --file NAME=PATH to use a local file
|
||||
python3 -m collection build [--check] # rebuild runs_clean + generated files (CI uses --check)
|
||||
python3 -m collection export-bot-kit # zip for Ken
|
||||
python3 planner/build_policy.py # route model (~30–75 s); python3 planner/policy_report.py
|
||||
python3 analysis/stats/site_stats.py # page statistics (needs scipy)
|
||||
node analysis/network/build-graph.js # graph.json (*needs Node)
|
||||
node site/build.js # the page → dist/
|
||||
npm test # = build --check + Python unit tests + JS tests
|
||||
```
|
||||
|
||||
Reports land in `exports/last-report.md`. If a refresh stops with "values not in the dictionary", add the new form
|
||||
answer to `core/spec/form.yaml` (or the value to `data/dictionary.yaml`) and run `python3 -m collection build`.
|
||||
|
||||
## 8. Conventions and constraints (keep these)
|
||||
|
||||
- **Python first; declarative specs** (YAML for the form, game, pipeline, measures, planner, bot crosswalk, report
|
||||
form; dictionary + Croissant). JS only for the browser page and Ken's Node bot (`solver.js`, `graph.js`).
|
||||
- **Generated files are generated**: don't hand-edit `runs_clean.csv`, `croissant.json`, `links.json`, the
|
||||
crosswalk block in `core/graph.js`, `.github/ISSUE_TEMPLATE/report-a-run.yml`. Edit the spec, then build.
|
||||
- **Privacy**: no game prose, no account names/ids, no emails (redacted), no rider names (register), no Reddit or
|
||||
GitHub usernames; the route PDF is never redistributed (fingerprint only). Never commit `data/raw/`, `.env`,
|
||||
`.browser-profile/`, salts or tokens; tokens only in repository secrets. Don't scrape Discord with a personal token;
|
||||
Reddit only via the official API.
|
||||
- **Don't write to Ken's bot repo** (`~/Desktop/DragonKind`) without asking.
|
||||
- **Commits** as `ekcSchiano` / Kathleen's email, ending with `Co-Authored-By: Claude …` and `Claude-Session: …`
|
||||
lines. On GitHub, main was protected (PR + required `test` check, auto-merge). **Go easy on automated API
|
||||
activity** (that's the likely cause of the GitHub suspension).
|
||||
- Kathleen likes: progressive disclosure on the map, honest uncertainty, explaining what changed and why.
|
||||
|
||||
## 9. Status and open threads
|
||||
|
||||
- **Uncommitted / pending**: nothing important; Mac repo is clean at `4837332` (plus `.idea/`, `exports/`, `inbox/`
|
||||
ignored). The artifact page is older than the data; rebuild with `node site/build.js` (needs Node) and republish.
|
||||
- **GitHub**: suspended; reinstatement in progress. When back: `git push` to a branch + PR (main is protected);
|
||||
GitHub Pages resumes from `.github/workflows/pages.yml`; set `forge.yaml` `kind: github` (or keep Gitea + mirror).
|
||||
- **Gitea**: ready but on hold (Ken's server has a problem). Steps in `docs/REPO_SETTINGS.md`; set your username in
|
||||
`forge.yaml`; the `.gitea/workflows/` are untested (runner label assumed `ubuntu-latest`).
|
||||
- **"Report a run"** button points at a Gitea URL that doesn't exist yet; the Google Form is the working intake.
|
||||
- **Not done yet / ideas**:
|
||||
- Include bot and reported runs in the page's statistics (currently spreadsheet only; bot choices follow a strategy).
|
||||
- Propagate the bias estimate's uncertainty (rho) into the route model's intervals; consider a per-source
|
||||
reporting-bias model inside the posterior draws.
|
||||
- Inverse-propensity weighting of bot runs using logged propensities.
|
||||
- Port `build-graph.js` to Python; Reddit extractor live once API secrets exist; "Community claims, checked"
|
||||
section (claims YAML recomputed against data); a "random run?" question on the report form.
|
||||
- Reviews still pending from the original plan: analysis, planner (experiments.json, encounter answers), site.
|
||||
- **Environment gotchas** (for Claude sessions): the cloud workspace and the Mac's Linux helper can't reach Google,
|
||||
Gitea or PyPI; Kathleen's own Terminal can. The helper lacks `scipy`. Git in the helper needs delete permission
|
||||
for its lock files.
|
||||
|
||||
## 10. Update, 2026-11-11: first attempts, the experiment plan, the automated cycle
|
||||
|
||||
Branch `first-attempt-cycle` (pushed to Gitea; not merged into main yet).
|
||||
|
||||
- **The shadow is close to a first-attempt event.** Form submissions, gated tree runs: 69 shadows in 748 first
|
||||
attempts (9.2%), 7 in 1,995 later ones (0.35%), in every week. Complete logs have only 28 first attempts at the
|
||||
tree and the bot has none, so "0 shadows in 579" was about later attempts.
|
||||
- **Model.** `core/spec/game.yaml` has `givens` (first or later attempt) and the shadow roll depends on it first,
|
||||
unpooled (`distinct: 1`). `policy.json` has `targets.<colour>.firstAttempt`. Black: about 1.4% on a first attempt
|
||||
(0.7–2.2%; 0.8% low-bias), 0.07% later.
|
||||
- **An assumption to revisit.** The shadow's reporting bias cannot be measured, so `planner/policy.yaml` has
|
||||
`borrow: { shadow: meadow }` (form reports of a shadow count about 1/3.9). Remove the line to go back to complete
|
||||
logs only. The bot's first-attempt runs will settle it.
|
||||
- **Plan.** `planner/experiments.yaml` (design) → `planner/build_experiments.py` → `data/public/experiments.json`
|
||||
(progress and status per experiment). The bot reads it with `assign()` in `core/solver.js`; the advisor takes
|
||||
`attempt`, `fix` and `sampling: "uniform"`.
|
||||
- **Account lifecycle** (agreed with Ken): a new account's first attempt is the Black attempt; if it fails, the
|
||||
account does research for three days, then retires (one in ten keeps running).
|
||||
- **Cycle.** `python -m collection cycle --bot DIR --deliver DIR`: import, refit, re-plan, deliver; no-op without
|
||||
new runs. `.gitea/workflows/bot-cycle.yml` runs it on a runner on the bot's machine (untested).
|
||||
- **For Ken:** `docs/BOT_CYCLE_FOR_KEN.md`. The clone at `~/Desktop/DragonKind` is from 31 October and older than
|
||||
the bot that is running, so the bot's side was written as a specification, not against its code.
|
||||
- **Not done:** the page does not show first-attempt odds yet; Gitea still needs Kathleen's account, the
|
||||
repository and the push (`docs/REPO_SETTINGS.md`); git.kenschiano.net answers (Gitea 1.27.0).
|
||||
|
||||
## 11. Update, 2026-11-16: the developer's statements, and looking for the Black's rule
|
||||
|
||||
- **Source.** The developer's answers in a community Discord channel (135 forwarded messages, exported
|
||||
2026-11-16). The export is private raw data; `planner/knowledge.yaml` holds the statements paraphrased, dated and
|
||||
graded (said / hint / declined), with what the Atlas does with each and the open questions.
|
||||
- **What it changes.** The Black is not dice: the seed plays no part, it shows when the rider's choices meet its
|
||||
conditions, and knowledge gives certainty. The bullies encounter and the tree are gates; there is no single route;
|
||||
about five conditions. The Blue is dice from the seed. No event is rarer than 1 in 20. Runs are never forgotten
|
||||
and never hurt.
|
||||
- **What the runs add** (`analysis/black/evidence.py` -> `analysis/reports/BLACK.md`, rebuilt every cycle): on the
|
||||
same recorded route, 21 of 79 first attempts show the shadow against 1 of 80 later ones (across routes: odds ratio
|
||||
21.5, z = 9.8); on that route, runs with the same wing, section and squad still disagree; shadows are on 44
|
||||
different recorded routes; after the shadow comes a Blue, then the Black; holding the Black's gaze bonded 27 of
|
||||
39, lowering eyes 0 of 7.
|
||||
- **Model.** The shadow is marked `guard: true` in `game.yaml`: the model's number is the share of runs that met
|
||||
unknown conditions, not a chance. `shadowColour` is "past the Blue to the Black".
|
||||
- **Plan (version 2).** Attempt 1 on every fresh account is one exact path (`fresh-replicate`, 60 accounts), then
|
||||
one choice changed at a time (`fresh-ablate`, starts by itself). `shadow-again`, `second-attempt-same-path`,
|
||||
`veteran-repeat` and `veteran-variety` test fresh against veteran. `assign()` takes account facts; the plan carries
|
||||
what to record and the sequence to follow once the shadow shows.
|
||||
- **Not known.** What differs between fresh accounts that see the shadow and those that do not on the same route;
|
||||
what "twenty" counts; why holding the Black's gaze fails three times in ten.
|
||||
- **To tidy.** One public `bond_note` holds a rider's handle ("Run 116 - ..."), in a row marked as a first attempt.
|
||||
|
||||
## 12. Update, 2026-11-16 (later): the master list, the screen tree, and a fix to the bot's rows
|
||||
|
||||
- **Master list.** `runs_clean.csv` now has 8,853 rows: spreadsheet 8,132 (every row of "Form Responses 1"; the
|
||||
workbook's other tabs are views of it), bot 421 (every trajectory), register 288 (new: bonded dragons, outcome
|
||||
only, each flagged because the same run may be in the spreadsheet), Reddit result pages 12. Not in it because
|
||||
nothing has been collected: Discord run reports (the only Discord export is the developer's channel, which holds
|
||||
no runs), "Report a run" (0 reports), megathread comments (needs the Reddit API keys; the 12 were read by hand on
|
||||
19 October). Stale: the spreadsheet was last fetched 12 November and the bot's data 10 November.
|
||||
- **Possible duplicates, left in.** 17 spreadsheet rows are identical to another including the timestamp; 204 more
|
||||
are identical except for the timestamp (the same route and death repeated, or a double submission).
|
||||
- **Fix.** The bot logs a pick it then overrode as a step. 37 bot runs were coded with choices they never made
|
||||
(direction, fork, dagger, reaction); they are now coded from the played steps (`collection/etl/runs.py` `played`,
|
||||
`core/graph.js` `playedSteps`).
|
||||
- **Screen tree.** `analysis/tree/build_tree.py` -> `data/public/tree.json` and `analysis/reports/TREE.md`, from
|
||||
the bot's logs: 45 screens, 116 options (69 played), which options are dice and their rates, the best known picks
|
||||
per colour (chosen cautiously), where any set of picks ends, and the untested options. Blue: a Blue waits on 11.4%
|
||||
of meadow visits and the bonding chain has survived 18.7%, so 2.1% per run on the answers tried so far.
|
||||
`screenPick()` in `core/solver.js` picks from the tree (least-tried, or Thompson). Rebuilt every cycle; in the kit.
|
||||
- **Limit.** The tree treats a screen's odds as the same whatever came before. That is right for the seeded draws
|
||||
and wrong for the shadow. It holds only what the bot has played: no first attempts, no shadow, one Green bond.
|
||||
@@ -0,0 +1,19 @@
|
||||
# I ran the numbers on 2,573 logged threshing runs. Here's what holds up (and what doesn't)
|
||||
|
||||
*Per the megathread rules, anything that names a specific route is behind spoiler tags.*
|
||||
|
||||
Data: the community Threshing Routes form/spreadsheet (thanks u/ClumsyBadger, u/Old_Regular3018, u/Smart_Trifle_2099 and everyone who logged runs). 1946 form submissions, 83 Historical import, 348 Data Import, 196 Manual Upload; form dates 2026-10-04 to 2026-10-19. Every rate below has a 95% confidence interval.
|
||||
|
||||
**TL;DR**
|
||||
|
||||
* **The meadow Blue shows up a lot less than the spreadsheet suggests.** Runs logged by Blue-chasers show it 50.1% of the time, but bulk logs (people who recorded *every* run) show 11.0% (21/191). The game can't know what you're chasing, so that gap is reporting bias. Expect something closer to the bulk-log number.
|
||||
* **No recorded route choice changed the Blue's odds** once you account for that bias (direction, first dragon, how you handled the cadet, company). 0 of 25 full routes beat the rest after correcting for multiple testing. The "precise pathways" might still matter through choices the form doesn't record (like how you react to the first dragon), but the form can't confirm them.
|
||||
* **Getting the Blue to show up is only half of it.** Only 23.1% (92/398) of Blue attempts bonded, which matches the PDF's step-by-step numbers (~25%). Dying with the "right" answer is normal.
|
||||
* **The tree shadow (→ Black) is rarer than the spreadsheet suggests.** All rows: 2.2% (24/1089), but bulk logs show 0/364 (upper 95% bound 1.0%). Plan on roughly 1 in 100 climbs at best. Once you get the Black, it bonds 86.7% (13/15) of the time.
|
||||
* **Leads worth testing (not proven):** >!Fork in the road = Forest: shadow in 3.7% (19/514) vs the rest; Attempt = First attempt: shadow in 7.0% (8/114) vs the rest!<. If you bulk-log your tree climbs *including the boring ones*, we can settle this.
|
||||
|
||||
**How to help:** log every run in the form, including the ones where nothing rare happened. Those dull runs are what make the rates trustworthy.
|
||||
|
||||
Interactive route map, full methods, and code to reproduce every number: [Threshing Route Atlas](LINK)
|
||||
|
||||
*Caveats: self-reported data, no player IDs (so runs from one person aren't independent), and the form doesn't record every in-game choice. The author has said there's a ~10% chaos roll, so nothing is guaranteed.*
|
||||
@@ -0,0 +1,119 @@
|
||||
# Repository settings
|
||||
|
||||
The Atlas is hosted on Gitea (`forge.yaml`: git.kenschiano.net). The GitHub repository and its GitHub Pages site are
|
||||
paused while that account is suspended; their workflows stay in `.github/workflows/` for when it is back.
|
||||
|
||||
## Gitea: setting up the repository (once)
|
||||
|
||||
1. **Your account** on git.kenschiano.net (ask Ken), with 2FA on and your SSH key added (Settings → SSH / GPG Keys).
|
||||
2. **Create the repository** `threshing-atlas` under your account, visibility **limited** (only people signed in to
|
||||
the server), empty (no README or licence: they come from the push). Put your username in `forge.yaml` (`repo:`),
|
||||
then `python -m collection build` and commit.
|
||||
3. **Push** from your Mac copy:
|
||||
|
||||
```
|
||||
cd ~/PycharmProjects/threshing-atlas
|
||||
git remote rename origin github # keep the GitHub address for later
|
||||
git remote add origin git@git.kenschiano.net:<you>/threshing-atlas.git
|
||||
git push -u origin main
|
||||
```
|
||||
|
||||
4. **Turn on Actions** (repository Settings → Units → Actions) and ask Ken which runner label the server has. The
|
||||
workflows use `ubuntu-latest`; change `runs-on:` in `.gitea/workflows/*.yml` if it is different.
|
||||
5. **Secrets** (Settings → Actions → Secrets):
|
||||
|
||||
| Secret | What it is | How to make it |
|
||||
|---|---|---|
|
||||
| `ATLAS_BOT_TOKEN` | lets the daily update push its branch, open the pull request and issues | your Settings → Applications → Generate token; permissions: repository read and write, issue read and write |
|
||||
| `RAW_ARCHIVE_KEY` | encrypts the private raw store kept in the Actions cache between runs | any long random string (`openssl rand -base64 32`); keep a copy |
|
||||
| `REDDIT_CLIENT_ID`, `REDDIT_CLIENT_SECRET` | optional: read the megathreads through the Reddit API | see "Data collection secrets" below |
|
||||
|
||||
6. **Protect main** (Settings → Branches → Add rule for `main`): require a pull request, enable status checks and
|
||||
require the check from the CI workflow (it shows up as `CI / test` after its first run), and allow
|
||||
"merge when checks succeed". Leave required approvals at 0 so the daily update can merge itself.
|
||||
7. **The label** for reports: `python -m collection forge ensure-label --name "run report"` (with
|
||||
`ATLAS_BOT_TOKEN` set), or create it under Issues → Labels.
|
||||
|
||||
The daily update then runs at 10:23 UTC; run it by hand from the Actions tab (workflow "Check sources for new data").
|
||||
Locally, `python -m collection refresh` does the same.
|
||||
|
||||
## The page
|
||||
|
||||
The page is built by `node site/build.js` and viewed locally or published as a Claude artifact; Gitea has no Pages.
|
||||
Its links (the repository, "Report a run") come from `forge.yaml` through `data/public/links.json`.
|
||||
|
||||
## GitHub (paused)
|
||||
|
||||
# Repository settings
|
||||
|
||||
Some settings live on GitHub, not in the code. Only the repository owner (ekcSchiano) can change them.
|
||||
They go together: the ruleset makes CI a gate on `main`, auto-merge lets a pull request merge itself once
|
||||
it passes, and the token lets the daily data update do that on its own.
|
||||
|
||||
## 1. Allow auto-merge (issue #4)
|
||||
|
||||
Settings → General → Pull Requests:
|
||||
|
||||
- tick **Allow auto-merge**
|
||||
- tick **Automatically delete head branches**
|
||||
|
||||
## 2. Require CI to pass on `main` (issue #5)
|
||||
|
||||
Settings → Rules → Rulesets → New ruleset → New branch ruleset:
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| Ruleset name | `main: CI must pass` |
|
||||
| Enforcement status | Active |
|
||||
| Bypass list | leave empty |
|
||||
| Target branches | Add target → Include default branch |
|
||||
| Restrict deletions | on |
|
||||
| Block force pushes | on |
|
||||
| Require a pull request before merging | on, required approvals **0** |
|
||||
| Require status checks to pass | on → Add checks → `test` (GitHub Actions) |
|
||||
|
||||
`test` is the job in `.github/workflows/ci.yml`. It runs the JS and Python tests, the JS/Python parity
|
||||
checks, checks that `data/public/graph.json` is up to date, and builds the site.
|
||||
|
||||
From then on every change, including ours, goes through a pull request. Nothing can be pushed straight to
|
||||
`main`. To merge without waiting, open the PR and turn on auto-merge; it merges when `test` passes.
|
||||
|
||||
## 3. Access token for automation (issue #6)
|
||||
|
||||
The daily source check (`.github/workflows/update-sources.yml`) opens a pull request when the community data
|
||||
change. If it uses the built-in `GITHUB_TOKEN`, GitHub does not start other workflows from what it does. CI
|
||||
still runs on the PR, but after the merge the site would not redeploy. With a token it opens the PR, turns on
|
||||
auto-merge, and the merge redeploys the site.
|
||||
|
||||
Create the token at github.com → Settings → Developer settings → Personal access tokens → Fine-grained tokens →
|
||||
Generate new token:
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| Token name | `threshing-atlas automation` |
|
||||
| Resource owner | ekcSchiano |
|
||||
| Expiration | 90 days, with a calendar reminder to renew |
|
||||
| Repository access | Only select repositories → `ekcSchiano/threshing-atlas` |
|
||||
| Repository permissions | **Contents: Read and write**, **Pull requests: Read and write** (Metadata: Read-only is added automatically) |
|
||||
|
||||
Then store it as a secret, never in a file, issue, chat or commit: repository Settings → Secrets and
|
||||
variables → Actions → New repository secret, name **`ATLAS_BOT_TOKEN`**.
|
||||
|
||||
Without the secret the workflow still works. It falls back to `GITHUB_TOKEN` and the PR waits for a manual
|
||||
merge.
|
||||
|
||||
If Ken's bot should also open pull requests here (for example to send new bot runs), create a **second** token
|
||||
with the same settings and store it as a secret in the bot's own repository. Separate tokens can be revoked
|
||||
separately, and a leak in one place does not expose the other.
|
||||
|
||||
## Data collection secrets (optional)
|
||||
|
||||
Both are repository secrets (Settings → Secrets and variables → Actions → New repository secret). Without them the
|
||||
daily update still runs and says in its report what it skipped.
|
||||
|
||||
| Secret | What it is for | How to make it |
|
||||
|---|---|---|
|
||||
| `RAW_ARCHIVE_KEY` | Encrypts the private raw store (current and previous raw file of each source) kept in the Actions cache between runs. | Any long random string, e.g. the output of `openssl rand -base64 32`. Keep a copy somewhere safe: without it the archive cannot be read. |
|
||||
| `REDDIT_CLIENT_ID`, `REDDIT_CLIENT_SECRET` | Reading the r/fourthwing megathreads through the official Reddit API. | reddit.com/prefs/apps → "create another app…" → type **script**, any name, redirect uri `http://localhost`. The id is under the app name; the secret is labelled "secret". |
|
||||
|
||||
The "Report a run" form adds the label `run report` to each report; the label must exist (Issues → Labels).
|
||||
@@ -0,0 +1,56 @@
|
||||
# Roadmap
|
||||
|
||||
The aim is to move from summary statistics to path finding: for each dragon colour, the decision
|
||||
policy that maximises the chance of bonding it, with honest uncertainty.
|
||||
|
||||
1. **Repo and packaging** (done): monorepo, CI, GitHub Pages, JS/Python parity tests.
|
||||
2. **Graph format** (`core/`, first version done): typed scene, chance and terminal nodes; history-context keys;
|
||||
per-source counts (bot, form, PDF, Discord); fingerprints and short labels only, no game prose.
|
||||
Importers in `collection/bot` for the bot's `knowledge.json`, `runs.jsonl` and `encounters.jsonl`
|
||||
(done), the form (done, via the crosswalk in `graph.js`), and a PDF scene crosswalk (to do).
|
||||
Daily source checks for the form, the register and the PDF (done).
|
||||
3. **Context learning** (`analysis/`): tests of history dependence (G-tests, BH); variable-order
|
||||
Markov / context tree with BIC; temporal-tiered DAG structure learning (BDeu/BIC); latent
|
||||
"character" model vs specific triggers vs memoryless baseline, compared on held-out likelihood;
|
||||
hierarchical Dirichlet back-off pooling.
|
||||
4. **Solver** (first version done: `core/solver.js`, `analysis/reports/POLICY.md`; still to do: richer history models from step 3): backward induction on the augmented state (scene, history summary), i.e. an influence
|
||||
diagram with perfect recall. Two objectives side by side per colour:
|
||||
- P(target colour on this attempt);
|
||||
- eventual success when deliberate deaths are free: maximise p_X / (p_X + p_other bond),
|
||||
solved by Dinkelbach iteration.
|
||||
Monte Carlo credible intervals, top-k routes, required steps and bottlenecks.
|
||||
5. **Valley graph UI**: every option at every point, with P(survive) and P(bond) per colour, the
|
||||
policy overlay for a chosen colour, and untested branches marked.
|
||||
6. **Bot loop** (advisor and sync published, see `docs/BOT_INTEGRATION.md`; experiments.json to do): the atlas publishes `policy.json` and `experiments.json` (ranked by value of
|
||||
information); the private DragonKind bot consumes them and returns anonymised runs.
|
||||
|
||||
## Python first, declarative rules (November 2026)
|
||||
|
||||
The repo is moving to Python, with the rules and the game written as declarative spec files. JavaScript stays
|
||||
only where it has to run: the site's drawing and interaction, and a small route advisor the site and Ken's bot
|
||||
share.
|
||||
|
||||
1. Coding rules: `core/spec/form.yaml` + `core/atlas/coding.py`, with rule tests. **Done.**
|
||||
2. Route model in Python, built from `core/spec/game.yaml`. **Done** (the bot's text, `core/spec/crosswalk.yaml`, moves with the bot importer and the JS advisor in step 4).
|
||||
3. **Done.** Fix the coding bugs found in the core review (letting the Red pass, "left your squadmates" before the
|
||||
redesigned form, missing bot text), each with a rule test.
|
||||
4. **Done.** The site shows precomputed statistics with fixed filter presets (`analysis/stats/site_stats.py`,
|
||||
`measures.yaml`, `data/public/stats.json`); the upload button and the click-to-select route map are gone; a
|
||||
small JS advisor (`core/solver.js`, about 250 lines) reads the game and the Python-built model from `policy.json`
|
||||
and replaces the 900-line JS solver; `engine.js` is gone.
|
||||
5. **Done.** `data/dictionary.yaml` describes every published file and every column of the coded runs (type, meaning,
|
||||
allowed values); `collection/etl/metadata.py` writes `data/croissant.json` (Croissant 1.0) from it, with a
|
||||
sha256 for every file. `tests/core/test_dictionary.py` fails when a column or value is undescribed or the metadata
|
||||
is stale. It also caught `attempt` being written as `1.0`, `2.0`: now a whole number.
|
||||
|
||||
## Data collection review (November 2026)
|
||||
|
||||
Collection is an extract → transform → load pipeline declared in `collection/pipeline.yaml` (`python -m collection`).
|
||||
`data/public/runs_clean.csv` holds every run from every source with a `source` column (reddit spreadsheet, reddit
|
||||
thread, reported, bot, reddit pdf). The bot importer is Python (`collection/etl/transform/bot.py`, identical output to
|
||||
the old `bot.js`), and its crosswalk is `collection/specs/bot.yaml`, written into `core/graph.js` for the bot.
|
||||
Reddit goes through the official API; "Report a run" is a GitHub issue form generated from
|
||||
`collection/specs/report_form.yaml`. Only the previous raw version is kept, encrypted, in the Actions cache.
|
||||
|
||||
Still to do: decide which non-spreadsheet sources join the statistics and the route model (`analysis/stats/measures.yaml`
|
||||
`sources`); the bot follows a strategy, so its runs need weighting rather than pooling.
|
||||
-252
@@ -1,252 +0,0 @@
|
||||
/* dragons.js — the dragon silhouettes of the valley map (traced from the pose reference sheet) and its cadets.
|
||||
* Each pose is built from simple parts (tapered tubes, a scalloped wing membrane, a head with horns, spines,
|
||||
* a spaded tail), so every dragon is drawn the same way but stands differently. Drawn facing right in a
|
||||
* 200 x 160 box; flip with scale(-1, 1). Works in the browser (window.DragonArt) and in Node. */
|
||||
(function (root, factory) {
|
||||
if (typeof module === "object" && module.exports) module.exports = factory();
|
||||
else root.DragonArt = factory();
|
||||
})(typeof self !== "undefined" ? self : this, function () {
|
||||
"use strict";
|
||||
const f = (n) => Math.round(n * 10) / 10;
|
||||
const lerp = (a, b, t) => a + (b - a) * t;
|
||||
|
||||
/** Points along a cubic Bezier given as [p0, c1, c2, p1] (each [x, y]). */
|
||||
function bez(P, n = 28) {
|
||||
const out = [];
|
||||
for (let i = 0; i <= n; i++) {
|
||||
const t = i / n, u = 1 - t;
|
||||
out.push([
|
||||
u * u * u * P[0][0] + 3 * u * u * t * P[1][0] + 3 * u * t * t * P[2][0] + t * t * t * P[3][0],
|
||||
u * u * u * P[0][1] + 3 * u * u * t * P[1][1] + 3 * u * t * t * P[2][1] + t * t * t * P[3][1],
|
||||
]);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
/** A tube along a Bezier whose half-width goes from r0 to r1 (r can also be a function of t). */
|
||||
function tube(P, r0, r1, n = 28) {
|
||||
const pts = bez(P, n), L = [], R = [];
|
||||
pts.forEach((p, i) => {
|
||||
const a = pts[Math.max(0, i - 1)], b = pts[Math.min(pts.length - 1, i + 1)];
|
||||
let dx = b[0] - a[0], dy = b[1] - a[1];
|
||||
const len = Math.hypot(dx, dy) || 1;
|
||||
dx /= len; dy /= len;
|
||||
const t = i / n, r = typeof r0 === "function" ? r0(t) : lerp(r0, r1, t);
|
||||
L.push([p[0] - dy * r, p[1] + dx * r]);
|
||||
R.push([p[0] + dy * r, p[1] - dx * r]);
|
||||
});
|
||||
const ring = L.concat(R.reverse());
|
||||
return "M" + ring.map((p) => `${f(p[0])} ${f(p[1])}`).join(" L") + " Z";
|
||||
}
|
||||
const poly = (pts) => "M" + pts.map((p) => `${f(p[0])} ${f(p[1])}`).join(" L") + " Z";
|
||||
const ell = (cx, cy, rx, ry, rot = 0) => {
|
||||
const pts = [];
|
||||
for (let i = 0; i < 36; i++) {
|
||||
const a = (i / 36) * Math.PI * 2, x = rx * Math.cos(a), y = ry * Math.sin(a), c = Math.cos(rot), s = Math.sin(rot);
|
||||
pts.push([cx + x * c - y * s, cy + x * s + y * c]);
|
||||
}
|
||||
return poly(pts);
|
||||
};
|
||||
|
||||
/**
|
||||
* Wing membrane: a leading-edge bone shoulder -> wrist -> tip, finger tips along the trailing edge, and
|
||||
* scalloped membrane between them, back to the root on the body.
|
||||
*/
|
||||
function wing({ shoulder, wrist, tip, fingers, root, bow = 0.28, bone = 4 }) {
|
||||
const d = [tube([shoulder, [lerp(shoulder[0], wrist[0], 0.4), lerp(shoulder[1], wrist[1], 0.4) - 6], [lerp(shoulder[0], wrist[0], 0.8), lerp(shoulder[1], wrist[1], 0.8)], wrist], bone, bone * 0.8),
|
||||
tube([wrist, [lerp(wrist[0], tip[0], 0.3), lerp(wrist[1], tip[1], 0.3)], [lerp(wrist[0], tip[0], 0.7), lerp(wrist[1], tip[1], 0.7)], tip], bone * 0.8, 0.8)];
|
||||
const edge = [tip].concat(fingers, [root]);
|
||||
let m = `M${f(shoulder[0])} ${f(shoulder[1])} L${f(wrist[0])} ${f(wrist[1])} L${f(tip[0])} ${f(tip[1])}`;
|
||||
for (let i = 1; i < edge.length; i++) {
|
||||
const a = edge[i - 1], b = edge[i];
|
||||
// scallop: control point pulled toward the wrist
|
||||
const mx = (a[0] + b[0]) / 2, my = (a[1] + b[1]) / 2;
|
||||
const cx = lerp(mx, wrist[0], bow), cy = lerp(my, wrist[1], bow);
|
||||
m += ` Q${f(cx)} ${f(cy)} ${f(b[0])} ${f(b[1])}`;
|
||||
}
|
||||
m += ` L${f(shoulder[0])} ${f(shoulder[1])} Z`;
|
||||
d.push(m);
|
||||
// finger bones from the wrist (thin, add texture at the edge)
|
||||
fingers.forEach((p) => d.push(tube([wrist, [lerp(wrist[0], p[0], 0.33), lerp(wrist[1], p[1], 0.33)], [lerp(wrist[0], p[0], 0.66), lerp(wrist[1], p[1], 0.66)], p], 1.6, 0.6, 10)));
|
||||
return d;
|
||||
}
|
||||
|
||||
/** Head pointing along `ang` (radians, 0 = right) from the neck end, with horns and an open or closed jaw. */
|
||||
function head({ at, ang = 0, size = 1, open = 0, horns = 2 }) {
|
||||
const c = Math.cos(ang), s = Math.sin(ang);
|
||||
const T = (x, y) => [at[0] + (x * c - y * s) * size, at[1] + (x * s + y * c) * size];
|
||||
const d = [];
|
||||
// skull and upper snout
|
||||
d.push(poly([T(-8, 2), T(-6, -9), T(4, -12), T(14, -8), T(26, -5), T(31, -2), T(30, 1), T(18, 2 + open * 0.3), T(8, 6)]));
|
||||
// jaw (drops when open)
|
||||
d.push(poly([T(-6, 3), T(10, 4), T(28, 3 + open), T(26, 6 + open), T(12, 10 + open * 0.4), T(-4, 9)]));
|
||||
// horns sweeping back
|
||||
for (let i = 0; i < horns; i++) {
|
||||
const y0 = -9 + i * 4, len = 18 - i * 6;
|
||||
d.push(tube([T(2 - i * 3, y0), T(-6 - i * 2, y0 - 6), T(-14 - i * 3, y0 - 8 - i), T(-12 - len * 0.6 - i * 3, y0 - 14 + i * 3)], 2.6 * size - i * 0.4, 0.4, 10));
|
||||
}
|
||||
// brow spike and cheek frill
|
||||
d.push(poly([T(-4, 4), T(-14, 8), T(-5, 8)]));
|
||||
return { d, eye: T(8, -5), eyeR: 1.9 * size };
|
||||
}
|
||||
|
||||
/** Small triangular spines along a list of points (pointing away from `side` normal). */
|
||||
function spines(pts, size, side = -1, every = 2) {
|
||||
const d = [];
|
||||
for (let i = 1; i < pts.length - 1; i += every) {
|
||||
const a = pts[i - 1], b = pts[i + 1], p = pts[i];
|
||||
let dx = b[0] - a[0], dy = b[1] - a[1];
|
||||
const len = Math.hypot(dx, dy) || 1;
|
||||
dx /= len; dy /= len;
|
||||
const nx = -dy * side, ny = dx * side, k = typeof size === "function" ? size(i / pts.length) : size;
|
||||
d.push(poly([[p[0] - dx * k * 0.6, p[1] - dy * k * 0.6], [p[0] + nx * k * 1.5 - dx * k * 0.5, p[1] + ny * k * 1.5 - dy * k * 0.5], [p[0] + dx * k * 0.6, p[1] + dy * k * 0.6]]));
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
/** Tail as a tapering tube ending in a spade. */
|
||||
function tail(P, r0) {
|
||||
const d = [tube(P, (t) => Math.max(0.9, r0 * (1 - t) ** 1.1), null, 36)];
|
||||
const pts = bez(P, 36), a = pts[pts.length - 3], b = pts[pts.length - 1];
|
||||
let dx = b[0] - a[0], dy = b[1] - a[1];
|
||||
const len = Math.hypot(dx, dy) || 1;
|
||||
dx /= len; dy /= len;
|
||||
const nx = -dy, ny = dx, k = Math.max(4, r0 * 0.9);
|
||||
d.push(poly([[b[0] - dx * k * 0.6, b[1] - dy * k * 0.6], [b[0] + nx * k, b[1] + ny * k], [b[0] + dx * k * 1.6, b[1] + dy * k * 1.6], [b[0] - nx * k, b[1] - ny * k]]));
|
||||
return { d, pts };
|
||||
}
|
||||
/** Leg: hip -> knee -> foot with three claws. */
|
||||
function leg(hip, knee, foot, r, toe = 1) {
|
||||
const d = [tube([hip, [lerp(hip[0], knee[0], 0.6), lerp(hip[1], knee[1], 0.6)], knee, [lerp(knee[0], foot[0], 0.5), lerp(knee[1], foot[1], 0.5)]], r, r * 0.6, 14),
|
||||
tube([[lerp(knee[0], foot[0], 0.4), lerp(knee[1], foot[1], 0.4)], [lerp(knee[0], foot[0], 0.6), lerp(knee[1], foot[1], 0.6)], [lerp(knee[0], foot[0], 0.85), lerp(knee[1], foot[1], 0.85)], foot], r * 0.6, r * 0.45, 10)];
|
||||
for (let i = -1; i <= 1; i++) d.push(poly([[foot[0] - 2, foot[1] - 2], [foot[0] + toe * (6 + i * 1.5), foot[1] + 1 + i * 2.2], [foot[0] + 1, foot[1] + 2.5]]));
|
||||
return d;
|
||||
}
|
||||
|
||||
/* ---------- poses ---------- */
|
||||
|
||||
/* Six silhouettes traced from the project's pose reference sheet (all facing right, in the 200 x 160 box;
|
||||
* flying and diving poses centred, the others standing on the bottom edge), each with the sheet's interior lines
|
||||
* (wing ribs, folds, the rock's edges) drawn over the colour, for depth; gaps the sheet leaves open (between the
|
||||
* perched dragon's legs and the rock, under the sleeping one's wing) are holes. Names keep the old
|
||||
* pose keys: coiled is the diving dragon, resting the sleeping one, sitting the one perched on a rock. */
|
||||
const TRACED = {
|
||||
"flying": {
|
||||
"body": "M6.0 55.5 L6.0 56.9 L6.7 56.9 L7.4 55.5 L10.0 53.1 L14.0 51.5 L16.8 51.0 L22.3 51.3 L28.4 52.7 L31.2 54.1 L32.9 55.7 L34.0 59.5 L33.8 62.3 L31.0 68.0 L30.7 69.9 L31.4 69.9 L32.9 67.7 L36.2 65.4 L41.1 63.7 L48.2 63.7 L56.2 65.9 L60.9 68.7 L63.2 71.0 L64.7 74.1 L64.4 76.5 L63.5 78.8 L61.6 81.2 L61.6 81.9 L62.5 81.9 L65.6 79.5 L68.7 77.9 L73.6 76.5 L77.9 76.5 L80.9 77.4 L83.7 79.3 L84.0 80.7 L84.7 80.7 L87.0 79.1 L89.9 78.4 L94.3 78.4 L96.2 79.1 L95.8 80.2 L93.2 82.6 L89.2 83.3 L89.2 83.8 L89.9 84.2 L89.4 84.7 L84.5 85.4 L84.5 85.9 L84.9 85.9 L85.4 86.4 L80.9 87.3 L80.7 88.0 L81.9 88.2 L81.4 88.7 L78.1 89.0 L77.1 89.4 L76.9 90.4 L73.8 90.6 L73.8 91.8 L68.7 92.0 L68.7 92.7 L69.6 93.0 L69.4 93.4 L66.1 93.4 L65.8 94.1 L62.3 93.9 L62.1 95.1 L58.8 94.8 L58.5 96.0 L55.2 95.5 L54.8 96.5 L51.0 96.5 L50.8 97.4 L45.8 97.4 L45.3 97.7 L45.8 98.6 L40.4 99.8 L39.5 101.0 L35.0 102.6 L34.5 103.1 L35.0 104.0 L32.4 106.2 L30.0 110.6 L30.0 113.5 L31.2 117.5 L31.0 120.1 L31.9 120.1 L32.6 118.4 L33.8 112.5 L34.3 112.3 L34.7 112.7 L35.7 112.7 L35.2 110.6 L35.2 108.0 L35.7 107.1 L38.0 105.0 L41.6 103.1 L46.3 101.7 L52.6 100.5 L62.5 99.6 L70.1 98.4 L77.9 96.5 L84.5 94.4 L84.7 94.6 L82.8 96.3 L81.6 96.5 L80.7 98.4 L80.7 99.3 L81.6 100.5 L83.5 100.7 L86.1 99.3 L92.5 92.7 L93.6 92.3 L97.4 92.0 L100.9 90.1 L100.9 91.1 L96.2 94.1 L94.3 94.1 L91.0 98.4 L88.9 100.0 L88.0 100.0 L87.5 100.5 L87.5 102.9 L88.5 103.6 L90.6 103.6 L93.2 101.7 L96.5 97.4 L99.1 96.5 L102.8 96.3 L105.2 95.3 L108.2 92.5 L109.4 90.6 L109.9 89.0 L110.6 88.2 L113.7 87.3 L117.7 84.7 L122.4 85.4 L124.5 86.1 L126.9 87.5 L128.3 89.9 L127.1 93.4 L128.3 93.2 L130.6 91.1 L134.9 88.5 L139.6 86.6 L144.5 86.4 L147.6 87.3 L149.5 88.5 L152.3 91.5 L153.5 94.8 L153.5 97.4 L153.9 97.4 L156.5 92.7 L159.4 90.1 L162.0 88.7 L167.4 87.3 L173.5 87.5 L182.9 90.4 L186.9 92.5 L189.1 94.1 L191.6 97.2 L192.6 99.3 L192.6 101.9 L193.1 101.9 L193.8 100.7 L193.8 97.2 L190.9 90.6 L188.6 86.8 L183.2 80.2 L181.0 78.1 L169.7 72.5 L163.8 70.3 L158.4 68.9 L158.0 68.2 L159.1 67.0 L161.0 66.3 L160.8 65.6 L158.2 65.9 L156.3 66.8 L153.7 69.2 L150.4 71.3 L141.7 74.8 L136.5 75.3 L132.0 76.5 L122.6 76.2 L122.4 75.8 L124.7 73.4 L126.9 72.0 L129.2 71.0 L130.6 71.0 L130.9 71.8 L131.8 72.0 L135.1 71.5 L135.8 72.2 L136.5 72.2 L137.0 71.0 L138.2 71.0 L139.3 71.5 L139.6 72.2 L140.8 72.2 L141.9 71.3 L142.2 69.4 L141.2 68.0 L139.1 67.5 L137.5 65.9 L136.3 65.4 L134.6 64.0 L127.3 61.2 L124.7 59.5 L123.8 59.5 L123.8 60.0 L127.1 64.2 L126.9 64.7 L124.7 64.2 L124.7 65.4 L121.0 65.2 L118.8 65.6 L118.8 66.1 L121.2 66.1 L121.4 66.6 L121.0 67.0 L118.1 67.0 L115.8 67.7 L115.8 68.2 L117.4 68.2 L117.7 68.7 L117.2 69.2 L113.2 69.4 L113.0 70.3 L111.3 70.6 L111.1 71.0 L106.4 69.2 L98.4 64.9 L95.8 64.0 L93.9 62.3 L92.5 59.5 L91.3 55.5 L90.8 49.8 L89.4 47.5 L88.0 46.1 L85.9 44.9 L85.2 44.9 L85.2 45.6 L87.3 47.7 L88.0 49.4 L87.7 50.6 L74.6 45.8 L63.2 42.8 L58.1 40.9 L55.9 39.7 L53.1 39.7 L52.9 40.2 L43.9 40.9 L32.2 42.8 L18.3 46.8 L9.3 51.3 L7.2 53.4 Z",
|
||||
"lines": "M37.8 102.4 L36.9 102.4 L35.9 102.9 L35.4 104.5 L35.9 104.5 L37.6 103.3 Z M40.2 101.2 L42.5 100.7 L42.5 100.3 L40.9 100.3 L40.2 100.7 Z M46.3 99.3 L48.9 98.8 L48.9 98.1 L46.5 97.9 Z M193.1 97.7 L193.1 100.3 L193.5 100.3 L193.5 97.7 Z M81.6 97.7 L81.6 98.8 L82.3 98.8 L83.0 98.4 L83.0 97.9 Z M51.5 97.4 L51.5 97.9 L53.4 97.9 L53.4 97.2 L52.9 97.0 L51.9 97.0 Z M55.5 97.2 L57.1 97.0 L57.1 96.3 L55.7 96.0 Z M59.2 96.5 L60.9 96.3 L60.9 95.5 L59.5 95.3 Z M62.8 94.4 L62.8 95.8 L64.7 95.3 L64.7 94.8 Z M88.0 92.5 L84.7 93.4 L84.7 93.9 L85.6 94.1 L85.2 94.4 L85.2 95.1 L86.6 94.6 L88.0 93.2 Z M70.1 92.5 L70.1 93.7 L71.0 93.7 L71.7 93.2 L71.7 92.7 L71.3 92.5 Z M74.6 91.1 L74.6 92.3 L76.2 91.8 L76.2 91.1 Z M80.0 89.4 L77.9 89.7 L77.6 90.8 L80.0 90.1 Z M102.6 88.7 L101.6 88.7 L100.9 89.2 L100.9 89.7 L101.6 89.9 L101.6 90.8 L102.1 90.8 Z M82.3 89.0 L83.7 88.5 L84.0 87.8 L82.6 87.5 Z M85.9 85.7 L85.9 87.1 L87.5 86.4 L87.5 85.7 Z M90.3 83.8 L90.3 84.9 L91.8 84.5 L91.8 83.8 Z M110.8 71.5 L110.8 72.0 L111.5 72.2 L113.2 72.0 L113.0 71.0 L111.8 71.0 L111.5 71.5 Z M130.9 70.1 L131.3 71.3 L132.7 71.0 L132.7 70.6 Z M113.7 71.0 L115.1 71.3 L116.3 70.6 L116.3 69.9 L114.6 69.6 L114.6 70.1 L115.1 70.3 L113.7 70.6 Z M118.1 67.7 L118.1 69.2 L118.8 69.2 L119.6 68.7 L119.3 68.0 Z M121.9 65.6 L121.9 67.0 L123.8 66.8 L123.8 66.1 Z M125.9 61.4 L125.9 61.9 L127.8 63.7 L127.1 65.6 L125.7 64.9 L125.4 66.1 L127.1 66.1 L127.3 65.6 L129.4 65.9 L129.7 64.9 L130.4 65.4 L132.7 65.6 L132.5 64.5 L131.3 63.5 L127.3 61.6 Z M128.7 63.5 L129.2 63.3 L131.1 64.5 L130.6 64.7 Z M53.6 39.7 L53.6 40.7 L55.5 40.4 L55.2 39.7 Z"
|
||||
},
|
||||
"prowling": {
|
||||
"body": "M193.7 72.8 L191.0 69.2 L189.0 69.8 L187.0 68.8 L185.3 66.8 L182.0 64.5 L180.0 64.5 L174.7 61.5 L170.7 57.5 L170.0 57.8 L170.0 58.8 L173.0 63.2 L172.7 64.2 L168.0 62.2 L164.7 59.8 L163.1 57.5 L162.1 57.5 L162.1 59.5 L163.4 61.8 L167.7 66.2 L166.7 66.8 L159.7 66.8 L159.7 67.8 L162.1 68.2 L162.4 68.8 L157.1 70.1 L155.4 71.1 L155.4 72.1 L158.7 71.8 L159.1 72.5 L155.1 74.8 L152.7 77.1 L153.1 78.1 L156.1 76.8 L156.4 77.1 L153.4 81.5 L152.7 84.8 L153.7 84.8 L155.7 82.5 L156.4 82.8 L155.4 85.1 L155.1 89.4 L156.1 89.8 L157.4 87.5 L158.1 87.8 L157.7 91.8 L157.1 92.1 L151.1 89.4 L150.1 89.4 L150.1 90.1 L149.4 90.4 L145.1 88.8 L144.1 89.1 L144.1 89.8 L144.8 90.1 L144.4 90.8 L136.1 86.5 L131.8 81.8 L130.1 78.1 L130.1 75.5 L132.4 71.1 L135.1 68.5 L137.8 69.2 L139.8 70.8 L139.8 71.5 L140.8 71.5 L140.8 69.2 L138.1 66.5 L124.8 61.2 L117.1 59.5 L113.1 59.5 L113.5 60.5 L116.8 61.2 L117.5 61.8 L95.5 62.2 L82.9 64.2 L74.2 66.8 L62.6 71.5 L53.2 76.1 L42.6 82.8 L29.3 93.1 L22.3 100.1 L19.0 104.4 L18.0 108.4 L19.0 108.4 L20.6 106.1 L24.6 102.4 L31.3 98.1 L39.6 94.4 L49.6 91.8 L53.2 91.8 L54.2 93.1 L54.2 94.4 L52.6 98.8 L47.6 105.8 L46.3 109.1 L47.3 109.1 L52.6 104.4 L58.2 101.1 L64.9 98.4 L70.2 97.4 L77.9 97.8 L83.9 100.1 L87.5 103.8 L89.5 108.7 L89.2 114.7 L90.2 114.7 L91.8 111.4 L95.2 108.1 L98.2 106.1 L101.5 104.8 L108.2 104.1 L113.1 105.4 L113.8 106.8 L109.5 108.4 L109.2 109.7 L107.5 109.7 L105.2 110.7 L105.2 111.4 L107.2 111.4 L107.2 112.4 L100.2 114.1 L99.8 115.1 L101.8 115.7 L101.2 116.4 L94.8 117.7 L94.5 118.7 L96.5 118.7 L96.5 119.7 L89.2 120.4 L89.5 121.4 L91.2 122.1 L90.5 122.7 L83.9 121.7 L83.5 122.7 L85.2 124.1 L84.9 124.4 L83.2 124.4 L78.2 122.7 L78.2 123.7 L79.2 124.7 L78.5 125.4 L74.5 123.1 L73.5 123.1 L74.2 125.1 L72.9 125.4 L69.2 122.7 L67.9 122.7 L68.9 124.7 L68.2 125.4 L63.9 122.4 L62.9 122.4 L62.9 124.7 L57.9 121.4 L57.2 121.4 L57.2 122.4 L57.9 123.1 L56.6 123.4 L51.6 120.1 L50.3 120.1 L50.6 121.7 L49.9 122.1 L43.6 119.4 L41.9 119.4 L41.9 121.1 L36.9 119.7 L33.3 119.7 L34.0 121.1 L33.6 121.4 L28.0 121.1 L27.6 122.4 L22.0 122.7 L22.0 124.1 L21.3 124.7 L19.0 124.7 L14.7 126.4 L14.7 127.4 L15.3 127.7 L15.0 128.4 L11.0 130.0 L6.0 134.4 L6.0 135.7 L8.3 134.4 L8.7 134.7 L7.0 137.7 L6.7 142.7 L7.7 143.0 L9.0 147.3 L12.0 151.0 L13.7 151.3 L13.0 149.7 L14.0 149.3 L19.3 153.7 L21.3 153.7 L21.6 152.7 L24.0 153.7 L27.0 153.7 L27.6 151.7 L29.6 151.3 L35.9 148.3 L38.9 146.0 L38.9 145.0 L36.9 145.3 L32.0 147.7 L27.6 148.7 L24.3 148.7 L24.0 148.0 L25.0 146.3 L21.6 147.0 L17.6 146.7 L15.6 145.7 L14.0 144.0 L13.0 142.0 L13.0 139.0 L14.7 136.0 L19.3 132.0 L25.6 129.0 L34.9 127.0 L43.3 127.0 L52.3 128.7 L67.6 132.7 L81.5 133.4 L89.2 132.4 L94.2 131.0 L105.2 127.0 L116.5 122.1 L116.5 124.1 L114.1 124.4 L109.8 128.0 L105.8 129.4 L102.2 140.0 L101.2 141.4 L100.2 141.4 L98.5 142.7 L97.8 144.0 L98.2 145.7 L99.8 144.7 L102.2 144.7 L103.5 145.7 L107.2 145.7 L109.2 145.0 L112.1 145.7 L112.5 144.7 L113.5 144.7 L114.8 146.3 L115.8 146.3 L116.1 144.0 L115.1 142.0 L113.5 140.4 L109.2 140.0 L108.5 139.4 L109.5 136.4 L111.5 134.0 L123.1 131.4 L125.1 130.4 L128.8 126.7 L129.1 127.0 L128.1 128.7 L123.5 132.7 L123.8 135.4 L129.8 141.7 L128.1 143.4 L127.8 145.3 L129.8 145.0 L134.4 146.0 L139.1 145.7 L139.8 146.3 L141.8 145.7 L142.4 147.3 L143.4 147.3 L143.8 144.0 L140.8 141.0 L137.4 141.0 L135.4 140.0 L132.1 136.0 L131.8 134.4 L138.1 130.7 L140.1 128.7 L143.4 122.1 L147.7 122.1 L148.1 122.7 L147.4 124.1 L148.4 125.1 L148.1 127.0 L153.4 135.7 L155.1 140.4 L154.7 143.0 L151.7 145.7 L151.4 148.0 L156.7 147.0 L159.4 148.3 L162.7 148.0 L164.1 149.0 L164.1 149.7 L165.4 149.7 L165.7 147.0 L167.4 147.0 L168.4 148.3 L169.4 148.3 L169.7 146.7 L169.0 144.7 L167.7 143.0 L166.4 142.4 L162.4 142.0 L160.7 140.0 L159.7 137.7 L157.7 125.1 L161.4 121.7 L161.7 124.4 L160.7 126.4 L160.7 127.7 L161.7 128.0 L161.7 130.0 L162.7 130.7 L163.7 132.7 L170.0 140.7 L171.4 143.7 L171.0 147.3 L174.4 146.7 L175.0 147.3 L178.7 147.3 L179.7 148.3 L180.7 148.3 L181.4 147.0 L183.0 147.7 L183.0 147.0 L183.7 146.7 L184.4 148.0 L185.3 148.0 L185.3 145.3 L183.4 142.7 L182.0 142.0 L178.0 142.0 L175.4 139.7 L172.7 134.7 L169.7 125.4 L171.0 122.1 L174.0 117.4 L174.4 113.7 L175.0 113.1 L176.0 113.1 L178.4 108.7 L178.7 105.4 L179.0 105.1 L179.7 106.4 L180.7 106.4 L181.0 101.4 L179.7 99.1 L180.0 98.4 L181.0 98.4 L181.0 96.8 L179.0 93.8 L179.0 91.8 L176.7 89.4 L176.7 87.8 L173.4 84.8 L174.0 84.1 L174.0 83.1 L173.0 82.1 L173.0 78.1 L174.0 77.5 L174.7 79.1 L176.7 79.5 L179.7 78.1 L182.7 77.8 L185.3 78.5 L188.0 80.1 L189.0 80.1 L189.3 80.8 L190.7 80.8 L191.3 77.1 L193.0 77.1 L193.7 76.5 Z",
|
||||
"lines": "M24.0 151.3 L24.0 152.0 L24.6 152.3 L24.6 153.3 L26.3 153.3 L26.6 151.3 Z M19.3 151.0 L19.0 152.0 L20.0 152.7 L20.0 153.7 L20.6 153.7 L21.0 151.3 Z M21.0 148.3 L21.0 149.0 L21.6 149.3 L23.3 149.3 L23.3 147.7 L22.0 147.7 Z M11.3 146.7 L11.7 149.3 L12.3 149.3 L12.7 148.7 L14.0 148.7 L14.0 148.0 Z M8.7 139.0 L8.0 139.0 L7.3 140.4 L7.3 142.0 L8.7 142.0 L9.0 140.0 Z M11.7 132.0 L10.7 132.0 L8.7 133.0 L8.7 133.7 L9.7 134.0 L9.3 135.0 L10.0 135.0 L11.7 133.0 Z M19.0 126.4 L16.3 126.7 L16.0 128.4 L18.3 127.7 Z M79.9 124.4 L79.9 126.0 L81.5 126.0 L81.5 125.4 L80.5 124.4 Z M63.9 124.1 L63.9 125.7 L65.2 126.0 L65.6 125.7 L65.2 124.4 Z M85.9 123.4 L85.9 125.1 L87.5 124.7 L86.9 123.4 Z M57.6 124.1 L57.6 124.7 L58.9 125.1 L59.9 124.7 L59.2 123.4 Z M22.6 125.1 L25.3 124.4 L25.3 123.7 L23.0 123.4 Z M28.6 121.7 L28.6 123.4 L31.0 123.1 L31.0 122.1 Z M132.1 121.4 L131.4 121.4 L128.1 125.4 L128.1 126.0 L129.4 125.7 L129.8 126.7 L130.8 126.4 L130.8 124.4 L132.1 122.4 Z M91.8 121.4 L91.8 123.1 L93.5 122.4 L93.5 121.4 Z M51.3 121.4 L51.3 123.1 L52.9 123.4 L52.9 122.4 L52.3 121.4 Z M42.9 120.4 L42.9 122.1 L44.9 122.1 L44.6 120.7 Z M34.6 120.4 L34.6 122.1 L37.3 122.1 L37.3 121.1 L35.9 120.4 Z M97.5 118.4 L97.5 120.1 L99.2 119.4 L99.2 118.4 Z M153.7 115.1 L153.1 115.1 L152.1 116.1 L150.4 119.7 L148.7 121.1 L148.7 123.1 L149.4 123.1 L150.4 122.1 L152.4 117.7 L153.7 116.1 Z M102.5 114.4 L102.5 116.4 L103.5 116.4 L104.8 115.4 L104.8 114.7 L104.2 114.4 Z M108.2 110.7 L108.2 112.4 L109.8 112.1 L109.8 111.1 Z M176.0 110.1 L175.0 110.1 L174.4 112.4 L175.4 112.4 Z M114.1 108.4 L112.8 108.1 L111.5 108.7 L110.8 109.7 L110.1 109.7 L110.1 110.4 L113.1 110.1 L114.1 109.1 Z M176.7 106.1 L176.7 108.7 L177.4 108.7 L177.7 106.1 Z M177.7 101.8 L178.0 104.4 L180.0 104.4 L179.7 102.8 L178.7 101.8 Z M136.1 100.1 L132.1 100.1 L124.8 101.4 L123.1 103.1 L119.8 103.4 L119.1 104.8 L115.5 105.8 L114.5 105.4 L114.5 107.7 L115.5 108.1 L118.1 107.4 L118.5 106.4 L120.8 106.1 L122.8 105.1 L123.5 103.8 L127.8 103.4 L129.1 102.8 L128.8 101.8 L129.1 101.4 L133.1 101.8 L134.4 101.1 L136.1 101.1 Z M177.7 96.1 L178.4 98.8 L179.0 98.8 L179.0 98.1 L180.0 97.8 L180.0 97.1 L178.7 96.1 Z M176.0 91.1 L176.0 92.1 L177.7 94.1 L178.4 94.1 L178.4 92.8 L177.4 91.4 Z M149.7 91.1 L149.7 91.8 L152.7 93.4 L153.7 93.1 L153.7 92.4 L152.1 90.8 L151.4 90.8 L151.1 91.4 Z M145.8 90.1 L146.1 91.1 L145.1 91.4 L145.1 92.1 L147.4 93.1 L149.1 93.1 L149.1 92.4 L146.8 90.1 Z M154.7 92.1 L154.7 92.8 L157.1 94.4 L158.1 94.4 L158.7 93.8 L160.4 95.1 L161.1 95.1 L161.7 94.1 L161.7 92.1 L160.7 91.4 L160.4 89.4 L159.4 89.4 L158.4 90.4 L158.4 91.4 L159.4 91.1 L160.1 92.4 L159.4 93.1 L158.1 92.8 L157.7 93.4 Z M173.7 87.1 L173.7 88.1 L175.4 89.8 L176.0 89.8 L176.0 88.8 L174.7 87.1 Z M171.4 79.5 L171.4 81.8 L172.4 82.1 L172.0 79.5 Z M174.4 76.1 L175.4 78.5 L176.7 78.5 L177.4 77.8 L177.4 77.1 L176.4 77.1 L175.7 76.1 Z M184.0 73.8 L184.7 75.1 L188.3 76.8 L189.3 76.8 L190.0 77.5 L190.7 77.5 L191.0 76.1 L192.0 76.1 L191.7 75.1 L190.0 75.1 L189.0 74.5 L186.0 73.8 Z M192.7 73.5 L192.7 75.8 L193.7 75.8 L193.7 73.5 Z M161.1 71.1 L159.7 71.1 L159.7 73.1 L161.1 72.5 Z M163.1 67.8 L163.1 70.1 L165.4 69.5 L165.4 68.5 Z M128.8 67.8 L127.1 67.8 L120.8 70.8 L111.8 77.8 L104.2 86.1 L99.2 93.1 L97.8 96.4 L98.5 96.4 L105.5 86.5 L114.5 77.1 L121.5 71.8 L125.8 69.5 L128.8 68.5 Z M127.5 65.8 L121.1 66.2 L112.8 67.8 L101.8 71.1 L95.2 73.8 L87.2 77.8 L79.5 82.5 L68.2 90.8 L67.6 92.1 L68.2 92.1 L82.9 81.8 L94.5 75.5 L108.5 70.1 L119.5 67.5 L127.5 66.5 Z M180.0 65.2 L180.0 65.8 L181.0 66.5 L182.7 66.8 L182.7 66.2 L181.4 65.2 Z M166.7 67.5 L166.7 68.2 L167.7 68.5 L169.4 68.2 L169.7 67.5 L172.7 68.2 L172.7 67.2 L169.0 65.2 L168.4 65.2 L168.7 67.2 Z M173.7 63.2 L174.0 64.2 L173.7 65.5 L176.7 66.2 L176.7 65.2 L174.7 63.2 Z M118.1 60.8 L118.5 61.8 L118.1 63.2 L124.5 63.8 L124.5 62.8 L119.5 60.8 Z"
|
||||
},
|
||||
"roaring": {
|
||||
"body": "M8.5 59.6 L6.0 63.9 L6.0 66.1 L7.1 66.1 L8.5 63.6 L14.9 57.5 L24.6 51.8 L27.4 51.1 L32.8 51.4 L36.4 53.2 L38.5 55.4 L40.7 60.4 L40.7 66.4 L38.2 76.1 L36.0 81.4 L34.6 90.4 L36.0 90.4 L36.4 88.2 L38.9 83.9 L46.7 76.1 L56.0 69.7 L62.8 66.8 L66.4 67.1 L68.2 68.9 L68.5 70.4 L68.2 73.9 L63.9 85.0 L63.2 88.6 L64.3 88.6 L67.5 84.7 L71.4 82.2 L75.0 81.1 L79.3 81.8 L83.6 85.4 L85.0 87.9 L86.8 94.0 L87.1 100.4 L88.2 100.0 L90.0 96.1 L93.6 92.2 L96.4 90.0 L101.1 87.9 L106.1 86.8 L111.1 87.5 L112.9 88.6 L113.2 91.5 L120.7 87.9 L121.4 88.2 L120.4 89.7 L117.2 90.7 L116.1 92.5 L111.1 94.3 L108.9 95.7 L108.9 96.5 L112.5 96.5 L106.4 99.7 L106.4 100.7 L108.9 101.1 L103.6 104.3 L103.6 105.4 L105.4 105.0 L105.7 106.1 L102.1 108.3 L100.7 110.0 L100.7 111.1 L102.5 110.8 L102.9 111.5 L97.1 114.3 L97.1 115.0 L98.9 115.4 L98.6 116.1 L92.1 117.2 L92.1 118.3 L93.9 119.0 L92.9 120.0 L86.4 119.0 L86.1 120.0 L87.8 121.5 L86.4 121.8 L81.8 119.3 L80.3 119.3 L80.3 120.4 L81.4 121.5 L81.1 122.2 L75.0 117.9 L73.9 117.9 L75.3 120.4 L75.0 121.1 L67.1 116.8 L66.0 117.2 L66.0 117.9 L66.8 118.3 L66.4 119.0 L61.4 117.2 L55.3 117.2 L55.0 118.6 L49.6 119.0 L43.5 120.8 L36.4 125.0 L33.2 129.3 L33.2 130.4 L33.9 130.8 L32.8 134.3 L33.5 140.4 L34.6 140.4 L35.0 139.0 L37.1 143.3 L41.0 147.6 L44.2 149.7 L48.5 151.5 L50.7 151.5 L51.0 150.1 L54.6 150.4 L58.9 149.7 L60.7 149.0 L60.7 147.9 L53.9 147.9 L50.0 146.9 L47.8 145.4 L48.5 144.7 L48.2 143.3 L42.8 141.8 L40.0 139.0 L38.5 135.1 L38.9 132.2 L41.4 128.3 L46.7 125.0 L54.6 123.6 L59.6 124.0 L67.5 126.1 L80.0 131.1 L86.1 132.2 L90.3 132.2 L96.4 131.1 L101.8 129.3 L113.9 121.8 L117.2 124.3 L117.2 125.8 L115.4 129.3 L112.5 132.6 L112.5 135.1 L118.2 140.4 L118.6 141.8 L117.9 144.3 L121.8 144.3 L123.6 146.5 L122.9 149.0 L123.2 150.8 L124.7 150.8 L127.5 149.4 L131.1 150.4 L134.3 149.7 L135.7 151.1 L136.1 153.6 L137.5 153.6 L138.2 151.9 L138.2 148.3 L139.3 148.3 L141.1 151.1 L142.2 151.1 L142.5 150.4 L142.2 147.2 L140.4 144.7 L136.8 142.9 L131.8 143.3 L129.0 142.2 L122.9 136.5 L121.4 134.0 L128.2 127.9 L130.0 123.6 L131.1 123.3 L133.6 120.4 L140.0 115.0 L140.7 113.3 L140.7 110.8 L138.2 105.0 L144.7 101.1 L146.1 101.8 L147.2 104.7 L148.3 105.7 L152.2 105.7 L158.6 104.0 L162.2 103.6 L165.4 106.1 L165.4 109.3 L164.3 110.0 L164.7 111.5 L167.2 111.5 L169.0 109.7 L169.7 109.7 L170.8 111.8 L170.1 114.7 L171.8 114.7 L172.9 114.0 L174.3 111.1 L175.1 111.8 L175.1 114.7 L175.8 114.7 L177.6 112.5 L177.6 110.0 L176.8 107.9 L174.7 105.4 L165.8 99.0 L154.7 97.2 L154.3 96.5 L158.3 91.8 L160.4 91.8 L162.9 92.9 L166.1 92.5 L169.7 89.0 L173.6 82.5 L176.5 79.3 L181.8 77.5 L184.3 77.5 L185.8 79.7 L185.1 81.8 L187.2 81.8 L188.3 81.1 L189.4 78.9 L190.4 79.7 L190.4 81.1 L191.9 81.1 L192.6 79.3 L192.2 77.2 L190.1 74.3 L190.8 73.9 L192.6 75.7 L193.6 75.7 L193.6 73.2 L191.9 71.1 L190.1 70.4 L184.0 70.0 L178.6 72.9 L172.6 74.3 L168.3 78.9 L163.3 82.2 L161.8 81.4 L161.8 77.2 L160.0 71.8 L153.3 63.2 L152.9 58.2 L154.0 57.5 L154.3 54.3 L156.1 53.9 L157.2 51.8 L159.7 49.6 L160.8 50.0 L160.4 52.1 L161.1 52.1 L162.9 50.3 L164.7 50.7 L166.5 50.0 L169.0 50.0 L173.3 51.4 L175.1 52.9 L175.1 53.9 L175.8 54.3 L179.0 53.9 L180.4 52.1 L180.1 50.0 L179.3 48.9 L177.6 48.9 L177.2 47.5 L175.8 47.5 L173.6 45.7 L173.3 42.5 L175.1 41.1 L179.3 40.3 L181.1 40.7 L181.5 39.6 L182.6 39.6 L183.3 38.9 L183.3 36.1 L181.8 34.6 L177.9 33.9 L174.7 35.0 L171.8 35.0 L170.8 34.3 L166.8 33.9 L162.2 31.0 L161.1 31.0 L161.5 32.8 L162.9 34.3 L162.5 35.0 L158.6 33.2 L155.8 30.3 L154.7 30.3 L154.7 31.4 L156.1 33.6 L155.8 34.3 L151.5 34.3 L148.6 35.7 L148.6 37.5 L144.7 37.8 L140.7 39.3 L140.4 40.3 L146.8 40.3 L146.1 41.1 L138.6 43.2 L135.4 45.3 L135.4 46.4 L139.0 45.3 L140.7 45.7 L134.7 49.3 L131.8 52.1 L131.8 52.9 L133.2 52.9 L136.5 51.1 L136.8 51.4 L132.2 56.8 L130.7 59.6 L130.7 60.7 L131.8 60.7 L134.0 58.2 L134.7 58.6 L131.8 63.9 L131.8 66.1 L132.5 66.1 L134.0 64.3 L134.7 64.6 L134.3 67.9 L133.2 68.2 L127.9 66.1 L126.8 66.1 L126.8 67.5 L125.7 67.9 L121.4 65.4 L113.2 57.9 L116.1 47.8 L122.2 36.1 L122.5 30.7 L121.1 27.1 L116.1 21.8 L115.4 21.8 L115.4 23.5 L118.6 28.2 L118.6 30.0 L108.9 25.0 L97.5 21.4 L90.7 18.5 L85.7 18.9 L85.7 20.0 L90.7 21.4 L91.1 22.1 L90.3 22.8 L77.1 24.3 L64.6 26.4 L56.4 28.5 L44.6 32.8 L36.4 37.1 L23.2 45.7 L14.6 52.9 Z M149.0 37.1 L149.7 36.4 L153.6 36.4 L156.1 37.5 L152.2 37.8 Z",
|
||||
"lines": "M46.4 148.3 L46.4 149.0 L47.5 150.1 L50.0 150.8 L50.0 149.0 Z M45.0 144.3 L45.0 145.1 L46.0 146.1 L47.1 146.1 L47.1 144.3 Z M34.6 134.7 L33.9 136.5 L33.9 138.3 L35.7 138.3 L35.7 135.8 L35.3 134.7 Z M37.1 127.2 L36.0 127.2 L34.6 128.6 L34.6 131.1 L35.3 131.1 Z M88.6 120.8 L88.6 122.5 L90.3 122.2 L89.6 120.8 Z M76.1 120.4 L76.1 122.2 L77.5 122.5 L77.1 120.8 Z M67.5 118.3 L67.5 120.0 L70.0 120.8 L70.0 119.7 L68.9 118.6 Z M94.6 117.9 L94.6 120.0 L95.7 120.0 L97.1 119.0 L97.1 118.3 Z M56.0 118.6 L56.0 119.3 L61.0 119.3 L61.0 118.6 L59.6 117.9 L57.8 117.9 L57.5 118.6 Z M101.4 114.3 L99.6 114.3 L99.6 116.1 L100.4 116.1 L101.4 115.0 Z M131.5 112.2 L130.7 112.2 L130.0 113.3 L129.3 122.5 L130.4 122.5 L131.1 121.5 Z M106.1 107.9 L102.9 109.0 L103.6 111.5 L105.0 110.8 L106.1 109.0 Z M108.6 104.0 L107.9 103.6 L106.4 104.0 L106.4 104.7 L107.1 105.0 L106.4 106.5 L107.1 106.5 L108.6 105.0 Z M111.8 99.3 L109.3 99.3 L109.7 101.8 L110.4 101.8 L111.8 100.4 Z M144.7 96.8 L145.0 98.6 L144.7 100.4 L146.5 100.4 L146.1 98.2 L145.4 96.8 Z M115.4 95.0 L113.2 95.0 L113.6 96.1 L113.2 97.2 L113.9 97.2 L115.4 95.7 Z M119.7 91.1 L117.9 91.5 L117.2 92.9 L118.9 92.5 Z M125.7 86.1 L121.8 86.4 L122.2 89.0 L123.2 89.0 L125.7 86.8 Z M127.5 67.1 L127.2 69.3 L130.7 69.7 L130.7 68.9 L129.3 67.5 Z M136.1 65.7 L135.0 67.1 L135.0 68.2 L136.1 67.9 L136.5 68.6 L133.6 68.9 L133.6 69.7 L135.0 69.7 L137.5 70.7 L136.8 65.7 Z M136.1 61.8 L134.7 61.8 L133.6 62.9 L133.6 63.6 L135.7 63.6 Z M151.5 59.3 L151.5 61.4 L151.8 62.1 L152.5 62.1 L152.2 59.3 Z M135.4 56.1 L134.3 56.8 L134.3 57.5 L135.0 57.5 L135.4 58.6 L136.1 58.6 L136.5 56.1 Z M152.9 55.4 L151.8 55.4 L151.5 57.9 L152.9 57.1 Z M156.5 50.7 L155.8 50.7 L154.0 52.5 L154.0 53.2 L155.8 52.9 Z M139.3 49.6 L137.5 49.6 L137.5 51.8 L138.2 51.8 L139.3 50.7 Z M160.0 48.2 L160.0 48.9 L161.5 49.3 L162.5 48.9 L162.9 49.6 L165.0 49.6 L165.0 48.6 L162.9 48.9 L162.5 47.8 Z M144.3 43.6 L140.7 43.9 L140.7 44.6 L141.5 45.0 L141.5 46.1 L142.5 46.1 L144.3 44.6 Z M147.5 39.3 L147.9 40.3 L147.5 41.4 L151.1 40.7 L150.8 39.6 Z M182.2 37.8 L180.8 37.8 L180.4 38.9 L179.0 38.6 L178.6 39.6 L180.4 39.6 L180.8 38.9 L181.8 38.9 Z M105.7 37.8 L103.9 38.2 L100.0 40.3 L90.3 47.1 L80.7 56.4 L77.1 60.7 L76.8 62.1 L77.5 62.1 L81.1 57.9 L90.3 48.9 L95.7 44.6 L105.7 38.6 Z M156.8 36.4 L156.8 38.6 L159.7 38.2 L159.3 37.1 Z M163.6 33.9 L163.6 36.4 L165.4 36.4 L165.8 35.0 Z M156.8 34.3 L157.2 35.3 L159.3 35.3 L159.3 34.6 L158.3 33.9 Z M86.8 18.5 L86.8 19.3 L90.0 19.6 L90.0 18.9 L89.3 18.5 Z"
|
||||
},
|
||||
"sitting": {
|
||||
"body": "M6.0 119.8 L6.0 131.0 L6.6 132.2 L7.5 132.2 L7.5 127.4 L9.0 121.7 L11.4 116.5 L14.8 111.4 L18.7 106.5 L25.3 100.2 L32.0 95.4 L35.9 93.5 L38.3 93.5 L41.1 96.0 L42.3 99.3 L42.3 102.6 L41.1 107.2 L41.1 109.9 L41.7 109.9 L45.0 102.6 L47.7 99.0 L51.9 94.8 L56.5 91.4 L64.9 87.2 L70.7 85.7 L74.3 85.7 L77.6 86.6 L80.7 88.1 L83.7 91.1 L85.5 94.5 L86.7 99.9 L86.4 105.0 L87.3 105.0 L89.4 98.4 L93.4 92.6 L95.8 90.5 L99.7 88.4 L103.6 87.5 L106.3 87.5 L111.8 89.6 L113.9 91.7 L114.5 94.2 L115.1 94.8 L112.1 96.6 L107.3 96.6 L107.0 97.5 L108.2 97.8 L108.2 98.7 L103.6 99.6 L103.6 100.5 L105.1 100.8 L104.5 101.7 L100.0 102.9 L99.7 104.1 L101.8 104.4 L100.9 105.3 L97.3 106.8 L97.3 107.8 L98.8 108.1 L98.5 108.7 L94.9 110.2 L94.9 111.1 L96.1 111.1 L96.4 111.7 L92.7 113.5 L92.7 114.4 L94.0 114.4 L94.3 115.0 L93.0 115.9 L90.0 116.8 L90.0 117.7 L91.2 117.7 L91.5 118.3 L90.6 119.2 L86.7 120.8 L86.7 121.4 L87.9 122.0 L86.7 123.5 L84.6 123.5 L83.1 124.1 L83.1 124.7 L84.6 125.3 L84.3 125.9 L82.5 126.8 L78.5 126.8 L78.5 127.7 L80.1 128.6 L79.1 129.5 L74.9 129.2 L74.6 130.4 L75.8 131.0 L75.2 131.9 L70.1 131.6 L70.1 132.5 L71.3 133.4 L71.0 134.1 L69.2 134.4 L65.2 133.7 L65.2 134.7 L66.1 135.3 L65.5 136.2 L60.4 135.6 L61.3 137.1 L61.0 137.7 L56.8 136.5 L56.5 137.4 L57.1 138.3 L56.2 138.6 L52.2 137.1 L51.9 138.0 L52.5 138.9 L51.6 139.2 L48.3 137.4 L47.4 137.4 L47.7 138.9 L47.1 139.2 L44.1 136.8 L43.2 136.8 L43.2 137.7 L42.6 138.0 L41.4 136.8 L40.5 134.7 L39.9 134.7 L39.5 135.6 L38.9 135.3 L38.6 134.1 L39.2 133.1 L39.2 131.6 L38.3 131.6 L38.0 131.0 L38.6 129.5 L39.2 129.2 L39.2 128.3 L42.3 125.6 L47.7 123.5 L53.2 123.5 L57.4 124.7 L60.1 126.2 L61.0 126.2 L61.0 125.3 L58.0 122.6 L53.8 121.4 L53.5 120.5 L52.5 120.1 L47.1 120.1 L45.6 120.8 L43.8 120.5 L38.6 122.6 L37.7 123.8 L36.8 123.8 L35.0 125.9 L34.1 128.9 L33.5 129.5 L32.3 129.2 L32.3 132.2 L33.2 134.4 L32.0 134.4 L31.7 135.3 L32.9 137.4 L36.8 141.3 L43.2 144.0 L47.1 144.6 L56.2 144.6 L61.0 144.0 L72.5 140.7 L82.5 136.2 L90.0 131.6 L102.7 122.6 L103.0 124.4 L101.5 128.3 L97.9 131.0 L96.1 134.4 L94.6 135.6 L92.4 135.6 L90.0 136.8 L88.2 138.6 L85.5 143.1 L81.6 144.3 L77.6 149.2 L74.3 151.3 L74.3 152.2 L76.4 152.2 L89.1 149.8 L90.3 150.4 L93.7 150.4 L95.5 149.5 L103.0 147.7 L106.6 147.7 L108.8 148.3 L113.6 147.7 L116.6 148.3 L120.6 147.4 L126.0 147.4 L129.9 146.7 L131.1 145.5 L134.2 144.3 L136.3 144.3 L140.8 146.4 L141.4 147.7 L145.0 148.9 L160.5 148.9 L164.4 149.5 L169.8 151.3 L171.0 151.3 L171.9 150.1 L173.7 149.8 L180.1 151.3 L181.0 152.2 L188.0 152.5 L190.7 153.7 L193.7 153.7 L193.7 152.5 L191.3 150.7 L190.4 148.9 L188.9 147.4 L186.7 146.4 L184.6 143.1 L183.4 142.2 L182.5 137.4 L181.6 135.9 L179.2 134.1 L175.6 132.8 L173.4 130.1 L171.6 128.9 L170.7 125.3 L166.8 121.1 L165.0 120.8 L164.1 119.8 L160.5 113.2 L154.1 107.8 L152.0 107.8 L150.8 107.2 L147.8 103.2 L145.9 99.6 L145.6 97.8 L149.0 94.2 L150.5 90.2 L151.7 89.9 L151.4 85.1 L152.3 84.8 L152.3 83.3 L151.4 80.9 L152.0 79.3 L149.6 75.7 L150.2 74.5 L147.5 71.2 L148.1 70.0 L146.5 68.2 L147.2 67.6 L147.2 66.6 L146.2 64.5 L147.5 64.2 L147.2 63.0 L148.1 62.7 L148.1 61.2 L148.7 60.6 L152.6 60.6 L153.8 59.7 L158.6 60.9 L159.2 62.1 L160.1 62.1 L161.4 60.6 L161.1 58.5 L159.5 58.2 L158.6 57.0 L156.8 56.4 L156.5 55.5 L159.8 54.9 L162.6 55.8 L162.9 55.2 L162.9 52.7 L162.0 51.5 L160.8 50.9 L157.4 50.9 L148.1 47.0 L147.2 47.0 L148.1 48.5 L147.8 49.1 L142.9 47.9 L142.3 47.9 L142.0 48.5 L140.5 48.5 L134.5 46.1 L134.5 47.3 L135.4 48.2 L140.5 51.2 L140.2 52.7 L134.5 53.0 L134.5 54.0 L137.5 54.3 L137.8 54.9 L132.9 57.0 L132.3 58.2 L135.1 58.2 L129.9 62.4 L129.9 63.0 L131.1 63.0 L132.6 62.1 L133.2 62.4 L133.2 63.0 L130.8 65.7 L130.2 67.6 L132.0 67.0 L132.3 67.3 L131.1 70.6 L131.1 72.1 L132.0 72.4 L132.9 70.9 L133.5 71.2 L132.6 73.6 L132.6 75.1 L133.9 75.4 L134.2 76.3 L135.1 76.6 L134.8 77.2 L131.7 76.0 L127.8 75.4 L121.8 73.6 L115.7 70.6 L113.0 68.2 L112.7 64.2 L113.6 60.0 L116.0 53.0 L118.4 48.5 L119.3 47.9 L120.9 48.2 L122.4 49.4 L123.0 51.2 L123.9 51.2 L124.2 50.0 L123.6 47.6 L121.8 45.8 L117.2 44.6 L116.6 44.0 L108.8 44.0 L108.2 44.6 L88.8 47.0 L79.1 48.8 L67.7 52.1 L55.9 57.6 L47.1 63.0 L39.5 68.8 L34.4 73.3 L23.8 84.5 L17.5 92.9 L13.6 99.6 L8.7 110.2 L6.9 116.2 L6.6 119.2 Z M117.5 113.8 L117.8 115.3 L116.0 118.0 L116.0 118.9 L117.2 119.8 L117.2 121.4 L114.8 122.3 L112.1 125.6 L111.5 128.3 L109.7 130.7 L107.9 131.0 L106.6 130.1 L105.7 130.1 L105.7 126.8 L110.0 118.0 L113.9 114.7 L115.7 113.8 Z M130.5 106.5 L132.3 109.3 L132.6 111.1 L133.2 111.1 L133.9 112.0 L134.2 115.3 L132.0 115.9 L130.5 114.7 L129.0 114.7 L126.0 115.9 L123.3 115.9 L123.0 114.4 L127.8 110.2 L129.0 106.8 Z M138.7 100.8 L140.2 100.8 L146.5 107.8 L146.5 109.0 L145.3 110.5 L140.8 112.9 L137.8 112.9 L137.2 112.3 L135.1 106.5 L135.1 103.8 Z",
|
||||
"lines": "M191.3 152.8 L191.3 153.4 L191.9 153.7 L193.7 153.7 L193.7 153.1 Z M61.9 136.5 L61.9 138.0 L63.1 138.0 L63.4 137.1 Z M66.8 135.0 L66.8 136.5 L68.3 135.9 L68.0 135.0 Z M33.8 134.4 L33.8 135.0 L32.9 135.3 L32.9 135.9 L33.5 136.8 L35.3 137.1 L34.4 134.4 Z M34.4 130.1 L33.8 130.1 L33.2 131.0 L33.5 132.5 L34.1 132.5 Z M40.5 122.9 L39.2 123.2 L38.3 124.4 L37.7 124.4 L36.8 125.6 L36.2 125.6 L35.9 127.4 L36.5 127.4 L38.0 125.3 L40.5 123.5 Z M45.0 121.4 L43.5 121.4 L42.0 122.0 L42.0 122.9 L45.0 122.0 Z M88.5 120.8 L88.8 121.7 L88.5 122.6 L90.3 121.7 L90.3 120.8 Z M50.4 120.8 L50.4 121.7 L52.8 121.7 L52.8 121.1 Z M6.3 120.5 L6.0 129.2 L6.3 130.4 L6.9 130.4 L6.6 129.2 L6.9 120.5 Z M104.5 115.9 L103.9 115.9 L102.7 118.0 L103.0 120.8 L102.4 122.0 L103.9 122.0 L103.9 117.7 L104.5 116.8 Z M98.5 110.2 L97.0 110.2 L97.0 112.3 L97.9 112.0 L98.5 111.1 Z M100.9 106.8 L99.4 106.8 L99.4 108.7 L100.0 108.7 Z M129.6 86.0 L128.4 86.0 L122.4 89.6 L116.0 92.6 L115.4 93.2 L115.4 93.9 L116.3 94.2 L115.7 94.5 L115.7 95.4 L116.9 95.1 L121.5 91.4 L129.6 86.6 Z M149.6 78.4 L150.2 80.6 L150.8 80.6 L150.8 78.7 Z M147.5 73.3 L147.5 74.2 L148.1 75.1 L149.0 75.4 L148.4 73.3 Z M134.2 72.4 L133.5 73.3 L133.5 74.2 L134.2 74.2 L135.1 75.1 L135.1 75.7 L135.7 75.7 L135.1 72.7 Z M145.0 65.4 L145.0 67.6 L145.3 68.2 L145.9 68.2 L145.9 66.0 L145.6 65.4 Z M134.2 65.1 L132.0 65.7 L132.0 66.3 L132.9 66.6 L132.9 67.9 L133.5 67.9 Z M103.6 63.3 L102.7 63.3 L99.7 66.6 L94.6 74.2 L91.2 82.7 L89.7 89.6 L90.3 89.6 L92.4 83.0 L96.7 74.2 L100.9 67.3 L103.6 63.9 Z M133.5 60.9 L133.9 63.0 L134.5 63.0 L135.1 60.9 Z M72.8 60.9 L71.6 61.2 L68.6 63.3 L62.8 68.2 L55.0 76.6 L48.9 86.0 L45.3 94.2 L44.7 97.2 L45.3 97.2 L47.1 92.3 L49.8 86.9 L56.5 76.9 L64.9 67.9 L72.2 62.1 Z M148.4 59.4 L148.4 60.0 L149.6 59.7 L151.4 60.0 L151.4 59.1 L150.2 59.4 L149.9 58.8 L149.3 58.8 Z M137.2 57.0 L135.7 57.0 L135.7 58.8 L136.3 58.8 L137.2 57.9 Z M138.4 54.0 L138.4 55.5 L139.3 55.5 L139.9 54.3 Z M141.1 50.3 L141.1 53.4 L142.3 53.4 L142.9 52.1 L145.3 52.1 L145.0 51.2 Z M148.7 48.2 L148.7 50.0 L150.2 50.3 L150.2 49.1 L149.3 48.2 Z M109.4 44.3 L109.4 45.2 L112.7 44.6 L116.0 44.9 L116.0 44.0 Z"
|
||||
},
|
||||
"resting": {
|
||||
"body": "M193.7 139.7 L185.5 129.8 L178.3 127.8 L180.7 125.1 L182.4 120.3 L181.4 119.9 L180.0 122.0 L179.4 121.6 L180.7 118.2 L181.1 112.1 L179.0 102.9 L178.0 102.9 L178.0 112.1 L177.3 115.2 L176.6 115.9 L176.3 109.0 L174.9 108.7 L173.9 103.6 L171.5 98.8 L170.2 98.5 L171.5 104.3 L171.2 105.0 L168.8 102.9 L168.1 99.5 L166.4 96.4 L165.1 96.4 L165.7 98.5 L165.4 100.2 L162.7 96.4 L160.3 94.4 L159.6 94.4 L159.9 96.4 L159.3 96.8 L155.5 93.0 L154.2 93.0 L154.5 94.4 L153.1 94.7 L149.4 92.4 L148.0 92.4 L148.4 93.7 L147.0 94.1 L143.3 92.4 L140.9 92.0 L141.6 93.4 L141.2 94.4 L130.3 94.7 L130.3 95.8 L131.7 96.1 L132.4 96.8 L128.3 98.5 L124.9 98.5 L124.5 100.2 L123.5 98.5 L123.5 95.1 L124.9 91.7 L128.9 86.9 L133.4 84.2 L137.8 82.8 L142.9 83.2 L150.1 85.9 L153.5 88.9 L154.5 88.9 L154.5 87.9 L153.5 85.9 L150.7 83.2 L144.6 79.8 L139.5 77.7 L129.6 75.3 L128.9 74.6 L117.4 74.6 L116.7 75.3 L91.1 79.1 L75.1 82.8 L61.9 87.6 L43.5 97.1 L27.5 108.7 L16.6 119.6 L12.5 124.7 L6.0 135.9 L6.0 146.8 L9.4 153.7 L10.8 153.7 L9.4 149.2 L9.4 146.2 L11.1 140.7 L14.5 135.3 L19.3 130.5 L21.7 129.1 L24.1 128.8 L25.1 130.5 L25.1 135.9 L25.8 137.7 L26.8 137.7 L27.1 133.9 L31.2 126.4 L36.3 121.3 L41.4 118.6 L44.5 118.6 L45.8 120.3 L45.8 121.6 L40.7 124.0 L40.4 125.4 L41.1 125.4 L41.4 126.1 L40.1 126.4 L40.1 127.1 L37.7 129.1 L37.7 130.2 L38.4 130.2 L38.7 130.8 L37.7 132.5 L37.3 134.6 L38.4 134.9 L39.7 134.2 L43.8 139.7 L46.2 141.4 L51.3 143.4 L54.0 143.1 L53.7 141.4 L51.6 139.4 L52.3 138.7 L58.4 142.1 L63.9 144.1 L73.4 146.2 L82.3 147.2 L99.0 146.8 L120.4 144.1 L134.4 144.5 L141.6 145.8 L148.0 147.9 L152.8 150.6 L155.5 153.7 L156.2 152.6 L155.5 148.6 L152.4 145.1 L147.0 142.1 L146.3 140.7 L142.2 139.4 L138.5 139.0 L138.1 138.0 L139.8 137.3 L142.9 137.3 L147.0 139.0 L149.0 139.0 L149.4 138.3 L154.5 137.7 L155.2 138.3 L155.2 139.7 L157.6 141.1 L159.6 140.0 L167.1 140.4 L174.2 142.4 L179.7 141.7 L182.8 142.1 L184.8 141.1 L187.5 142.1 L187.9 141.4 L189.6 141.4 L192.3 142.8 L193.7 142.8 Z M80.2 131.5 L86.7 130.8 L101.4 130.8 L121.5 132.2 L125.9 133.6 L130.7 133.6 L131.0 136.6 L130.3 137.3 L126.6 137.3 L126.2 135.9 L118.7 136.3 L118.4 134.9 L114.0 135.9 L111.2 135.9 L110.9 134.6 L105.1 136.3 L103.4 136.3 L103.1 134.9 L102.0 134.9 L98.0 136.6 L96.3 136.6 L95.6 134.9 L91.5 136.6 L89.4 136.6 L89.4 134.6 L83.7 135.6 L83.3 133.9 L80.2 133.6 Z M150.1 108.0 L153.1 108.0 L157.6 109.4 L162.0 113.1 L163.3 115.5 L162.7 118.9 L161.0 118.9 L158.9 116.2 L160.3 121.0 L158.9 121.3 L159.6 125.1 L158.6 126.4 L157.2 126.4 L151.8 122.7 L150.1 120.6 L150.7 117.2 L149.7 114.8 L150.1 112.8 L149.0 111.4 L149.0 108.7 Z",
|
||||
"lines": "M141.9 140.4 L142.2 141.4 L146.0 142.4 L145.6 141.4 Z M6.3 136.6 L6.0 144.8 L6.3 146.2 L7.0 146.2 L7.0 142.4 L6.7 142.1 L7.0 136.6 Z M131.7 138.3 L137.5 139.4 L137.5 138.0 L135.4 137.7 L138.8 137.0 L139.2 135.9 L136.8 136.6 L135.4 135.9 L133.4 136.3 L132.7 135.3 L132.0 135.3 Z M132.7 137.3 L133.0 137.0 L135.4 137.3 L135.1 137.7 Z M41.1 128.8 L39.4 128.8 L39.4 131.2 L40.7 130.5 Z M74.1 128.5 L74.1 129.5 L75.1 130.5 L75.1 131.5 L76.2 132.2 L77.9 132.2 L78.2 133.6 L79.6 133.9 L79.6 131.2 Z M127.9 124.4 L127.9 125.1 L128.9 126.1 L136.1 128.8 L136.8 129.5 L132.4 131.5 L131.7 132.2 L131.7 134.2 L132.4 134.2 L133.4 132.9 L136.1 130.8 L137.1 130.8 L139.2 129.8 L140.9 129.8 L141.9 130.5 L146.3 130.8 L150.1 132.5 L153.1 135.6 L153.8 137.0 L155.5 137.0 L155.9 134.2 L157.6 131.5 L157.6 130.5 L158.9 127.8 L158.9 127.1 L157.2 127.1 L155.9 129.8 L148.7 130.5 L146.0 129.5 L139.2 128.8 Z M151.1 131.2 L154.5 130.8 L156.5 131.2 L155.2 132.9 L154.2 135.3 L153.5 133.9 L150.7 131.5 Z M43.8 124.4 L42.1 124.4 L42.1 126.8 L42.8 126.8 L43.8 125.4 Z M180.4 122.7 L179.0 123.3 L178.7 121.6 L178.0 121.6 L177.7 122.7 L175.9 124.4 L174.9 124.4 L174.2 125.1 L173.2 127.4 L169.5 130.5 L168.5 132.2 L168.5 132.9 L169.5 133.2 L168.8 133.9 L165.1 135.6 L163.0 135.9 L160.3 138.0 L159.6 139.4 L160.6 139.4 L164.7 136.6 L166.8 136.3 L170.8 134.2 L173.9 131.5 L177.0 130.2 L177.7 129.1 L177.7 127.4 L175.9 128.1 L175.3 129.5 L174.2 129.8 L169.8 133.2 L169.1 132.9 L170.8 130.8 L172.2 130.2 L174.2 128.1 L175.3 126.1 L178.3 125.4 L180.4 123.3 Z M149.7 121.6 L148.7 122.0 L147.7 124.4 L148.4 124.4 L149.7 123.0 Z M174.9 109.7 L174.2 109.7 L174.2 111.8 L173.2 113.5 L172.2 117.2 L170.5 119.9 L170.5 121.0 L171.9 120.3 L174.2 114.8 L174.9 115.9 L174.6 116.9 L175.3 117.2 L174.2 120.6 L175.3 120.6 L177.7 117.2 L177.7 116.5 L175.6 116.2 L175.6 114.2 L174.9 114.2 L174.6 114.8 L174.2 114.5 L174.2 113.5 L175.6 111.4 L175.6 110.4 Z M126.2 110.4 L124.2 109.0 L119.1 107.3 L110.9 107.0 L104.4 108.7 L101.4 110.1 L99.0 111.8 L97.6 110.4 L94.2 109.0 L88.4 109.0 L80.9 110.7 L69.7 114.8 L69.3 113.1 L68.7 112.4 L65.3 112.4 L60.2 114.5 L54.0 118.9 L48.6 125.1 L46.2 129.1 L45.8 127.8 L46.9 122.7 L45.8 123.0 L44.1 132.2 L44.5 134.6 L45.5 134.6 L45.8 132.5 L48.6 127.4 L52.0 123.0 L56.1 118.9 L59.8 116.2 L65.9 113.5 L68.0 113.5 L68.7 114.5 L68.7 115.9 L73.1 114.8 L75.1 115.5 L81.6 115.9 L88.1 117.9 L94.2 121.3 L97.6 124.0 L102.4 129.1 L103.7 129.5 L103.7 128.8 L99.0 123.3 L92.5 118.6 L86.4 115.9 L82.3 114.8 L75.5 114.5 L75.1 114.2 L83.0 111.4 L89.8 110.1 L94.6 110.4 L96.3 111.1 L98.3 112.8 L99.3 112.8 L105.1 109.7 L111.9 108.0 L116.7 108.0 L122.5 109.4 L125.5 111.1 L126.2 111.1 Z M168.8 104.3 L169.1 105.6 L170.2 106.0 L171.2 108.7 L170.5 113.1 L168.5 116.5 L168.5 117.2 L169.5 117.2 L171.9 112.4 L172.5 106.3 L172.2 105.6 L171.2 106.0 L170.2 105.6 L169.5 104.3 Z M125.5 99.2 L125.5 100.9 L125.2 101.2 L123.8 100.9 L123.8 101.6 L125.5 103.3 L126.6 103.3 L126.6 102.6 L125.2 101.2 L127.6 100.5 L127.9 99.5 Z M160.6 96.4 L160.6 97.1 L159.6 97.5 L159.6 98.1 L160.6 98.8 L162.0 98.8 L161.3 96.4 Z M153.8 95.4 L153.8 96.1 L156.2 96.4 L155.9 94.7 L155.2 94.7 L154.8 95.4 Z M149.0 93.4 L149.0 95.4 L150.4 95.4 L150.7 94.4 L149.7 93.4 Z M142.2 93.4 L142.2 95.1 L143.9 95.1 L143.9 94.1 Z M123.2 83.5 L119.8 84.9 L112.3 90.7 L105.8 98.1 L103.4 101.9 L102.7 103.9 L104.1 103.3 L106.1 99.8 L110.9 94.1 L117.4 87.9 L123.2 84.2 Z M86.0 83.5 L78.9 85.5 L71.1 88.9 L64.6 92.4 L56.1 97.8 L47.9 104.3 L38.7 113.5 L35.3 117.6 L34.9 118.9 L35.6 118.9 L47.6 106.7 L57.8 98.5 L69.3 91.3 L77.9 87.2 L86.0 84.2 Z M109.5 81.1 L102.7 82.5 L91.8 86.2 L80.9 91.3 L76.5 94.1 L69.3 99.2 L61.9 106.0 L55.7 113.1 L52.0 118.6 L52.0 119.3 L53.3 118.6 L59.8 110.4 L67.6 102.6 L78.5 94.4 L88.8 88.9 L98.0 85.2 L109.5 81.8 Z M118.1 75.0 L118.1 75.7 L121.8 75.7 L122.1 75.3 L128.3 75.7 L128.3 75.0 L127.2 74.6 Z"
|
||||
},
|
||||
"coiled": {
|
||||
"body": "M193.8 52.4 L191.4 49.8 L189.5 48.6 L181.6 45.3 L171.4 42.4 L168.8 41.2 L167.1 41.0 L166.6 40.5 L158.5 40.5 L158.1 41.0 L149.3 41.4 L125.9 41.7 L124.0 42.2 L116.7 45.7 L112.4 45.7 L111.2 46.2 L111.4 46.9 L113.3 47.2 L113.8 48.1 L109.8 50.7 L96.0 56.9 L95.5 57.4 L95.5 59.5 L93.8 58.6 L93.8 59.5 L93.3 59.8 L89.8 56.4 L89.1 56.4 L89.1 57.2 L89.8 58.1 L89.5 58.3 L87.1 56.9 L86.4 56.9 L86.2 57.9 L84.5 56.7 L83.1 56.4 L83.1 57.9 L79.3 57.9 L78.8 59.3 L76.2 59.5 L76.0 60.5 L68.3 60.2 L64.1 58.6 L57.2 57.4 L54.5 55.7 L51.7 56.0 L51.7 56.7 L52.2 56.7 L52.4 57.2 L51.7 57.9 L49.5 58.6 L48.1 58.6 L46.5 57.4 L44.3 56.9 L42.2 56.9 L41.9 57.4 L41.2 56.9 L39.3 56.9 L39.3 57.6 L42.6 58.1 L44.3 59.1 L36.0 62.2 L29.1 65.5 L23.8 69.1 L16.9 75.0 L12.4 79.5 L7.4 86.7 L6.0 90.0 L6.0 94.3 L7.0 94.8 L7.4 91.9 L9.1 88.8 L12.4 85.7 L16.7 83.3 L19.1 83.3 L21.5 85.0 L22.2 86.4 L22.2 87.6 L21.5 89.0 L21.5 90.9 L21.9 90.9 L24.3 87.4 L30.3 81.9 L35.5 78.6 L41.7 75.7 L46.5 74.3 L48.8 74.3 L49.5 75.7 L50.3 76.0 L52.4 73.3 L54.8 71.7 L59.5 69.1 L63.6 67.6 L66.7 67.1 L71.9 67.1 L79.8 68.1 L80.0 68.3 L79.3 68.8 L79.5 69.8 L79.1 70.2 L76.7 70.7 L76.7 71.9 L74.1 72.1 L73.8 73.3 L71.4 73.3 L71.0 73.8 L71.0 74.8 L69.1 75.0 L69.1 75.5 L69.8 75.7 L69.3 76.4 L66.2 76.7 L66.0 77.6 L66.7 77.9 L66.2 78.3 L62.2 79.5 L61.9 80.7 L59.1 81.7 L59.1 82.9 L58.6 83.3 L56.2 84.3 L56.2 85.2 L53.1 87.1 L53.4 88.3 L49.5 92.1 L49.3 93.6 L47.2 96.7 L47.2 98.1 L46.0 101.4 L46.5 102.4 L46.0 104.3 L46.0 108.3 L46.5 110.7 L47.9 114.0 L49.1 115.7 L53.6 119.3 L54.5 119.3 L54.5 118.6 L52.6 116.4 L50.7 113.3 L49.8 110.7 L50.0 109.3 L50.7 110.0 L51.7 110.0 L49.5 104.0 L49.8 100.9 L51.7 96.2 L54.5 92.4 L61.2 86.2 L67.9 82.4 L76.7 78.8 L77.4 79.0 L76.7 80.7 L75.3 82.4 L74.8 83.6 L73.6 84.3 L73.6 85.2 L74.3 85.7 L76.4 85.7 L77.2 85.2 L84.1 77.1 L84.5 77.4 L85.7 79.8 L87.6 79.8 L89.3 78.8 L92.6 74.8 L92.9 77.6 L95.7 81.7 L96.2 83.8 L96.7 84.0 L96.7 85.2 L97.9 86.9 L99.5 87.6 L100.5 87.4 L101.2 86.7 L101.4 84.5 L100.2 82.4 L100.5 81.7 L103.3 82.4 L103.8 82.9 L104.0 84.8 L102.4 87.4 L102.4 88.8 L101.9 89.3 L102.1 90.5 L104.3 90.5 L106.2 89.3 L106.9 87.6 L108.3 79.8 L108.8 79.3 L110.7 79.5 L114.0 81.2 L117.1 84.0 L116.9 84.5 L115.9 84.3 L115.7 85.2 L118.1 86.7 L117.6 87.4 L117.1 87.4 L117.4 88.1 L119.8 88.8 L122.1 90.2 L126.2 94.0 L127.1 94.0 L126.7 92.4 L127.4 92.1 L130.7 95.7 L131.2 95.7 L132.4 94.3 L132.4 91.9 L131.4 90.5 L130.9 87.6 L130.2 86.2 L129.5 85.9 L128.3 84.5 L127.1 81.2 L125.5 79.3 L123.8 76.0 L122.8 75.7 L123.3 78.1 L122.8 78.3 L119.8 71.9 L119.0 71.9 L119.0 73.1 L119.8 74.8 L119.5 75.2 L115.9 69.5 L115.2 69.5 L115.2 70.7 L115.7 71.4 L115.2 71.7 L111.4 66.9 L110.5 66.9 L110.0 66.2 L111.2 63.1 L114.0 59.8 L116.7 58.3 L127.4 54.3 L130.7 54.3 L137.6 56.4 L140.0 58.3 L140.7 58.3 L141.4 56.9 L143.3 56.4 L158.3 56.2 L162.1 57.6 L164.3 59.5 L164.7 59.5 L165.0 58.8 L164.3 57.4 L162.1 55.3 L159.5 53.6 L158.3 52.4 L158.1 51.2 L159.0 50.0 L160.7 49.3 L168.5 48.1 L178.1 47.9 L182.1 48.3 L189.0 50.5 L190.9 51.4 L193.0 53.3 L193.8 53.3 Z",
|
||||
"lines": "M47.6 99.5 L47.2 99.5 L46.7 101.7 L47.4 101.4 Z M49.3 95.2 L48.4 95.7 L47.6 97.1 L47.6 97.8 L48.4 97.6 Z M51.5 91.7 L51.0 91.7 L50.0 92.6 L50.0 93.3 L50.5 93.3 L51.5 92.4 Z M125.5 90.5 L125.7 91.7 L127.4 91.7 L127.4 91.2 L126.7 90.7 Z M6.7 90.5 L6.2 90.5 L6.0 90.9 L6.0 93.8 L6.5 93.8 L6.7 93.1 L6.5 92.4 Z M55.5 86.9 L54.5 86.9 L53.8 88.6 L55.0 88.1 Z M118.6 86.4 L118.6 87.6 L119.8 87.6 L119.8 86.9 L119.3 86.4 Z M58.1 84.3 L57.6 84.3 L56.7 85.2 L56.7 85.7 L57.4 85.7 L58.1 85.0 Z M117.6 83.8 L117.8 84.8 L117.4 85.0 L117.4 85.5 L119.0 85.7 L119.0 85.0 L118.1 83.8 Z M61.4 81.7 L59.5 82.1 L59.5 83.3 L61.2 82.6 Z M64.8 79.5 L64.1 79.5 L62.6 80.5 L62.6 81.2 L64.3 80.5 Z M122.6 78.8 L122.6 79.5 L124.3 81.4 L125.0 81.4 L124.3 78.8 L123.3 79.0 Z M97.6 77.9 L97.6 78.8 L99.3 82.4 L99.8 82.4 L99.8 81.4 L100.5 81.2 L100.5 80.7 L99.0 79.8 L98.8 79.3 L99.0 78.8 L102.1 80.0 L104.5 80.0 L107.1 79.5 L108.1 79.0 L108.1 78.6 L106.9 78.6 L103.1 79.3 L100.2 78.6 L100.0 78.3 L100.2 77.6 Z M119.0 75.7 L119.0 76.4 L120.0 77.6 L120.7 77.6 L120.5 75.7 Z M81.9 74.3 L81.2 74.3 L78.8 76.9 L77.2 77.9 L77.2 78.3 L77.6 78.3 L77.9 79.0 L79.3 78.3 L81.9 74.8 Z M95.2 73.8 L93.3 74.8 L93.3 76.0 L93.8 76.0 L95.2 74.5 Z M74.1 74.3 L71.9 73.8 L71.9 74.3 L72.4 74.5 L71.7 74.8 L71.4 75.7 L70.3 75.5 L70.3 76.7 L71.2 76.4 L71.7 75.5 L72.9 75.5 L73.8 75.0 Z M74.5 72.6 L74.5 73.8 L75.7 73.8 L76.4 73.3 L76.2 72.6 Z M115.0 72.1 L115.0 72.6 L116.7 74.3 L117.1 74.3 L116.7 72.1 Z M77.4 72.4 L79.1 71.7 L79.1 71.2 L77.6 71.0 Z M80.0 70.5 L81.4 69.8 L81.2 69.1 L81.4 68.8 L83.6 68.8 L83.6 68.3 L80.5 67.6 Z M110.2 67.4 L110.7 69.3 L111.9 70.5 L113.1 71.0 L112.6 69.3 L111.7 68.6 L111.7 68.1 L110.9 67.4 Z M105.2 65.0 L105.2 65.7 L106.2 66.2 L107.9 68.1 L109.8 69.1 L109.8 68.3 L108.8 66.9 L109.5 66.7 L109.5 66.0 L109.0 66.0 L108.8 66.9 L107.6 66.4 L106.7 65.5 Z M65.0 63.3 L62.4 63.3 L55.5 64.5 L46.7 67.6 L46.5 68.3 L55.0 65.5 L60.7 64.3 L65.0 63.8 Z M93.3 60.2 L93.3 60.7 L94.3 61.4 L95.0 61.4 L95.2 61.0 L96.9 62.9 L100.2 64.8 L101.2 64.8 L101.4 64.3 L102.1 65.0 L102.9 65.0 L102.9 64.3 L101.4 62.9 L100.0 62.2 L99.5 62.2 L99.3 63.1 L97.1 61.2 L96.7 60.0 Z M79.5 58.6 L79.5 60.0 L80.5 60.0 L80.7 59.3 L80.0 58.6 Z M89.3 58.8 L89.3 59.3 L90.5 60.0 L91.4 60.0 L90.7 58.3 L90.2 58.3 L90.0 58.8 Z M81.2 58.6 L81.4 59.3 L82.9 59.5 L82.9 58.8 L82.4 58.3 Z M86.4 58.3 L86.7 59.1 L88.3 59.3 L87.9 58.1 L86.9 57.9 Z M83.8 57.4 L84.1 58.1 L83.3 58.3 L83.3 58.8 L85.5 59.3 L85.5 58.6 L84.3 57.4 Z M159.0 40.7 L159.0 41.4 L166.2 41.2 L166.2 40.7 L165.4 40.5 Z"
|
||||
}
|
||||
};
|
||||
const POSES = Object.fromEntries(Object.entries(TRACED).map(([k, p]) => [k, () => ({ d: [p.body], lines: p.lines, eye: [0, 0], eyeR: 0 })]));
|
||||
|
||||
const cache = {};
|
||||
/** SVG markup for one dragon: <g> with the silhouette in `fill`, its interior lines in `ink` (lineOpacity; lines:
|
||||
* false leaves them out) and, with `outline`, a hairline of that colour round the edge that stays 1px at any size.
|
||||
* `dark: true` draws it like the reference sheet: a near-black body with light lines and outline. */
|
||||
function svg(pose, { fill = "#2a2230", eyeFill = "#f6e6c4", flip = false, lines = true, ink = "#1b0811", lineOpacity = 0.38,
|
||||
outline = null, outlineWidth = 1, outlineOpacity = 0.7, dark = false } = {}) {
|
||||
if (!cache[pose]) cache[pose] = POSES[pose]();
|
||||
const p = cache[pose];
|
||||
if (dark) {
|
||||
fill = "#16111b"; ink = "#e9e0f5"; lineOpacity = 0.6; outline = outline || "#d9cdee"; outlineOpacity = 0.85;
|
||||
}
|
||||
const tf = flip ? ' transform="translate(200 0) scale(-1 1)"' : "";
|
||||
const edge = outline ? ` stroke="${outline}" stroke-opacity="${outlineOpacity}" stroke-width="${outlineWidth}" stroke-linejoin="round" vector-effect="non-scaling-stroke"` : "";
|
||||
const body = `<g fill="${fill}" fill-rule="evenodd"${edge}>${p.d.map((d) => `<path d="${d}"/>`).join("")}</g>`;
|
||||
const inner = lines && p.lines ? `<path d="${p.lines}" fill="${ink}" fill-opacity="${lineOpacity}" stroke="none"/>` : "";
|
||||
const eye = p.eyeR ? `<circle cx="${f(p.eye[0])}" cy="${f(p.eye[1])}" r="${p.eyeR}" fill="${eyeFill}"/>` : "";
|
||||
return `<g${tf}>${body}${inner}${eye}</g>`;
|
||||
}
|
||||
/* ---------- cadets and the thorn bush (same building blocks, 100 x 140 box, feet near y = 132) ---------- */
|
||||
|
||||
const line = (a, b, r0, r1 = r0) => tube([a, [lerp(a[0], b[0], 0.33), lerp(a[1], b[1], 0.33)], [lerp(a[0], b[0], 0.66), lerp(a[1], b[1], 0.66)], b], r0, r1, 8);
|
||||
/** A cadet from joint positions; `cloak` adds a short flying cape, weapons are drawn from the hands. */
|
||||
function cadet(j, { cloak = true, sword = null, dagger = null, size = 1 } = {}) {
|
||||
const d = [];
|
||||
if (cloak) d.push(poly([j.neck, [j.neck[0] - 4, j.neck[1] + 2], [j.hip[0] - 14 * (j.face || 1), j.hip[1] + 16], [j.hip[0] - 2 * (j.face || 1), j.hip[1] + 8], [j.neck[0] + 3, j.neck[1] + 4]]));
|
||||
d.push(line(j.neck, j.hip, 7.5 * size, 6.5 * size)); // torso
|
||||
d.push(line(j.hip, j.lKnee, 4.6 * size, 4 * size), line(j.lKnee, j.lFoot, 3.8 * size, 3 * size));
|
||||
d.push(line(j.hip, j.rKnee, 4.6 * size, 4 * size), line(j.rKnee, j.rFoot, 3.8 * size, 3 * size));
|
||||
d.push(poly([[j.lFoot[0] - 3, j.lFoot[1] - 2], [j.lFoot[0] + 7 * (j.face || 1), j.lFoot[1] - 1], [j.lFoot[0] + 7 * (j.face || 1), j.lFoot[1] + 2], [j.lFoot[0] - 3, j.lFoot[1] + 2]]));
|
||||
d.push(poly([[j.rFoot[0] - 3, j.rFoot[1] - 2], [j.rFoot[0] + 7 * (j.face || 1), j.rFoot[1] - 1], [j.rFoot[0] + 7 * (j.face || 1), j.rFoot[1] + 2], [j.rFoot[0] - 3, j.rFoot[1] + 2]]));
|
||||
const sh = [j.neck[0], j.neck[1] + 3];
|
||||
d.push(line(sh, j.lElbow, 3.4 * size, 3), line(j.lElbow, j.lHand, 3, 2.4));
|
||||
d.push(line(sh, j.rElbow, 3.4 * size, 3), line(j.rElbow, j.rHand, 3, 2.4));
|
||||
d.push(ell(j.head[0], j.head[1], 7.2 * size, 8 * size, 0)); // head
|
||||
d.push(ell(j.head[0] - 2 * (j.face || 1), j.head[1] - 3, 7 * size, 5 * size, 0)); // hair
|
||||
d.push(line([(j.neck[0] + j.head[0]) / 2, (j.neck[1] + j.head[1]) / 2 + 2], j.neck, 3.2, 3.6)); // neck
|
||||
const blade = (hand, ang, len, w) => {
|
||||
const tip = [hand[0] + Math.cos(ang) * len, hand[1] + Math.sin(ang) * len];
|
||||
const nx = -Math.sin(ang), ny = Math.cos(ang);
|
||||
return [poly([[hand[0] + nx * w, hand[1] + ny * w], [tip[0] + nx * w * 0.4, tip[1] + ny * w * 0.4], [tip[0] + Math.cos(ang) * 4, tip[1] + Math.sin(ang) * 4], [tip[0] - nx * w * 0.4, tip[1] - ny * w * 0.4], [hand[0] - nx * w, hand[1] - ny * w]]),
|
||||
line([hand[0] + nx * 6, hand[1] + ny * 6], [hand[0] - nx * 6, hand[1] - ny * 6], 1.4)];
|
||||
};
|
||||
if (sword) d.push(...blade(j[sword.hand], sword.ang, sword.len || 44, 1.9));
|
||||
if (dagger) d.push(...blade(j[dagger.hand], dagger.ang, dagger.len || 16, 1.6));
|
||||
return d;
|
||||
}
|
||||
const FIGURES = {
|
||||
// your squadmate, braced, sword raised high
|
||||
defender: () => cadet({ face: 1, head: [42, 30], neck: [44, 42], hip: [46, 84], lKnee: [36, 106], lFoot: [28, 130], rKnee: [58, 104], rFoot: [64, 130],
|
||||
lElbow: [56, 50], lHand: [62, 34], rElbow: [56, 56], rHand: [62, 38] }, { sword: { hand: "lHand", ang: -1.15, len: 46 } }),
|
||||
// the bigger bully, lunging with a sword
|
||||
lunging: () => cadet({ face: -1, head: [56, 34], neck: [54, 46], hip: [58, 86], lKnee: [42, 104], lFoot: [30, 130], rKnee: [70, 108], rFoot: [82, 130],
|
||||
lElbow: [40, 56], lHand: [26, 60], rElbow: [44, 60], rHand: [30, 64] }, { sword: { hand: "lHand", ang: Math.PI + 0.12, len: 42 }, size: 1.12 }),
|
||||
// the smaller bully, dagger raised to throw
|
||||
throwing: () => cadet({ face: -1, head: [50, 46], neck: [50, 57], hip: [52, 92], lKnee: [42, 110], lFoot: [36, 130], rKnee: [62, 110], rFoot: [68, 130],
|
||||
lElbow: [40, 66], lHand: [36, 80], rElbow: [64, 52], rHand: [70, 38] }, { dagger: { hand: "rHand", ang: -0.9 }, size: 0.88 }),
|
||||
// the wounded cadet, lying on the ground, a belt tied above the knee
|
||||
lying: () => {
|
||||
const d = cadet({ face: 1, head: [16, 118], neck: [26, 120], hip: [62, 122], lKnee: [80, 116], lFoot: [96, 126], rKnee: [80, 126], rFoot: [84, 128],
|
||||
lElbow: [34, 108], lHand: [40, 96], rElbow: [38, 128], rHand: [52, 130] }, { cloak: false });
|
||||
d.push(poly([[2, 132], [98, 132], [96, 136], [4, 136]])); // the ground line
|
||||
return d;
|
||||
},
|
||||
// a thorn bush: arching branches with thorns and a few leaves
|
||||
thorns: () => {
|
||||
const d = [], R = (() => { let s = 7; return () => ((s = (s * 1103515245 + 12345) % 2147483648) / 2147483648); })();
|
||||
// a low mound of leaves, then arching thorny canes
|
||||
[[22, 128, 18, 9], [50, 124, 24, 12], [78, 128, 18, 9], [36, 118, 14, 8], [64, 118, 14, 8]].forEach(([x, y, rx, ry]) => d.push(ell(x, y, rx, ry, 0)));
|
||||
for (let k = 0; k < 11; k++) {
|
||||
const a = Math.PI * (0.08 + 0.84 * (k / 10)) + (R() - 0.5) * 0.2, len = 50 + R() * 34;
|
||||
const sx = 50 + (R() - 0.5) * 24, sy = 124;
|
||||
const ex = sx - Math.cos(a) * len, ey = sy - Math.sin(a) * len * 0.95;
|
||||
const b = [[sx, sy], [sx - Math.cos(a) * len * 0.35, sy - Math.sin(a) * len * 0.75], [ex + Math.cos(a) * 6, ey - 10], [ex, ey + 4]];
|
||||
d.push(tube(b, 2.6, 0.8, 18));
|
||||
bez(b, 12).slice(2, -1).forEach((p, i) => {
|
||||
const side = i % 2 ? 1 : -1, l = 3.5 + R() * 3;
|
||||
d.push(poly([[p[0] - 1.2, p[1]], [p[0] + side * l, p[1] - l * 0.7], [p[0] + 1.2, p[1]]]));
|
||||
if (i % 3 === 1) d.push(ell(p[0] - side * 5, p[1] - 1, 4.2, 2.2, side * 0.6));
|
||||
});
|
||||
}
|
||||
return d;
|
||||
},
|
||||
};
|
||||
const fcache = {};
|
||||
/** SVG markup for a figure (cadets, the thorn bush) in one ink colour. */
|
||||
function figure(name, { fill = "#3b2416", flip = false } = {}) {
|
||||
if (!fcache[name]) fcache[name] = FIGURES[name]();
|
||||
const tf = flip ? ' transform="translate(100 0) scale(-1 1)"' : "";
|
||||
return `<g${tf}><g fill="${fill}">${fcache[name].map((d) => `<path d="${d}"/>`).join("")}</g></g>`;
|
||||
}
|
||||
|
||||
return { svg, figure, poses: Object.keys(POSES), figures: Object.keys(FIGURES) };
|
||||
});
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
# Where the Atlas's repository is hosted. Everything that talks to the host reads this file: the daily workflow
|
||||
# (opening its pull request and issues), the "Report a run" collector, the links on the page and in the dataset
|
||||
# metadata (data/croissant.json). Moving hosts is an edit here (then `python -m collection build`).
|
||||
#
|
||||
# kind: gitea or github. The Gitea workflows live in .gitea/workflows/ (Gitea ignores .github/workflows/ when that
|
||||
# folder exists); the GitHub ones, including GitHub Pages, stay in .github/workflows/ for when GitHub is used again.
|
||||
version: 1
|
||||
|
||||
kind: gitea
|
||||
url: https://git.kenschiano.net
|
||||
repo: kathleen/threshing-atlas # owner/name on the server
|
||||
branch: main
|
||||
# public, limited (only people signed in to this server) or private: who can open the links below
|
||||
visibility: limited
|
||||
|
||||
# the published page, when it is hosted somewhere (GitHub Pages is paused while the GitHub account is suspended;
|
||||
# the page is viewed locally or as a Claude artifact meanwhile)
|
||||
site: null
|
||||
|
||||
# other copies of the repository (informational)
|
||||
mirrors:
|
||||
github: https://github.com/ekcSchiano/threshing-atlas # suspended; GitHub Pages workflow kept for later
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "threshing-atlas",
|
||||
"private": true,
|
||||
"description": "Route probabilities and path-finding for the Dragonkind threshing",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "node site/build.js",
|
||||
"dev": "node site/build.js && python3 -m http.server 8000 -d dist",
|
||||
"test:py": "python3 -m collection build --check && python3 planner/build_experiments.py --check && python3 analysis/black/evidence.py --check && python3 analysis/tree/build_tree.py --check && PYTHONPATH=core python3 -m unittest discover -s tests/core -p 'test_*.py' && python3 -m unittest discover -s tests/collection -p 'test_*.py'",
|
||||
"test:unit": "node --test tests/core/graph.test.js tests/core/advisor.test.js",
|
||||
"test": "npm run test:py && npm run test:unit",
|
||||
"graph": "node analysis/network/build-graph.js",
|
||||
"policy": "python3 planner/build_policy.py && python3 planner/policy_report.py && python3 planner/build_experiments.py && python3 analysis/black/evidence.py && python3 analysis/tree/build_tree.py",
|
||||
"cycle": "python3 -m collection cycle",
|
||||
"stats": "python3 analysis/stats/site_stats.py",
|
||||
"collect": "python3 -m collection update",
|
||||
"build-data": "python3 -m collection build"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
# planner
|
||||
|
||||
The route planner: the best route to every dragon, and what goes back to Ken's bot.
|
||||
|
||||
| File | What it does |
|
||||
|---|---|
|
||||
| `build_policy.py` | Solves the route model (`core/atlas/solver.py`, built from the game in `core/spec/game.yaml`) for every colour and both goals ("this attempt" and "eventually"), with 200 posterior draws and a cross-fit check. Writes `data/public/policy.json`, which has a content id so each bot run can record which policy it followed. About 2 minutes. |
|
||||
| `policy_report.py` | Writes the readable version, `analysis/reports/POLICY.md`. |
|
||||
|
||||
| `knowledge.yaml` | What the game's developer has said about the mechanics (paraphrased, dated, graded said / hint / declined), what the Atlas does with each statement, and the open questions with the experiment that tests each. |
|
||||
| `experiments.yaml` | The experiment plan, written by hand: what each attempt of each bot account is for (the Black attempt on attempt 1, then the meadow Blue experiment, mapping and the sentinel route), with planned counts and stopping rules. |
|
||||
| `build_experiments.py` | Checks the plan against the game, counts what the bot has logged for every arm, sets each experiment's status (running, complete, paused), and writes `data/public/experiments.json` for the bot. |
|
||||
|
||||
Run both with `npm run policy`. The site's valley map and The Odds read `policy.json`; the bot downloads it with
|
||||
`solver.js` and `graph.js` (see `docs/BOT_INTEGRATION.md`).
|
||||
|
||||
**The loop with the bot.** `python -m collection cycle --bot <the bot's folder> --deliver <its vendor folder>`
|
||||
imports the bot's new runs, refits the route model, rebuilds the experiment plan and hands both back, in one
|
||||
command that is safe to run on a timer (`docs/BOT_INTEGRATION.md`, "The automated cycle").
|
||||
@@ -0,0 +1,237 @@
|
||||
"""Build data/public/experiments.json: the experiment plan the bot follows, updated from the bot's own runs.
|
||||
|
||||
python planner/build_experiments.py [--out data/public/experiments.json] [--check]
|
||||
|
||||
Reads the design (planner/experiments.yaml), checks it against the game (core/spec/game.yaml), counts what the bot
|
||||
has logged for every arm (data/bot/trajectories-*.jsonl, matched to data/public/runs_clean.csv), and decides each
|
||||
experiment's status:
|
||||
|
||||
running still being assigned
|
||||
complete every arm has its planned number of observed rolls
|
||||
paused its stop_early rule was met (the plan needs a person)
|
||||
|
||||
The bot reads the result with assign() in core/solver.js; an experiment that is not running is no longer assigned
|
||||
and its share goes to the others. The plan has a content id (logged by the bot as planId).
|
||||
"""
|
||||
import argparse
|
||||
import glob
|
||||
import hashlib
|
||||
import itertools
|
||||
import json
|
||||
import random
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import yaml
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT / "core"))
|
||||
from atlas import model # noqa: E402
|
||||
from atlas import runs as runs_io # noqa: E402
|
||||
|
||||
DESIGN = ROOT / "planner/experiments.yaml"
|
||||
OUT = ROOT / "data/public/experiments.json"
|
||||
SAMPLING = ("best", "thompson", "uniform")
|
||||
|
||||
|
||||
def design():
|
||||
with open(DESIGN, encoding="utf-8") as f:
|
||||
return yaml.safe_load(f)
|
||||
|
||||
|
||||
def check_options(where, fixed):
|
||||
for k, o in (fixed or {}).items():
|
||||
if k not in model.DECISIONS or k in ("encounter", "cadet"):
|
||||
raise ValueError(f"{where}: '{k}' is not a decision of the game")
|
||||
if o not in model.DECISIONS[k]:
|
||||
raise ValueError(f"{where}: '{k}' has no option '{o}' (game.yaml: {model.DECISIONS[k]})")
|
||||
|
||||
|
||||
def arms(exp, routes=None):
|
||||
"""The arms of an experiment, each with the decisions it holds (`fix`): every combination of the factors, or
|
||||
the explicit `arms` (one `change` to the route each), or a single arm. A `cycle` arm also carries the decisions
|
||||
it varies from attempt to attempt."""
|
||||
route = exp.get("route") or {}
|
||||
if isinstance(route, str):
|
||||
if route not in (routes or {}):
|
||||
raise ValueError(f"{exp['id']}: unknown route '{route}'")
|
||||
route = routes[route]
|
||||
check_options(exp["id"] + " route", route)
|
||||
if exp.get("arms"):
|
||||
out = []
|
||||
for a in exp["arms"]:
|
||||
check_options(f"{exp['id']} arm {a['id']}", a.get("change"))
|
||||
out.append({"id": a["id"], "change": a.get("change") or {}, "fix": {**route, **(a.get("change") or {})}})
|
||||
if len({a["id"] for a in out}) != len(out):
|
||||
raise ValueError(f"{exp['id']}: arm ids must be unique")
|
||||
return out
|
||||
if exp.get("cycle"):
|
||||
for k, opts in exp["cycle"].items():
|
||||
if k in route:
|
||||
raise ValueError(f"{exp['id']}: '{k}' is both cycled and part of the route")
|
||||
for o in opts:
|
||||
check_options(exp["id"] + " cycle", {k: o})
|
||||
return [{"id": "all", "fix": dict(route), "cycle": exp["cycle"]}]
|
||||
factors = exp.get("factors") or {}
|
||||
for k, opts in factors.items():
|
||||
if k in route:
|
||||
raise ValueError(f"{exp['id']}: '{k}' is both a factor and part of the route")
|
||||
for o in opts:
|
||||
check_options(exp["id"] + " factors", {k: o})
|
||||
if not factors:
|
||||
return [{"id": "all", "fix": dict(route)}]
|
||||
out = []
|
||||
for combo in itertools.product(*factors.values()):
|
||||
levels = dict(zip(factors, combo))
|
||||
out.append({"id": " / ".join(f"{k}={o}" for k, o in levels.items()), "levels": levels, "fix": {**route, **levels}})
|
||||
return out
|
||||
|
||||
|
||||
def validate(d):
|
||||
ids = [e["id"] for e in d["experiments"]]
|
||||
if len(set(ids)) != len(ids):
|
||||
raise ValueError("experiment ids must be unique")
|
||||
for e in d["experiments"]:
|
||||
if e.get("starts_after") and e["starts_after"] not in ids:
|
||||
raise ValueError(f"{e['id']}: starts_after names no experiment")
|
||||
for k in (e.get("when") or {}):
|
||||
if k not in (d.get("record") or []):
|
||||
raise ValueError(f"{e['id']}: when.{k} is not something the bot records (`record`)")
|
||||
if e["target"] not in model.COLOURS:
|
||||
raise ValueError(f"{e['id']}: unknown target {e['target']}")
|
||||
if e.get("sampling", "best") not in SAMPLING:
|
||||
raise ValueError(f"{e['id']}: sampling must be one of {SAMPLING}")
|
||||
if e["unit"] not in ("account", "attempt"):
|
||||
raise ValueError(f"{e['id']}: unit must be account or attempt")
|
||||
if not e.get("share", 0) > 0:
|
||||
raise ValueError(f"{e['id']}: share must be positive")
|
||||
m = e.get("measures")
|
||||
if m and (m["roll"] not in model.CHANCE or m["rare"] not in model.CHANCE[m["roll"]]["outcomes"]):
|
||||
raise ValueError(f"{e['id']}: measures {m} is not a roll and outcome of the game")
|
||||
if not e.get("ongoing") and not e.get("planned_per_arm"):
|
||||
raise ValueError(f"{e['id']}: needs planned_per_arm (or ongoing: true)")
|
||||
|
||||
|
||||
def interval(y, n, seed=1, sims=4000):
|
||||
"""Jeffreys 90% range for a rate."""
|
||||
if not n:
|
||||
return None
|
||||
r = random.Random(seed)
|
||||
s = sorted(r.betavariate(y + 0.5, n - y + 0.5) for _ in range(sims))
|
||||
return {"rate": (y + 0.5) / (n + 1), "lo": s[int(0.05 * sims)], "hi": s[int(0.95 * sims) - 1]}
|
||||
|
||||
|
||||
def logged(bot_dir=ROOT / "data/bot", runs_path=None):
|
||||
"""Bot runs that carry an experiment: [(experimentId, arm, prepared run)], each run once."""
|
||||
prepared = {r["run_id"]: model.prepare_run(r) for r in runs_io.read(runs_path or runs_io.PATH, sources=["bot"], drop=())}
|
||||
seen, out = set(), []
|
||||
for f in sorted(glob.glob(str(Path(bot_dir) / "trajectories-*.jsonl"))):
|
||||
if "sample" in Path(f).name:
|
||||
continue
|
||||
with open(f, encoding="utf-8") as fh:
|
||||
for line in fh:
|
||||
t = json.loads(line)
|
||||
meta = t.get("meta") or {}
|
||||
if not meta.get("experimentId") or t["id"] in seen:
|
||||
continue
|
||||
seen.add(t["id"])
|
||||
out.append((meta["experimentId"], meta.get("arm"), prepared.get(t["id"])))
|
||||
return out
|
||||
|
||||
|
||||
def build(d=None, log=None):
|
||||
d = d or design()
|
||||
validate(d)
|
||||
log = logged() if log is None else log
|
||||
exps, status_of = [], {}
|
||||
for e in d["experiments"]:
|
||||
m = e.get("measures")
|
||||
a = arms(e, d.get("routes"))
|
||||
tally = {x["id"]: {"runs": 0, "observed": 0, "rare": 0} for x in a}
|
||||
for exp_id, arm, v in log:
|
||||
if exp_id != e["id"]:
|
||||
continue
|
||||
if a[0].get("cycle"): # a cycled arm is logged under the combination it played: all one arm here
|
||||
arm = a[0]["id"]
|
||||
t = tally.setdefault(arm or "?", {"runs": 0, "observed": 0, "rare": 0})
|
||||
t["runs"] += 1
|
||||
y = model.OBSERVE[m["roll"]](v) if m and v else None
|
||||
if y is not None:
|
||||
t["observed"] += 1
|
||||
t["rare"] += y == m["rare"]
|
||||
planned = e.get("planned_per_arm")
|
||||
# mapping has nothing to measure: its runs are its count
|
||||
done = {k: (t["observed"] if m else t["runs"]) for k, t in tally.items() if k in {x["id"] for x in a}}
|
||||
total_obs = sum(t["observed"] for t in tally.values())
|
||||
total_rare = sum(t["rare"] for t in tally.values())
|
||||
status, note = "running", None
|
||||
se = e.get("stop_early")
|
||||
if e.get("starts_after") and status_of.get(e["starts_after"]) != "complete":
|
||||
status, note = "waiting", f"starts when {e['starts_after']} is complete"
|
||||
elif not e.get("ongoing") and all(n >= planned for n in done.values()):
|
||||
status, note = "complete", f"every arm has its planned {planned}"
|
||||
elif se and total_obs >= se["after"] and total_rare <= se["rare_at_most"]:
|
||||
status = "paused"
|
||||
note = f"stop_early: {total_rare} rare outcome(s) in {total_obs} observed rolls (rule: at most {se['rare_at_most']} after {se['after']})"
|
||||
for x in a:
|
||||
t = tally[x["id"]]
|
||||
x["progress"] = {**t, "planned": planned, **({"estimate": interval(t["rare"], t["observed"])} if m and t["observed"] else {})}
|
||||
status_of[e["id"]] = status
|
||||
exps.append({
|
||||
"id": e["id"], "status": status, **({"note": note} if note else {}),
|
||||
"question": e["question"], "attempts": {"from": e["attempts"]["from"], "to": e["attempts"].get("to")},
|
||||
"unit": e["unit"], "share": e["share"], **({"accounts": e["accounts"]} if e.get("accounts") else {}),
|
||||
**({"exclusive": True} if e.get("exclusive") else {}),
|
||||
**({"when": e["when"]} if e.get("when") else {}),
|
||||
"target": e["target"], "objective": e.get("objective", "eventually"), "sampling": e.get("sampling", "best"),
|
||||
"seed": d["seed"], "measures": m, "burn": e.get("burn"), "arms": a,
|
||||
"progress": {"runs": sum(t["runs"] for t in tally.values()), "observed": total_obs, "rare": total_rare,
|
||||
**({"estimate": interval(total_rare, total_obs)} if m and total_obs else {}),
|
||||
"unknownArms": sorted(k for k in tally if k not in {x["id"] for x in a})},
|
||||
})
|
||||
for s in (d.get("scripts") or {}).values():
|
||||
for st in s:
|
||||
for k in ("take", "never"):
|
||||
re.compile(st.get(k) or "")
|
||||
plan = {"schema": 2, "seed": d["seed"], "lifecycle": d["lifecycle"], "record": d.get("record") or [],
|
||||
"scripts": d.get("scripts") or {}, "screenPicks": d.get("screen_picks") or [], "experiments": exps}
|
||||
plan["id"] = hashlib.sha1(json.dumps(plan, sort_keys=True, separators=(",", ":")).encode()).hexdigest()[:12]
|
||||
return plan
|
||||
|
||||
|
||||
def render(plan):
|
||||
return json.dumps(plan, indent=1, ensure_ascii=False) + "\n"
|
||||
|
||||
|
||||
def summary(plan):
|
||||
L = [f"experiment plan {plan['id']}"]
|
||||
for e in plan["experiments"]:
|
||||
p = e["progress"]
|
||||
est = p.get("estimate")
|
||||
L.append(f" {e['id']:<26} {e['status']:<9} {p['observed']} observed, {p['rare']} rare"
|
||||
+ (f" ({100 * est['rate']:.1f}%, 90% range {100 * est['lo']:.1f}-{100 * est['hi']:.1f})" if est else "")
|
||||
+ (f" [{e['note']}]" if e.get("note") else ""))
|
||||
return "\n".join(L)
|
||||
|
||||
|
||||
def main(argv=None):
|
||||
ap = argparse.ArgumentParser(description=__doc__)
|
||||
ap.add_argument("--out", default=str(OUT))
|
||||
ap.add_argument("--check", action="store_true", help="write nothing; exit 1 if the file is out of date")
|
||||
a = ap.parse_args(argv)
|
||||
plan = build()
|
||||
text = render(plan)
|
||||
out = Path(a.out)
|
||||
if a.check:
|
||||
if not out.exists() or out.read_text(encoding="utf-8") != text:
|
||||
print(f"{out} is out of date (run python planner/build_experiments.py)", file=sys.stderr)
|
||||
return 1
|
||||
return 0
|
||||
out.write_text(text, encoding="utf-8")
|
||||
print(summary(plan))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,90 @@
|
||||
"""Build data/public/policy.json: the best decisions for every dragon colour, under both objectives.
|
||||
|
||||
python planner/build_policy.py [--draws 200] [--out data/public/policy.json]
|
||||
|
||||
Two samples, from the runs and rules in planner/policy.yaml: every run, and a low-bias sample (bot runs, bulk logs,
|
||||
and riders not chasing a rare dragon).
|
||||
The output has a content id, so each bot run can record which policy it followed.
|
||||
"""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import math
|
||||
import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT / "core"))
|
||||
from atlas import model, solver # noqa: E402
|
||||
from atlas import runs as runs_io # noqa: E402
|
||||
|
||||
import yaml # noqa: E402
|
||||
|
||||
# which runs the model learns from, and the low-bias sample (planner/policy.yaml)
|
||||
with open(ROOT / "planner/policy.yaml", encoding="utf-8") as _f:
|
||||
CONFIG = yaml.safe_load(_f)
|
||||
SOURCES = CONFIG["sources"]
|
||||
|
||||
|
||||
def low_bias(r, lb=CONFIG["low_bias"]):
|
||||
"""Kept in the low-bias sample: every run of an always-kept source, bulk logs, and riders not chasing a rare dragon."""
|
||||
if r["source"] in lb["always"]:
|
||||
return True
|
||||
if r["source"] == "reddit spreadsheet" and "bulk" in lb["entries_kept"] and r["entry"] not in (None, "Form"):
|
||||
return True
|
||||
return r["goal"] not in lb["rare_goals"]
|
||||
|
||||
|
||||
def clean(o):
|
||||
"""JSON-safe: numpy numbers to floats, infinities and NaN to null (as JavaScript's JSON.stringify does)."""
|
||||
if isinstance(o, dict):
|
||||
return {str(k): clean(v) for k, v in o.items()}
|
||||
if isinstance(o, (list, tuple)):
|
||||
return [clean(v) for v in o]
|
||||
if hasattr(o, "item"):
|
||||
o = o.item()
|
||||
if isinstance(o, float) and (math.isinf(o) or math.isnan(o)):
|
||||
return None
|
||||
return o
|
||||
|
||||
|
||||
def main(argv=None):
|
||||
ap = argparse.ArgumentParser(description=__doc__)
|
||||
ap.add_argument("--draws", type=int, default=200)
|
||||
ap.add_argument("--data", default=str(runs_io.PATH))
|
||||
ap.add_argument("--out", default=str(ROOT / "data/public/policy.json"))
|
||||
a = ap.parse_args(argv)
|
||||
|
||||
runs = runs_io.read(a.data, sources=SOURCES)
|
||||
rows = len(runs)
|
||||
samples = {
|
||||
"all": runs,
|
||||
"lowBias": [r for r in runs if low_bias(r)],
|
||||
}
|
||||
t0 = time.time()
|
||||
by_source = {}
|
||||
for r in runs:
|
||||
by_source[r["source"]] = by_source.get(r["source"], 0) + 1
|
||||
out = {"schema": 1, "source": {"form_rows": by_source.get("reddit spreadsheet", 0), "runs": rows, "by_source": by_source},
|
||||
"samples": {}}
|
||||
for name, rs in samples.items():
|
||||
out["samples"][name] = clean(solver.build_policy(rs, draws=a.draws, bias_config=CONFIG.get("reporting_bias")))
|
||||
print(f"{name}: {len(rs)} runs, {time.time() - t0:.1f} s")
|
||||
# a content id (no timestamps: the build is reproducible)
|
||||
out["id"] = hashlib.sha1(json.dumps(out["samples"], separators=(",", ":"), sort_keys=True).encode()).hexdigest()[:12]
|
||||
Path(a.out).write_text(json.dumps(out, separators=(",", ":")), encoding="utf-8")
|
||||
print("policy id", out["id"])
|
||||
pct = lambda p: "–" if p is None else f"{100 * p:.{2 if p < 0.01 else 1}f}%" # noqa: E731
|
||||
for name, s in out["samples"].items():
|
||||
print(f"\n{name} alphas {json.dumps(s['model']['alphas'])}")
|
||||
for X, t in s["targets"].items():
|
||||
x, e = t["thisAttempt"], t["eventually"]
|
||||
att = e["expectedAttempts"]["mean"]
|
||||
print(f" {X:<6} this attempt {pct(x['pX']['mean'])} [{pct(x['pX']['lo'])}, {pct(x['pX']['hi'])}] other bond {pct(x['pOther']['mean'])}"
|
||||
f" | eventually: ratio {pct(e['ratio']['mean'])}, P(X) {pct(e['pX']['mean'])}, ~{'–' if att is None else round(att)} attempts"
|
||||
f" | cross-fit {pct(t['crossFit']['inSample'])} -> held-out {pct(t['crossFit']['heldOut'])}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,246 @@
|
||||
# The experiment plan for Ken's bot: what each attempt of each account is for.
|
||||
#
|
||||
# This file is the design (written by hand). planner/build_experiments.py checks it against the game
|
||||
# (core/spec/game.yaml), counts what the bot has run so far, decides which experiments are running, and writes
|
||||
# data/public/experiments.json. The bot reads that file with assign() in core/solver.js. The cycle
|
||||
# (python -m collection cycle) rebuilds it after every import of bot runs, so the plan follows the data.
|
||||
#
|
||||
# Version 2 (2026-11-16). The developer has said the Black is not dice: it shows when a rider's choices meet its
|
||||
# conditions (planner/knowledge.yaml), and riders report it almost only on a first attempt, on many different
|
||||
# routes (analysis/reports/BLACK.md). So the Black experiments no longer estimate a rate. They look for the rule:
|
||||
# hold one exact path fixed on fresh accounts, see whether the answer is always the same, then change one choice
|
||||
# at a time. Because the answer is not dice, a few accounts per question are enough.
|
||||
#
|
||||
# Rules that keep the results honest:
|
||||
# - counts are planned in advance; an experiment does not stop because its results look good;
|
||||
# - every started attempt is logged, including aborted ones, and every screen with its options and the pick;
|
||||
# - the bot never accepts a bond that is not the experiment's target colour (it burns), and it does accept a
|
||||
# genuine Black or Blue bond.
|
||||
version: 2
|
||||
seed: 20261116 # changes every arm assignment: leave it alone once accounts are running
|
||||
|
||||
# ---------------------------------------------------------------- an account's life
|
||||
lifecycle:
|
||||
# attempt 1 of every new account is the Black attempt, on one exact path (fresh-replicate, then fresh-ablate)
|
||||
research_days: 3 # then the account collects route data for this long (about 18 attempts at 4 hours each)
|
||||
retire: true # and stops, except the long-lived accounts
|
||||
long_lived: { every: 10, take: 2 } # two accounts in ten keep running (veteran-repeat and veteran-variety)
|
||||
|
||||
# What the bot records about the account on every run, beyond the steps: the Black's conditions rest on choices and
|
||||
# on what the site knows about the account, so anything that could be such a fact is kept.
|
||||
record:
|
||||
- accountSeq # the account's number, in the order the accounts were made
|
||||
- accountAttempt # 1 = the account's first threshing
|
||||
- accountCreatedAt # when the account was made (UTC)
|
||||
- wing # the cadet's assignment, as the site shows it
|
||||
- section
|
||||
- squad
|
||||
- sawShadowBefore # whether any earlier run of the account showed the shadow
|
||||
|
||||
# ---------------------------------------------------------------- named paths
|
||||
routes:
|
||||
# The recorded route with the most first-attempt shadows in the community form: 21 in 79 first attempts, 1 in 80
|
||||
# later ones (BLACK.md section 2).
|
||||
best-reported:
|
||||
company: Alone
|
||||
direction: West
|
||||
react: Hold still
|
||||
scream: Investigate the scream
|
||||
clearing: Help your squadmate
|
||||
fight: Pause to assess
|
||||
dagger: Engage the smaller cadet
|
||||
fate: Squadmate's revenge
|
||||
post: West
|
||||
hour: Tree
|
||||
|
||||
# ---------------------------------------------------------------- what to do once the shadow shows
|
||||
# The sequence in the notes of riders who bonded the Black (BLACK.md section 5), as keywords of the option to
|
||||
# take on each screen, in order. The bot has never seen these screens, and a shadow must not be wasted: where a
|
||||
# screen matches nothing here it should stop and notify a person, not guess.
|
||||
scripts:
|
||||
shadow:
|
||||
- { step: the tree top, take: "shadow", never: "green|descend" }
|
||||
- { step: asked to turn back, take: "stay the course|certain you saw", never: "second thought|green" }
|
||||
- { step: asked again, take: "intriguing|even if this kills", never: "second thought|green" }
|
||||
- { step: the Blue lands, take: "freeze and lower", never: "approach|run" }
|
||||
- { step: another cadet arrives, take: "hold (completely )?still", never: "warn|turn while|approach" }
|
||||
- { step: the Blue burns the cadet, take: "hold (your )?position", never: "interven|approach|warn" }
|
||||
- { step: the Blue judges, take: "head lowered|await.*judg", never: "approach|sure" }
|
||||
- { step: the Blue has left, take: "help the .*cadet", never: "" }
|
||||
- { step: the cadet's burns, take: "wrap|cut .*sleeve|dagger to cut", never: "" }
|
||||
- { step: moving on, take: "head south", never: "" }
|
||||
- { step: a branch snaps, take: "turn to face", never: "ignore" }
|
||||
- { step: the Black, take: "hold (its|it's|the) gaze|lift your chin", never: "lower your eyes" }
|
||||
|
||||
# ---------------------------------------------------------------- picks made from the screen tree
|
||||
# The route advisor knows the game down to the bonding encounter. Past that, and wherever an experiment leaves a
|
||||
# screen free, the bot picks with screenPick() in core/solver.js from data/public/tree.json (every screen, every
|
||||
# option, where each led). First match wins.
|
||||
screen_picks:
|
||||
# the shadow: follow the reported sequence (scripts.shadow), and stop where it does not match
|
||||
- { where: after the shadow shows, use: script, script: shadow }
|
||||
# a Blue or a Black is scarce and its answers are mostly untested (analysis/reports/TREE.md): learn them
|
||||
- { where: bonding the target dragon, use: thompson }
|
||||
# mapping: fill the tree's gaps, least-played option first
|
||||
- { where: experiment mapping, use: least-tried }
|
||||
|
||||
# ---------------------------------------------------------------- the experiments
|
||||
# attempts: which of an account's attempts it covers (from / to, inclusive; no `to` = from then on).
|
||||
# unit: what is randomised. account = one arm for the account's life; attempt = balanced blocks within an account.
|
||||
# exclusive: takes every attempt it covers; the shared experiments (share) split the rest.
|
||||
# accounts: { every: N, take: K, offset: J } limits it to K accounts in every N, starting at the J-th.
|
||||
# when: facts about the account that must hold (from `record`).
|
||||
# starts_after: waits until that experiment is complete.
|
||||
# route: decisions held on every arm (a name from `routes`, or a mapping). factors: every combination is an arm.
|
||||
# arms: explicit arms, each a `change` to the route (one choice at a time). cycle: a different combination of
|
||||
# these decisions on every attempt, never repeating until all are used.
|
||||
# measures: the roll or guard and the outcome that are counted. planned_per_arm: observed outcomes per arm.
|
||||
experiments:
|
||||
- id: fresh-replicate
|
||||
question: On a fresh account, does one exact path always show the shadow, sometimes, or never?
|
||||
why: >
|
||||
If the Black is decided by this run's choices alone, identical choices on fresh accounts must agree: all
|
||||
shadow or none. If they disagree, fresh accounts differ in something the site knows and we do not record
|
||||
yet, and comparing the accounts that saw it with those that did not is how to find it.
|
||||
attempts: { from: 1, to: 1 }
|
||||
unit: account
|
||||
exclusive: true
|
||||
share: 1
|
||||
target: Black
|
||||
route: best-reported
|
||||
measures: { roll: shadow, rare: "yes" }
|
||||
planned_per_arm: 60 # if riders' 27% is three to four times too high, about 4 to 16 shadows
|
||||
burn: { reason: TREE_NO_SHADOW_AUTO_BURN, when: no shadow at the tree }
|
||||
|
||||
- id: fresh-ablate
|
||||
question: Which choices on that path does the shadow need?
|
||||
why: Change one choice, keep the rest. The developer hints at about five conditions, two of them the known gates.
|
||||
starts_after: fresh-replicate
|
||||
attempts: { from: 1, to: 1 }
|
||||
unit: account
|
||||
exclusive: true
|
||||
share: 1
|
||||
target: Black
|
||||
route: best-reported
|
||||
arms:
|
||||
- { id: with one squadmate, change: { company: 1 Squadmate, leave: Stay together } }
|
||||
- { id: with two squadmates, change: { company: 2 Squadmates, leave: Stay together } }
|
||||
- { id: leave the squad, change: { company: 2 Squadmates, leave: Leave them } }
|
||||
- { id: east first, change: { direction: East } }
|
||||
- { id: centre first, change: { direction: Center } }
|
||||
- { id: face the first dragon, change: { react: Respect / face it } }
|
||||
- { id: charge the smaller cadet, change: { fight: Charge the smaller cadet } }
|
||||
- { id: charge the bigger cadet, change: { dagger: Charge the bigger cadet anyway } }
|
||||
- { id: kill the bullies, change: { fate: Killed the bullies yourself } }
|
||||
- { id: leave the bullies, change: { fate: Left bullies to the dragons } }
|
||||
- { id: fork to the forest, change: { post: Forest } }
|
||||
- { id: fork east, change: { post: East } }
|
||||
measures: { roll: shadow, rare: "yes" }
|
||||
planned_per_arm: 15 # set from fresh-replicate: enough that "none" is not bad luck at the rate found there
|
||||
burn: { reason: TREE_NO_SHADOW_AUTO_BURN, when: no shadow at the tree }
|
||||
|
||||
- id: shadow-again
|
||||
question: Does an account that saw the shadow, and died, see it again on the same path?
|
||||
why: The cleanest test of fresh against veteran. About three in ten riders who reach the Black die there.
|
||||
attempts: { from: 2, to: 4 }
|
||||
when: { sawShadowBefore: true }
|
||||
unit: account
|
||||
exclusive: true
|
||||
share: 1
|
||||
target: Black
|
||||
route: best-reported
|
||||
measures: { roll: shadow, rare: "yes" }
|
||||
planned_per_arm: 12
|
||||
burn: { reason: TREE_NO_SHADOW_AUTO_BURN, when: no shadow at the tree }
|
||||
|
||||
- id: second-attempt-same-path
|
||||
question: Does an account that missed on its first attempt miss again on the same path?
|
||||
why: The form shows 21 in 79 on first attempts and 1 in 80 later on this route; the bot can check it on identical paths.
|
||||
attempts: { from: 2, to: 2 }
|
||||
when: { sawShadowBefore: false }
|
||||
accounts: { every: 2, take: 1, offset: 0 }
|
||||
unit: account
|
||||
exclusive: true
|
||||
share: 1
|
||||
target: Black
|
||||
route: best-reported
|
||||
measures: { roll: shadow, rare: "yes" }
|
||||
planned_per_arm: 60
|
||||
burn: { reason: TREE_NO_SHADOW_AUTO_BURN, when: no shadow at the tree }
|
||||
|
||||
- id: veteran-repeat
|
||||
question: Does an older account open up by repeating one path?
|
||||
why: >
|
||||
The developer says a run never hurts and names twenty as a count that matters. No bot account has repeated
|
||||
one route more than 11 times in a row.
|
||||
attempts: { from: 3 }
|
||||
when: { sawShadowBefore: false }
|
||||
accounts: { every: 10, take: 1, offset: 0 }
|
||||
unit: account
|
||||
exclusive: true
|
||||
share: 1
|
||||
target: Black
|
||||
route: best-reported
|
||||
measures: { roll: shadow, rare: "yes" }
|
||||
planned_per_arm: 300
|
||||
burn: { reason: TREE_NO_SHADOW_AUTO_BURN, when: no shadow at the tree }
|
||||
|
||||
- id: veteran-variety
|
||||
question: Does an older account open up by varying its choices?
|
||||
why: The opposite of veteran-repeat, on the next account. A different combination every attempt, both gates kept.
|
||||
attempts: { from: 3 }
|
||||
when: { sawShadowBefore: false }
|
||||
accounts: { every: 10, take: 1, offset: 1 }
|
||||
unit: account
|
||||
exclusive: true
|
||||
share: 1
|
||||
target: Black
|
||||
route: { scream: Investigate the scream, clearing: Help your squadmate, hour: Tree }
|
||||
cycle:
|
||||
company: [Alone, 1 Squadmate, 2 Squadmates]
|
||||
direction: [West, East, Center]
|
||||
fight: [Pause to assess, Charge the smaller cadet, Charge between the bigger cadet and your squadmate]
|
||||
dagger: [Engage the smaller cadet, Charge the bigger cadet anyway]
|
||||
fate: [Killed the bullies yourself, Squadmate's revenge, Left bullies to the dragons]
|
||||
post: [Forest, West, East]
|
||||
measures: { roll: shadow, rare: "yes" }
|
||||
planned_per_arm: 300
|
||||
burn: { reason: TREE_NO_SHADOW_AUTO_BURN, when: no shadow at the tree }
|
||||
|
||||
- id: meadow-blue-route
|
||||
question: Does anything before the meadow change how often the Blue waits there?
|
||||
why: >
|
||||
The developer says the Blue is dice from the seed. Complete logs show a Blue on about 10% of meadow visits
|
||||
whatever the route; random assignment confirms it or finds the scene where the odds differ.
|
||||
attempts: { from: 2 }
|
||||
unit: attempt
|
||||
share: 0.5
|
||||
target: Blue
|
||||
factors: { scream: [Investigate the scream, Keep walking], direction: [West, East, Center] }
|
||||
route: { hour: Valley, valley: Pass the Red (meadow) }
|
||||
measures: { roll: meadow, rare: Blue }
|
||||
planned_per_arm: 70 # 210 per scream choice, 140 per direction: enough to tell 10% from 20%
|
||||
burn: { reason: MEADOW_NO_BLUE_AUTO_BURN, when: no Blue in the meadow }
|
||||
|
||||
- id: mapping
|
||||
question: What does every option on every screen lead to?
|
||||
why: Probabilities for every path need runs on the paths nobody chooses. The game has about 24 million paths, so this maps screens, not paths.
|
||||
attempts: { from: 2 }
|
||||
unit: attempt
|
||||
share: 0.35
|
||||
target: Blue
|
||||
sampling: uniform
|
||||
planned_per_arm: 1000
|
||||
burn: { reason: NOT_TARGET_AUTO_BURN, when: the encounter is not a Blue or a Black }
|
||||
|
||||
- id: sentinel
|
||||
question: Have the game's odds changed?
|
||||
why: One fixed route, run all the time by accounts that log everything. It is the most-logged meadow route.
|
||||
attempts: { from: 2 }
|
||||
unit: attempt
|
||||
share: 0.15
|
||||
target: Blue
|
||||
route: { company: Alone, direction: Center, scream: Keep walking, wounded: Tourniquet, hour: Valley, valley: Pass the Red (meadow) }
|
||||
measures: { roll: meadow, rare: Blue }
|
||||
ongoing: true
|
||||
burn: { reason: MEADOW_NO_BLUE_AUTO_BURN, when: no Blue in the meadow }
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user