Compare commits
58
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b4a72a08a9 | ||
|
|
a195a8a483 | ||
|
|
c1d3840d94 | ||
|
|
0035483048 | ||
|
|
ff164ffaeb | ||
|
|
986cdd9c0a | ||
|
|
70d0542ce8 | ||
|
|
57839fcc87 | ||
|
|
7ef8a58a0e | ||
|
|
27ba5fbcbc | ||
|
|
8152c1da0a | ||
|
|
40f068abe5 | ||
|
|
ef14ecaaa5 | ||
|
|
6467ce86a7 | ||
|
|
a9836c3191 | ||
|
|
197c16dac0 | ||
|
|
f3bbde24b7 | ||
|
|
e61134ecc8 | ||
|
|
66181b8489 | ||
|
|
df0e576a0a | ||
|
|
c7978b4538 | ||
|
|
d6894bbd63 | ||
|
|
3206c65d59 | ||
|
|
574fa50b2a | ||
|
|
30aabdf084 | ||
|
|
78e069f03f | ||
|
|
f1027212b6 | ||
|
|
f41bd22439 | ||
|
|
d17155282a | ||
|
|
d301e71d79 | ||
|
|
9af9762314 | ||
|
|
6fae8a9833 | ||
|
|
47da9f1f82 | ||
|
|
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 |
@@ -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,60 @@
|
|||||||
|
# When the route model changes on main, send it to the bot: open (or update) a pull request on the bot's repo,
|
||||||
|
# DragonKind/DragonKind, that replaces vendor/threshing-atlas/{policy.json,solver.js,graph.js} with this repo's
|
||||||
|
# data/public/policy.json, core/solver.js and core/graph.js. The three always travel together, so the policy and the
|
||||||
|
# solver that reads it never get out of step. Ken reviews and merges it; the running bot reloads the files after a pull.
|
||||||
|
#
|
||||||
|
# Secrets: ATLAS_BOT_TOKEN (repository: read and write, with write access to DragonKind/DragonKind).
|
||||||
|
name: Send the route model to the bot
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- data/public/policy.json
|
||||||
|
- core/solver.js
|
||||||
|
- core/graph.js
|
||||||
|
workflow_dispatch:
|
||||||
|
jobs:
|
||||||
|
send:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.ATLAS_BOT_TOKEN }}
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: "3.12"
|
||||||
|
- run: pip install -r requirements.txt # `python -m collection` loads the whole package
|
||||||
|
- name: Open or update the pull request on the bot's repo
|
||||||
|
env:
|
||||||
|
ATLAS_BOT_TOKEN: ${{ secrets.ATLAS_BOT_TOKEN }}
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
dst="$RUNNER_TEMP/dragonkind"
|
||||||
|
export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0="http.https://git.kenschiano.net/.extraheader" \
|
||||||
|
GIT_CONFIG_VALUE_0="AUTHORIZATION: token $ATLAS_BOT_TOKEN"
|
||||||
|
git clone --quiet --depth 1 https://git.kenschiano.net/DragonKind/DragonKind.git "$dst"
|
||||||
|
mkdir -p "$dst/vendor/threshing-atlas"
|
||||||
|
cp data/public/policy.json core/solver.js core/graph.js "$dst/vendor/threshing-atlas/"
|
||||||
|
id=$(python3 -c "import json; print(json.load(open('data/public/policy.json')).get('id', ''))")
|
||||||
|
sha=$(git rev-parse --short HEAD)
|
||||||
|
cd "$dst"
|
||||||
|
if [ -z "$(git status --porcelain -- vendor/threshing-atlas)" ]; then
|
||||||
|
echo "The bot already has route model $id."; exit 0
|
||||||
|
fi
|
||||||
|
git config user.name "Atlas data bot"
|
||||||
|
git config user.email "atlas-bot@noreply.localhost"
|
||||||
|
git checkout -q -b atlas/route-model
|
||||||
|
git add vendor/threshing-atlas
|
||||||
|
git commit -q -m "Threshing Atlas route model $id (atlas $sha)"
|
||||||
|
git push -q --force origin atlas/route-model
|
||||||
|
cd "$GITHUB_WORKSPACE"
|
||||||
|
printf '%s\n' \
|
||||||
|
"The Threshing Atlas route model changed (policy \`$id\`, atlas commit \`$sha\`)." \
|
||||||
|
"" \
|
||||||
|
"This replaces \`vendor/threshing-atlas/\` (policy.json, solver.js, graph.js) together, as \`npm run atlas:sync\` would." \
|
||||||
|
"This pull request is updated in place each time the model changes. After merging, pull on the bot's machine:" \
|
||||||
|
"the running bot reloads the files on its next decision." \
|
||||||
|
"" \
|
||||||
|
"Opened automatically by the Atlas's push-policy workflow." > "$RUNNER_TEMP/body.md"
|
||||||
|
python -m collection forge open-pr --repo DragonKind/DragonKind --base main --head atlas/route-model \
|
||||||
|
--title "Threshing Atlas route model update" --body-file "$RUNNER_TEMP/body.md"
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
# 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
|
||||||
|
# DK_ACCOUNT_SALT the salt that turns bot account names into anonymous keys (keep it the same forever). With it,
|
||||||
|
# the bot's private repo (DragonKind/DragonKind) is downloaded and imported; without it, skipped.
|
||||||
|
# DRAGONKIND_TOKEN optional: a read-only token for the bot's repo (ATLAS_BOT_TOKEN is used otherwise)
|
||||||
|
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
|
||||||
|
- name: Download the bot's data (DragonKind/DragonKind, private)
|
||||||
|
env:
|
||||||
|
DK_TOKEN: ${{ secrets.DRAGONKIND_TOKEN || secrets.ATLAS_BOT_TOKEN }}
|
||||||
|
DK_ACCOUNT_SALT: ${{ secrets.DK_ACCOUNT_SALT }}
|
||||||
|
run: |
|
||||||
|
if [ -n "$DK_TOKEN" ] && [ -n "$DK_ACCOUNT_SALT" ]; then
|
||||||
|
GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0="http.https://git.kenschiano.net/.extraheader" \
|
||||||
|
GIT_CONFIG_VALUE_0="AUTHORIZATION: token $DK_TOKEN" \
|
||||||
|
git clone --quiet --depth 1 https://git.kenschiano.net/DragonKind/DragonKind.git "$RUNNER_TEMP/dragonkind"
|
||||||
|
echo "DRAGONKIND_BOT_DIR=$RUNNER_TEMP/dragonkind" >> "$GITHUB_ENV"
|
||||||
|
else
|
||||||
|
echo "DK_ACCOUNT_SALT is not set: the bot source is skipped"
|
||||||
|
fi
|
||||||
|
- id: check
|
||||||
|
env:
|
||||||
|
ATLAS_BOT_TOKEN: ${{ secrets.ATLAS_BOT_TOKEN }}
|
||||||
|
DK_ACCOUNT_SALT: ${{ secrets.DK_ACCOUNT_SALT }}
|
||||||
|
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
|
||||||
|
# not when the combined runs failed validation: the issue below reports the new answers instead
|
||||||
|
if: steps.check.outputs.changed == 'true' && !contains(steps.check.outputs.failed, 'build')
|
||||||
|
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: Send a changed route PDF to the bot (its private repo; the PDF is never published here)
|
||||||
|
if: always() && steps.check.outcome == 'success'
|
||||||
|
continue-on-error: true
|
||||||
|
env:
|
||||||
|
ATLAS_BOT_TOKEN: ${{ secrets.ATLAS_BOT_TOKEN }}
|
||||||
|
run: python -m collection send-pdf
|
||||||
|
- name: Open a pull request with the new data (it merges itself once CI passes)
|
||||||
|
if: steps.check.outputs.changed == 'true' && !contains(steps.check.outputs.failed, 'build')
|
||||||
|
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: always() && 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"
|
||||||
@@ -9,7 +9,8 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
value: |
|
value: |
|
||||||
Thanks for reporting a run! Answer what you remember; leave anything you're unsure of on "Not sure".
|
Thanks for reporting a run! Answer what you remember; leave anything you're unsure of on "Not sure".
|
||||||
Every answer here is **public** (this is a GitHub issue) and goes into the Atlas's open data as source "reported".
|
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.
|
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.
|
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
|
- type: dropdown
|
||||||
|
|||||||
@@ -50,10 +50,7 @@ jobs:
|
|||||||
- name: Rebuild the analysis and run tests
|
- name: Rebuild the analysis and run tests
|
||||||
if: steps.check.outputs.changed == 'true'
|
if: steps.check.outputs.changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
node analysis/network/build-graph.js
|
python -m collection rebuild
|
||||||
npm run policy
|
|
||||||
npm run stats
|
|
||||||
python -m collection build
|
|
||||||
npm test
|
npm test
|
||||||
- name: Encrypt the raw store
|
- name: Encrypt the raw store
|
||||||
id: archive
|
id: archive
|
||||||
|
|||||||
@@ -238,3 +238,6 @@ undefined/
|
|||||||
# hand-off zips and local reports (python -m collection export-bot-kit / refresh)
|
# hand-off zips and local reports (python -m collection export-bot-kit / refresh)
|
||||||
exports/
|
exports/
|
||||||
inbox/
|
inbox/
|
||||||
|
|
||||||
|
# PyCharm
|
||||||
|
.idea/
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ npm test # pipeline, coding rules, statistics, route model, game spec, a
|
|||||||
|
|
||||||
## New data from the community sources
|
## New data from the community sources
|
||||||
|
|
||||||
A GitHub Action (`.github/workflows/update-sources.yml`) runs the collection pipeline every day
|
A scheduled workflow (`.gitea/workflows/update-sources.yml` on the Atlas's Gitea; `.github/workflows/` holds the
|
||||||
|
GitHub version) runs the collection pipeline every day
|
||||||
(`python -m collection update`, see `collection/README.md`). It checks every source in `collection/pipeline.yaml`,
|
(`python -m collection update`, see `collection/README.md`). It checks every source in `collection/pipeline.yaml`,
|
||||||
and if anything changed it rebuilds the runs and the analysis, runs the tests and opens a pull request that says
|
and if anything changed it rebuilds the runs and the analysis, runs the tests and opens a pull request that says
|
||||||
what changed: new responses, new or renamed questions, new run reports, new result links on Reddit, and for the PDF
|
what changed: new responses, new or renamed questions, new run reports, new result links on Reddit, and for the PDF
|
||||||
@@ -75,7 +76,7 @@ See `docs/BOT_DATA_PROTOCOL.md` for what the bot should log.
|
|||||||
|
|
||||||
## Running everything locally
|
## Running everything locally
|
||||||
|
|
||||||
`python -m collection refresh` does what the daily GitHub workflow does: checks every source, rebuilds the runs,
|
`python -m collection refresh` does what the daily workflow does (`python -m collection rebuild` alone redoes everything built from the runs): checks every source, rebuilds the runs,
|
||||||
the graph, the route model and the statistics. Add `--bot <folder or zip>` to import bot runs, and
|
the graph, the route model and the statistics. Add `--bot <folder or zip>` to import bot runs, and
|
||||||
`python -m collection export-bot-kit` zips the files the bot uses (see `docs/BOT_INTEGRATION.md`).
|
`python -m collection export-bot-kit` zips the files the bot uses (see `docs/BOT_INTEGRATION.md`).
|
||||||
|
|
||||||
|
|||||||
@@ -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,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 | 97 / 960 (10.1%) | 0 / 29 (0.0%) | 0 / 0 |
|
||||||
|
| 2 | 0 / 296 (0.0%) | 0 / 21 (0.0%) | 0 / 4 (0.0%) |
|
||||||
|
| 3 | 0 / 193 (0.0%) | 0 / 14 (0.0%) | 0 / 5 (0.0%) |
|
||||||
|
| 4-10 | 0 / 538 (0.0%) | 0 / 102 (0.0%) | 0 / 36 (0.0%) |
|
||||||
|
| 11-30 | 0 / 627 (0.0%) | 0 / 57 (0.0%) | 0 / 137 (0.0%) |
|
||||||
|
| 31 or more | 0 / 694 (0.0%) | 0 / 0 | 0 / 333 (0.0%) |
|
||||||
|
| not given | 0 / 1581 (0.0%) | 0 / 149 (0.0%) | 0 / 0 |
|
||||||
|
|
||||||
|
Complete logs (bot and bulk) have 29 first attempts at the tree and 709 later ones, with 0 shadows. Zero in 709 later attempts rules out a rate above 0.4% for them; zero in 29 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 | 23 / 114 (20.2%) | 0 / 94 (0.0%) |
|
||||||
|
| Alone / West / Assess the situation / Engage the smaller cadet / Squadmate's revenge / Forest | 5 / 29 (17.2%) | 0 / 95 (0.0%) |
|
||||||
|
| Alone / Center / Assess the situation / Engage the smaller cadet / Squadmate's revenge / Forest | 4 / 29 (13.8%) | 0 / 78 (0.0%) |
|
||||||
|
| 1 Squadmate / East / Assess the situation / Engage the smaller cadet / Squadmate's revenge / East | 2 / 32 (6.2%) | 0 / 67 (0.0%) |
|
||||||
|
| Alone / East / Assess the situation / Engage the smaller cadet / Squadmate's revenge / East | 1 / 34 (2.9%) | 0 / 60 (0.0%) |
|
||||||
|
| 2 Squadmates / East / Assess the situation / Engage the smaller cadet / Squadmate's revenge / East | 2 / 45 (4.4%) | 0 / 48 (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 | 2 / 9 (22.2%) | 0 / 81 (0.0%) |
|
||||||
|
|
||||||
|
Across all 325 recorded routes, comparing first and later attempts on the same route: 93 first-attempt shadows where 39.9 would be expected if the attempt did not matter (odds ratio inf, z = 12.3). 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; 23 / 114 (20.2%) on first attempts), 29 assignments have two or more runs and 14 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/37, Third: 7/31, First: 6/26, Second: 4/17 |
|
||||||
|
| section | Flame: 5/39, Claw: 9/37, Tail: 8/35, (blank): 1/3 |
|
||||||
|
| squad | Second: 12/43, Third: 4/35, First: 6/34 |
|
||||||
|
| first_sighting | Brown: 12/61, Green: 9/51 |
|
||||||
|
| sighting_action | Hold still: 10/59, Respect / face it: 5/34, Unknown: 8/14, Weapon: 0/5 |
|
||||||
|
|
||||||
|
## 4. There is no single route
|
||||||
|
|
||||||
|
The 97 form runs with a shadow (all attempts) took 47 different recorded routes:
|
||||||
|
|
||||||
|
- **Company:** Alone 71, 1 Squadmate 14, 2 Squadmates 12
|
||||||
|
- **First direction:** West 61, Center 20, East 16
|
||||||
|
- **First move in the fight:** Assess the situation 86, (not recorded) 9, Even the numbers (smaller cadet) 2
|
||||||
|
- **The dagger:** Engage the smaller cadet 63, (not recorded) 22, Daggers or not (protect squadmate) 12
|
||||||
|
- **The bullies' fate:** Squadmate's revenge 61, Left bullies to the dragons 25, Killed the bullies yourself 9, Unknown 2
|
||||||
|
- **The fork:** West 46, Forest 36, East 14, 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: 79, bonded 57.
|
||||||
|
- Runs that died at the Blue: 16. What their notes say they did: approached the Blue 11, warned the other cadet / intervened 4.
|
||||||
|
- The answer given to the Black, where the note says (bonded / runs): held its gaze 29/41; 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
|
||||||
|
|
||||||
|
878 attempts on 27 accounts; the earliest attempt logged on any account is number 2. Gated tree runs: 515, shadows 0, on 6 recorded routes (the commonest 150 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.
|
||||||
|
|
||||||
+739
-696
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,124 @@
|
|||||||
|
# The screen tree
|
||||||
|
|
||||||
|
Written by `analysis/tree/build_tree.py` from the bot's logs: 878 runs, 11784 played steps (198 picks the bot logged and then overrode are left out). Machine-readable: `data/public/tree.json`.
|
||||||
|
|
||||||
|
## Coverage
|
||||||
|
|
||||||
|
- Screens seen: 46. Options on them: 118, of which 71 have been played and 47 never have.
|
||||||
|
- Played options that are dice (led to more than one place): 13. Always the same place so far: 58, of which 28 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, BONDED:Red, 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 west toward the scent | 319 | First sighting: Brown (forest centre) 51.4% (46.8%-56.0%); ENTER_THRESHING · green 48.6% (44.0%-53.2%) |
|
||||||
|
| Valley edge: choose direction | Head toward the center of the forest | 304 | First sighting: Red (forest centre) 53.0% (48.2%-57.6%); First sighting: Brown (forest centre) 47.0% (42.4%-51.7%) |
|
||||||
|
| FORK_IN_FOREST · red #01c3 | There’s no way this is your dragon and you need to get out o | 300 | FORK_IN_FOREST #0905 91.3% (88.3%-93.7%); FORK_IN_FOREST #900d 8.7% (6.3%-11.7%) |
|
||||||
|
| MEADOW_ENCOUNTER · orange #5b27 | On second thought, a nice brown sounds great | 274 | MEADOW_ENCOUNTER · orange #4f4a 50.7% (45.8%-55.7%); DIED 49.3% (44.3%-54.2%) |
|
||||||
|
| ENTER_THRESHING #bbc8 | Head toward the center of the forest | 203 | First sighting: Brown (forest centre) 54.7% (48.9%-60.3%); First sighting: Red (forest centre) 45.3% (39.7%-51.1%) |
|
||||||
|
| MEADOW_ENCOUNTER · brown #792f | Immediately throw your body weight onto the tail and hold on | 66 | MEADOW_ENCOUNTER · brown #3f5d 90.9% (83.4%-95.2%); DIED 9.1% (4.8%-16.6%) |
|
||||||
|
| Valley edge: choose direction | Head east toward the roar | 28 | ENTER_THRESHING · orange 64.3% (48.8%-77.3%); First sighting: Red (forest centre) 35.7% (22.7%-51.2%) |
|
||||||
|
| TARGET_BONDING · blue #848f | Absolutely. My whole life hinges on this moment | 28 | TARGET_BONDING · blue #4118 82.1% (67.6%-91.0%); DIED 17.9% (9.0%-32.4%) |
|
||||||
|
| TARGET_BONDING · blue #4118 | Hold the blue’s glare and advance | 23 | TARGET_BONDING · blue #afc4 82.6% (66.4%-91.9%); DIED 17.4% (8.1%-33.6%) |
|
||||||
|
| TARGET_BONDING · blue #afc4 | Do nothing | 19 | TARGET_BONDING · blue #ea99 73.7% (54.9%-86.6%); DIED 26.3% (13.4%-45.1%) |
|
||||||
|
| TARGET_BONDING · blue #ea99 | Hold the dragon’s glare and watch as it crushes the cadet to | 14 | TARGET_BONDING · blue #5dda 57.1% (36.0%-75.9%); DIED 42.9% (24.1%-64.0%) |
|
||||||
|
| TARGET_BONDING · blue #5dda | Straighten your spine and wait for it to speak | 8 | TARGET_BONDING · blue #959e 87.5% (58.9%-97.2%); DIED 12.5% (2.8%-41.1%) |
|
||||||
|
| TARGET_BONDING · blue #959e | Launch yourself to the right, taking cover behind a boulder | 7 | TARGET_BONDING · blue #f8b8 71.4% (40.9%-90.0%); DIED 28.6% (10.0%-59.1%) |
|
||||||
|
|
||||||
|
## 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 | 100.0% | 63.2% | FORK_IN_FOREST · red #f0fc: "Continue your approach. You’re certain this is you", played 8 times | BONDED:Red 100.0% |
|
||||||
|
| Orange | 0.0% | 0.0% | no bond logged | |
|
||||||
|
| Brown | 0.0% | 0.0% | no bond logged | |
|
||||||
|
| Green | 100.0% | 3.3% | 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 | 1.5% | 0.6% | TARGET_BONDING · blue #f8b8: "I want to bring down an empire", played 5 times | DIED 98.5%, BONDED:Blue 1.5% |
|
||||||
|
| 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 | 650 | 1.5% |
|
||||||
|
| Valley edge: choose direction | Head toward the center of the forest | 304 | 1.5% |
|
||||||
|
| First sighting: Red (forest centre) | Lower your eyes in respect | 263 | 1.5% |
|
||||||
|
| Survived the first sighting | Head deeper into the forest | 854 | 1.5% |
|
||||||
|
| Deeper in the forest: a scream | Investigate the scream | 809 | 1.5% |
|
||||||
|
| Clearing: squadmate vs two bullies | Help your squadmate | 787 | 1.5% |
|
||||||
|
| Bully fight: first move | Pause to assess the situation even though it may risk your squadmate’s | 787 | 1.5% |
|
||||||
|
| Bully fight: smaller cadet has a dagger | Engage the smaller cadet | 621 | 1.5% |
|
||||||
|
| Beat the smaller cadet: bullies’ fate | End the lives of the bullies yourself | 397 | 1.5% |
|
||||||
|
| After the fight: choose a direction | Walk farther into the forest | 479 | 1.5% |
|
||||||
|
| An hour later: valley or tree | Continue toward the center of the valley | 310 | 1.5% |
|
||||||
|
| FORK_IN_FOREST · red #01c3 | There’s no way this is your dragon and you need to get out of here | 300 | 1.5% |
|
||||||
|
| FORK_IN_FOREST #900d | Approach the blue dragon | 26 | 17.9% |
|
||||||
|
| TARGET_BONDING · blue #848f | Absolutely. My whole life hinges on this moment | 28 | 17.9% |
|
||||||
|
| TARGET_BONDING · blue #4118 | Hold the blue’s glare and advance | 23 | 21.7% |
|
||||||
|
| TARGET_BONDING · blue #afc4 | Do nothing | 19 | 26.3% |
|
||||||
|
| TARGET_BONDING · blue #ea99 | Hold the dragon’s glare and watch as it crushes the cadet to death | 14 | 35.7% |
|
||||||
|
| TARGET_BONDING · blue #5dda | Straighten your spine and wait for it to speak | 8 | 62.5% |
|
||||||
|
| TARGET_BONDING · blue #959e | Launch yourself to the right, taking cover behind a boulder | 7 | 71.4% |
|
||||||
|
| TARGET_BONDING · blue #f8b8 | I want to bring down an empire | 5 | 100.0% |
|
||||||
|
| TARGET_BONDING · blue #b98a | Move forward slowly, waiting for an invitation | 5 | 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 | 787 | Charge the other cadet to even out the numbers |
|
||||||
|
| Bully fight: first move | 787 | Unsheathe your weapon and charge between the bigger cadet and your squadmate |
|
||||||
|
| Descended slowly: two Greens in the clearing | 540 | Lower your eyes and turn your body toward the right |
|
||||||
|
| Descended slowly: two Greens in the clearing | 540 | Lower your eyes and turn your body toward the left |
|
||||||
|
| First sighting: Brown (forest centre) | 418 | Run and hope it didn’t see you |
|
||||||
|
| MEADOW_ENCOUNTER · orange #5b27 | 274 | Absolutely. I have a feeling this is my dragon |
|
||||||
|
| First sighting: Red (forest centre) | 263 | Hide behind a tree |
|
||||||
|
| First sighting: Red (forest centre) | 263 | Show your bravery by meeting its gaze |
|
||||||
|
| ENTER_THRESHING #bbc8 | 203 | Head west toward the scent |
|
||||||
|
| ENTER_THRESHING #bbc8 | 203 | Head east toward the roar |
|
||||||
|
| ENTER_THRESHING · green | 155 | Approach from the left |
|
||||||
|
| ENTER_THRESHING · green | 155 | Stare at the ground and drop the weapon |
|
||||||
|
| ENTER_THRESHING #5455 | 103 | Go west with your squadmate |
|
||||||
|
| ENTER_THRESHING #5455 | 103 | Convince them to head east instead |
|
||||||
|
| ENTER_THRESHING #ab2d | 100 | Convince them to head west instead |
|
||||||
|
| ENTER_THRESHING #ab2d | 100 | Go east with your squad |
|
||||||
|
| MEADOW_ENCOUNTER · brown #3f5d | 60 | You point out that it’s already talking to you, so clearly you’re on the right track |
|
||||||
|
| MEADOW_ENCOUNTER · brown #3f5d | 60 | You’ll convince it with charm |
|
||||||
|
| SCREAM_AND_CADETS | 45 | Take the cadet’s weapons and continue along your way. Good steel shouldn’t go to waste |
|
||||||
|
| SCREAM_AND_CADETS | 45 | Keep going. Clearly they’ve been found lacking and weak riders threaten the wing |
|
||||||
|
| TARGET_BONDING · blue #848f | 28 | Nope. I’d rather live bonded to a brown than die pursuing a blue |
|
||||||
|
| TARGET_BONDING · blue #848f | 28 | No. I have better odds with the orange |
|
||||||
|
| FORK_IN_FOREST #900d | 26 | Approach the orange dragon |
|
||||||
|
| FORK_IN_FOREST #900d | 26 | Approach the brown dragon |
|
||||||
|
| TARGET_BONDING · blue #4118 | 23 | Halt your approach and lower your eyes |
|
||||||
|
| TARGET_BONDING · blue #4118 | 23 | Keep moving forward with your eyes lowered |
|
||||||
|
| TARGET_BONDING · blue #afc4 | 19 | Intervene and help |
|
||||||
|
| ENTER_THRESHING · orange | 18 | Approach with confidence |
|
||||||
|
| ENTER_THRESHING · orange | 18 | Duck behind a boulder |
|
||||||
|
| TARGET_BONDING · blue #ea99 | 14 | Lower your eyes for the cadet’s dignity |
|
||||||
|
| TARGET_BONDING · blue #ea99 | 14 | Show your honor by helping the cadet |
|
||||||
|
| TARGET_BONDING · blue #5dda | 8 | Speak first, claiming the dragon as yours |
|
||||||
|
| TARGET_BONDING · blue #5dda | 8 | Do nothing. It’s worked so far |
|
||||||
|
| TARGET_BONDING · red | 8 | Break into a run toward its foreleg to mount |
|
||||||
|
| TARGET_BONDING · blue #959e | 7 | Hold steady, fear will get you killed |
|
||||||
|
| TARGET_BONDING · blue #f8b8 | 5 | I seek revenge |
|
||||||
|
| TARGET_BONDING · blue #f8b8 | 5 | You already know |
|
||||||
|
| TARGET_BONDING · blue #f8b8 | 5 | I want to defend the helpless |
|
||||||
|
| TARGET_BONDING · blue #b98a | 5 | Stand strong, waiting for an invitation |
|
||||||
|
| TARGET_BONDING · blue #b98a | 5 | Seize the opportunity to mount |
|
||||||
|
| Let the Red pass: two Greens in the clearing | 2 | Lower your eyes and turn your body toward the right |
|
||||||
|
| 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 |
|
||||||
@@ -88,3 +88,17 @@ presets:
|
|||||||
route_thresholds: [5, 10, 20, 30]
|
route_thresholds: [5, 10, 20, 30]
|
||||||
|
|
||||||
rare_goals: [Blue, Black, Blue or Black]
|
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]
|
||||||
|
|||||||
@@ -399,7 +399,7 @@ def place_path(r):
|
|||||||
s.append("bully")
|
s.append("bully")
|
||||||
if "res:" + r["resolution"] in L:
|
if "res:" + r["resolution"] in L:
|
||||||
s.append("res:" + r["resolution"])
|
s.append("res:" + r["resolution"])
|
||||||
if r["resolution"].startswith("DIED"):
|
if (r.get("resolution") or "").startswith("DIED"):
|
||||||
return s
|
return s
|
||||||
if r.get("post_path") in ("Forest", "West", "East"):
|
if r.get("post_path") in ("Forest", "West", "East"):
|
||||||
s.append("fork:" + r["post_path"])
|
s.append("fork:" + r["post_path"])
|
||||||
@@ -452,17 +452,51 @@ def valley(runs):
|
|||||||
return {"counts": counts, "edges": [[*k.split(">"), n] for k, n in sorted(edges.items(), key=lambda kv: -kv[1])]}
|
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):
|
def overview(runs):
|
||||||
"""The Odds' summary cards: cadets who went in and either bonded or died. Deliberate deaths (burned at an
|
"""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."""
|
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")]
|
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)]
|
cadets = [r for r in ended if not deliberate(r)]
|
||||||
bonded = sum(1 for r in cadets if r["outcome"] == "Bonded")
|
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),
|
return {"cadets": len(cadets), "bonded": bonded, "dead": len(cadets) - bonded, "deliberate": len(ended) - len(cadets),
|
||||||
@@ -483,7 +517,7 @@ def clean(o):
|
|||||||
return o
|
return o
|
||||||
|
|
||||||
|
|
||||||
def build(runs, rows, exported=None):
|
def build(runs, rows, exported=None, every_run=None):
|
||||||
global PLACES
|
global PLACES
|
||||||
PLACES = place_ids()
|
PLACES = place_ids()
|
||||||
th = M["route_thresholds"]
|
th = M["route_thresholds"]
|
||||||
@@ -506,6 +540,8 @@ def build(runs, rows, exported=None):
|
|||||||
"routes": {t: rank_routes(sub, t, th) for t in TARGETS},
|
"routes": {t: rank_routes(sub, t, th) for t in TARGETS},
|
||||||
"map": route_map(sub), "valley": valley(sub), "overview": overview(sub),
|
"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)
|
return clean(out)
|
||||||
|
|
||||||
|
|
||||||
@@ -515,7 +551,7 @@ def main(argv=None):
|
|||||||
ap.add_argument("--out", default=str(ROOT / "data/public/stats.json"))
|
ap.add_argument("--out", default=str(ROOT / "data/public/stats.json"))
|
||||||
a = ap.parse_args(argv)
|
a = ap.parse_args(argv)
|
||||||
runs = runs_io.read(a.data, sources=M["sources"])
|
runs = runs_io.read(a.data, sources=M["sources"])
|
||||||
out = build(runs, len(runs), exported())
|
out = build(runs, len(runs), exported(), every_run=runs_io.read(a.data))
|
||||||
Path(a.out).write_text(json.dumps(out, separators=(",", ":"), ensure_ascii=False), encoding="utf-8")
|
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")
|
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())
|
||||||
@@ -31,6 +31,7 @@ it exactly.
|
|||||||
|---|---|---|---|
|
|---|---|---|---|
|
||||||
| 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 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 |
|
| 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 |
|
||||||
|
| reddit comment | `reddit_comments`: runs riders describe in the megathread comments | not extracted here: the [threshing-reddit](https://git.kenschiano.net/DragonKind/threshing-reddit) scraper reads the threads every 6 hours and opens (or updates) a pull request that changes the public file | `data/public/reddit_comments.json`: each comment read into the "Report a run" answers, no usernames or text; corrections by hand in `manual/reddit_comments.yaml` |
|
||||||
| 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) |
|
| 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`) |
|
| 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 |
|
| reddit pdf | `reddit_pdf`: the community route PDF | the PDF | `data/derived/pdf_fingerprint.json` only: hashes, never the text |
|
||||||
|
|||||||
@@ -4,8 +4,24 @@
|
|||||||
"""
|
"""
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
from . import forge
|
||||||
from .common import path, read_yaml
|
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"
|
GRAPH_JS = "core/graph.js"
|
||||||
BEGIN = " // BEGIN CROSSWALK"
|
BEGIN = " // BEGIN CROSSWALK"
|
||||||
END = " // END CROSSWALK\n"
|
END = " // END CROSSWALK\n"
|
||||||
|
|||||||
+26
-25
@@ -10,6 +10,8 @@ Each extractor returns the raw bytes, or raises Skip when the source cannot be r
|
|||||||
secret, the bot's private repo not on this machine).
|
secret, the bot's private repo not on this machine).
|
||||||
"""
|
"""
|
||||||
import base64
|
import base64
|
||||||
|
import fnmatch
|
||||||
|
import glob
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
@@ -62,22 +64,15 @@ def reddit(spec, env):
|
|||||||
return json.dumps(threads, ensure_ascii=False, sort_keys=True).encode("utf-8")
|
return json.dumps(threads, ensure_ascii=False, sort_keys=True).encode("utf-8")
|
||||||
|
|
||||||
|
|
||||||
def github_issues(spec, env):
|
def delivered(spec, env):
|
||||||
"""Every issue with the label (open and closed), through the GitHub REST API."""
|
"""A source another repository delivers by pull request (it changes the public file itself): nothing to fetch."""
|
||||||
headers = {"Accept": "application/vnd.github+json"}
|
raise Skip(f"delivered by pull request from {spec.get('by') or 'another repository'}")
|
||||||
token = env.get("GITHUB_TOKEN") or env.get("GH_TOKEN")
|
|
||||||
if token:
|
|
||||||
headers["Authorization"] = f"Bearer {token}"
|
def forge_issues(spec, env):
|
||||||
label = urllib.parse.quote(spec["label"])
|
"""Every issue with the label (open and closed), from the repository's host (forge.yaml: Gitea or GitHub)."""
|
||||||
issues, page = [], 1
|
from . import forge
|
||||||
while True:
|
issues = forge.list_issues(spec["label"], env)
|
||||||
url = f"https://api.github.com/repos/{spec['repo']}/issues?labels={label}&state=all&per_page=100&page={page}"
|
|
||||||
batch = json.loads(_get(url, headers=headers))
|
|
||||||
issues += [i for i in batch if "pull_request" not in i]
|
|
||||||
if len(batch) < 100:
|
|
||||||
break
|
|
||||||
page += 1
|
|
||||||
issues.sort(key=lambda i: i["number"])
|
|
||||||
return json.dumps(issues, ensure_ascii=False, sort_keys=True).encode("utf-8")
|
return json.dumps(issues, ensure_ascii=False, sort_keys=True).encode("utf-8")
|
||||||
|
|
||||||
|
|
||||||
@@ -87,9 +82,12 @@ def local_dir(spec, env):
|
|||||||
if not root:
|
if not root:
|
||||||
raise Skip(f"the bot's repo is private: set {spec['env']} to a local copy to import it")
|
raise Skip(f"the bot's repo is private: set {spec['env']} to a local copy to import it")
|
||||||
files = {}
|
files = {}
|
||||||
for rel in spec["files"]:
|
for pattern in spec["files"]: # a pattern may have * for one folder level (one folder per bot account)
|
||||||
p = os.path.join(root, rel)
|
hits = sorted(glob.glob(os.path.join(root, pattern)))
|
||||||
files[rel] = Path(p).read_text(encoding="utf-8") if os.path.exists(p) else None
|
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")
|
return json.dumps(files, ensure_ascii=False, sort_keys=True).encode("utf-8")
|
||||||
|
|
||||||
|
|
||||||
@@ -99,19 +97,22 @@ def pack_local(spec, src):
|
|||||||
src = Path(src).expanduser()
|
src = Path(src).expanduser()
|
||||||
if src.is_dir():
|
if src.is_dir():
|
||||||
return local_dir(spec, {spec["env"]: str(src)})
|
return local_dir(spec, {spec["env"]: str(src)})
|
||||||
files = {rel: None for rel in spec["files"]}
|
files = {rel: None for rel in spec["files"] if "*" not in rel}
|
||||||
with zipfile.ZipFile(src) as z:
|
with zipfile.ZipFile(src) as z:
|
||||||
names = [n for n in z.namelist() if not n.endswith("/") and "__MACOSX" not in n]
|
names = [n for n in z.namelist() if not n.endswith("/") and "__MACOSX" not in n]
|
||||||
for rel in spec["files"]:
|
for pattern in spec["files"]:
|
||||||
hits = sorted((n for n in names if n == rel or n.endswith("/" + rel)), key=len)
|
for n in names:
|
||||||
if hits:
|
# the files may sit under a top folder (a zipped repo): match the pattern on the end of the name
|
||||||
files[rel] = z.read(hits[0]).decode("utf-8")
|
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()):
|
if not any(files.values()):
|
||||||
raise RuntimeError(f"{src.name}: none of {', '.join(spec['files'])} found inside")
|
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")
|
return json.dumps(files, ensure_ascii=False, sort_keys=True).encode("utf-8")
|
||||||
|
|
||||||
|
|
||||||
EXTRACTORS = {"http": http, "reddit": reddit, "github_issues": github_issues, "local_dir": local_dir}
|
EXTRACTORS = {"http": http, "reddit": reddit, "forge_issues": forge_issues, "local_dir": local_dir, "delivered": delivered}
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------- the raw store
|
# ---------------------------------------------------------------- the raw store
|
||||||
|
|||||||
@@ -0,0 +1,174 @@
|
|||||||
|
"""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] [--repo OWNER/NAME --base B]
|
||||||
|
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, repo=None, base=None):
|
||||||
|
"""Open a pull request (on this repository, or `repo` on the same host). If one is open for the branch already,
|
||||||
|
it is reused: pushing to its branch has updated it."""
|
||||||
|
f = dict(f or config())
|
||||||
|
if repo:
|
||||||
|
f["repo"] = repo
|
||||||
|
base = base or f["branch"]
|
||||||
|
tok = token(env)
|
||||||
|
open_prs = _call("GET", f"{api_base(f)}/pulls?state=open&limit=50&per_page=100", tok=tok, f=f) or []
|
||||||
|
same = [p for p in open_prs if (p.get("head") or {}).get("ref") == head]
|
||||||
|
if same:
|
||||||
|
return same[0]["number"]
|
||||||
|
pr = _call("POST", f"{api_base(f)}/pulls", {"head": head, "base": base, "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")
|
||||||
|
p.add_argument("--repo", help="another repository on the same host (OWNER/NAME)")
|
||||||
|
p.add_argument("--base", help="the branch to merge into (default: forge.yaml branch)")
|
||||||
|
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, repo=a.repo, base=a.base)}")
|
||||||
|
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:]))
|
||||||
+128
-12
@@ -1,11 +1,15 @@
|
|||||||
"""Hand-offs without GitHub: the zip of atlas files for the bot, and the local equivalent of the daily workflow.
|
"""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
|
python -m collection export-bot-kit -> exports/atlas-for-bot-<date>-<policy id>.zip
|
||||||
policy.json, solver.js and graph.js (what the bot vendors into vendor/threshing-atlas/), plus a README and
|
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/.
|
checksums. Send it to the bot's maintainer; they unzip it into vendor/threshing-atlas/.
|
||||||
python -m collection refresh [--bot PATH ...]
|
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
|
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.
|
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 hashlib
|
||||||
import json
|
import json
|
||||||
@@ -14,10 +18,13 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
import zipfile
|
import zipfile
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from .common import ROOT, path
|
from .common import ROOT, path
|
||||||
|
|
||||||
KIT = {"policy.json": "data/public/policy.json", "solver.js": "core/solver.js", "graph.js": "core/graph.js"}
|
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
|
README = """Threshing Atlas files for the DragonKind bot
|
||||||
============================================
|
============================================
|
||||||
@@ -25,14 +32,17 @@ README = """Threshing Atlas files for the DragonKind bot
|
|||||||
Policy id: {policy}
|
Policy id: {policy}
|
||||||
Made: {made}
|
Made: {made}
|
||||||
|
|
||||||
Unzip these three files into the bot's vendor/threshing-atlas/ folder, replacing the old ones, and keep them
|
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.
|
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)
|
policy.json the route model (the game, the counts behind every roll, the best routes per colour)
|
||||||
solver.js the advisor: advisor(), recommendOption(), solverHistory()
|
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
|
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.
|
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):
|
Checksums (sha256):
|
||||||
{sums}
|
{sums}
|
||||||
@@ -63,6 +73,29 @@ def _step(label, cmd):
|
|||||||
subprocess.run(cmd, cwd=ROOT, check=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=()):
|
def refresh(update_main, bots=()):
|
||||||
"""update -> (graph, policy, stats, build) when something changed. Returns 0 on success."""
|
"""update -> (graph, policy, stats, build) when something changed. Returns 0 on success."""
|
||||||
py = sys.executable
|
py = sys.executable
|
||||||
@@ -71,12 +104,95 @@ def refresh(update_main, bots=()):
|
|||||||
rc = update_main(args)
|
rc = update_main(args)
|
||||||
for i, b in enumerate(bots):
|
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"))])
|
rc |= update_main(["update", "--source", "bot", "--file", f"bot={b}", "--report", str(path(f"exports/last-report-bot{i + 1}.md"))])
|
||||||
if shutil.which("node"):
|
rebuild()
|
||||||
_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 (about 2 minutes)", [py, "planner/build_policy.py"])
|
|
||||||
_step("statistics", [py, "analysis/stats/site_stats.py"])
|
|
||||||
_step("runs, generated files and metadata", [py, "-m", "collection", "build"])
|
|
||||||
print(f"\nDone. What changed: exports/last-report.md. Send the bot its files with: {py} -m collection export-bot-kit")
|
print(f"\nDone. What changed: exports/last-report.md. Send the bot its files with: {py} -m collection export-bot-kit")
|
||||||
return rc
|
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
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ Written by `python -m collection build` (a test checks it is up to date).
|
|||||||
"""
|
"""
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
from . import forge
|
||||||
from .common import ROOT, pipeline, read_yaml, sha256_file
|
from .common import ROOT, pipeline, read_yaml, sha256_file
|
||||||
|
|
||||||
OUT = "data/croissant.json"
|
OUT = "data/croissant.json"
|
||||||
@@ -67,6 +68,7 @@ def field_description(spec):
|
|||||||
def build(dictionary=None):
|
def build(dictionary=None):
|
||||||
d = dictionary or load_dictionary()
|
d = dictionary or load_dictionary()
|
||||||
ds = d["dataset"]
|
ds = d["dataset"]
|
||||||
|
fg = forge.config()
|
||||||
sources = pipeline()["sources"]
|
sources = pipeline()["sources"]
|
||||||
|
|
||||||
distribution = []
|
distribution = []
|
||||||
@@ -77,7 +79,7 @@ def build(dictionary=None):
|
|||||||
"@id": key,
|
"@id": key,
|
||||||
"name": key,
|
"name": key,
|
||||||
"description": " ".join(spec["description"].split()),
|
"description": " ".join(spec["description"].split()),
|
||||||
"contentUrl": spec.get("url") or f"{ds['repository']}/blob/main/{spec['path']}",
|
"contentUrl": forge.file_url(spec["path"], fg),
|
||||||
"encodingFormat": spec["format"],
|
"encodingFormat": spec["format"],
|
||||||
"sha256": sha256(path),
|
"sha256": sha256(path),
|
||||||
"contentSize": f"{path.stat().st_size} B",
|
"contentSize": f"{path.stat().st_size} B",
|
||||||
@@ -102,12 +104,12 @@ def build(dictionary=None):
|
|||||||
"conformsTo": "http://mlcommons.org/croissant/1.0",
|
"conformsTo": "http://mlcommons.org/croissant/1.0",
|
||||||
"name": ds["name"],
|
"name": ds["name"],
|
||||||
"description": " ".join(ds["description"].split()),
|
"description": " ".join(ds["description"].split()),
|
||||||
"url": ds["url"],
|
"url": fg.get("site") or forge.repo_url(fg),
|
||||||
"sameAs": ds["repository"],
|
"sameAs": forge.repo_url(fg),
|
||||||
"license": ds["license"],
|
"license": ds["license"],
|
||||||
"creator": {"@type": "sc:Person", "name": ds["creator"], "url": f"https://github.com/{ds['creator']}"},
|
"creator": {"@type": "sc:Person", "name": ds["creator"]},
|
||||||
"keywords": ds["keywords"],
|
"keywords": ds["keywords"],
|
||||||
"citeAs": ds["citation"],
|
"citeAs": ds["citation"].format(repository=forge.repo_url(fg)),
|
||||||
"isLiveDataset": True,
|
"isLiveDataset": True,
|
||||||
"isBasedOn": [
|
"isBasedOn": [
|
||||||
{"@type": "sc:CreativeWork", "name": s["label"], "url": next(iter(s["links"].values()))}
|
{"@type": "sc:CreativeWork", "name": s["label"], "url": next(iter(s["links"].values()))}
|
||||||
|
|||||||
+142
-15
@@ -4,6 +4,7 @@ One coder per source (pipeline.yaml `runs:`). Every coder returns rows keyed by
|
|||||||
missing answers get the same "not known" values the community form's coding uses, so every source can be filtered
|
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.
|
the same way. The `source` column says where a run came from; `entry` keeps the spreadsheet's own row label.
|
||||||
"""
|
"""
|
||||||
|
import functools
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -67,8 +68,13 @@ def spreadsheet(name, spec):
|
|||||||
|
|
||||||
def reddit_results(name, spec):
|
def reddit_results(name, spec):
|
||||||
"""Dragons read from result pages linked in the megathreads: bonded, colour and tail known, route unknown."""
|
"""Dragons read from result pages linked in the megathreads: bonded, colour and tail known, route unknown."""
|
||||||
|
from .common import pipeline
|
||||||
|
comments = pipeline()["sources"].get("reddit_comments")
|
||||||
|
told = {r.get("result") for r in _comment_runs(comments)} if comments else set()
|
||||||
rows = []
|
rows = []
|
||||||
for r in read_yaml(spec["transform"]["manual"])["results"]:
|
for r in read_yaml(spec["transform"]["manual"])["results"]:
|
||||||
|
if r["id"] in told:
|
||||||
|
continue # the same run, with its route, is a "reddit comment" row
|
||||||
row = blank_row(run_id=f"thread-{r['id']}", source=spec["run_source"], outcome="Bonded",
|
row = blank_row(run_id=f"thread-{r['id']}", source=spec["run_source"], outcome="Bonded",
|
||||||
outcome_color=r["colour"], tail=r["tail"])
|
outcome_color=r["colour"], tail=r["tail"])
|
||||||
encounter_columns(row)
|
encounter_columns(row)
|
||||||
@@ -76,16 +82,89 @@ def reddit_results(name, spec):
|
|||||||
return rows
|
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):
|
def reports(name, spec):
|
||||||
"""Runs reported through the "Report a run" issue form (collection/specs/report_form.yaml)."""
|
"""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"])
|
p = path(spec["load"])
|
||||||
data = json.loads(p.read_text(encoding="utf-8")) if p.exists() else {"reports": []}
|
data = json.loads(p.read_text(encoding="utf-8")) if p.exists() else {"reports": []}
|
||||||
|
return [answers_row(f"reported-{rep['number']}", spec["run_source"], rep.get("opened"), rep["answers"])
|
||||||
|
for rep in data["reports"]]
|
||||||
|
|
||||||
|
|
||||||
|
def _comment_runs(spec):
|
||||||
|
"""data/public/reddit_comments.json with the hand corrections of collection/manual/reddit_comments.yaml:
|
||||||
|
`reject` (comment ids), `fix` (id -> answers that replace the read ones; null removes one) and `add` (runs the
|
||||||
|
reader missed: {id, thread, posted, answers})."""
|
||||||
|
p = path(spec["load"])
|
||||||
|
data = json.loads(p.read_text(encoding="utf-8")) if p.exists() else {"runs": []}
|
||||||
|
manual = read_yaml(spec["manual"]) if spec.get("manual") and path(spec["manual"]).exists() else {}
|
||||||
|
reject = {str(x) for x in manual.get("reject") or []}
|
||||||
|
fix = {str(k): v for k, v in (manual.get("fix") or {}).items()}
|
||||||
|
out = []
|
||||||
|
for run in list(data["runs"]) + list(manual.get("add") or []):
|
||||||
|
if str(run["id"]) in reject or str(run["id"]).split("-")[0] in reject:
|
||||||
|
continue
|
||||||
|
answers = dict(run["answers"])
|
||||||
|
for k, v in (fix.get(str(run["id"])) or {}).items():
|
||||||
|
if v is None:
|
||||||
|
answers.pop(k, None)
|
||||||
|
else:
|
||||||
|
answers[k] = str(v)
|
||||||
|
out.append({**run, "answers": answers, "checked": str(run["id"]) in fix or run in (manual.get("add") or [])})
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
def reddit_comments(name, spec):
|
||||||
|
"""Runs riders described in the megathread comments, read into the "Report a run" answers (automatic: every
|
||||||
|
row is flagged, and those not checked by hand say so)."""
|
||||||
rows = []
|
rows = []
|
||||||
for rep in data["reports"]:
|
for run in _comment_runs(spec):
|
||||||
vals, flags = {}, []
|
rows.append(answers_row(f"comment-{run['id']}", spec["run_source"], run.get("posted"), run["answers"],
|
||||||
for fid, answer in rep["answers"].items():
|
["read from a Reddit comment" + ("" if run["checked"] else " automatically, not checked by hand")]))
|
||||||
|
return rows
|
||||||
|
|
||||||
|
|
||||||
|
@functools.lru_cache(maxsize=1)
|
||||||
|
def _form_fields():
|
||||||
|
return {f["id"]: f for f in report_form.spec()["fields"]}
|
||||||
|
|
||||||
|
|
||||||
|
def answers_row(run_id, source, date, answers, flags=None):
|
||||||
|
"""One run from the "Report a run" answers (option labels) -> a coded row."""
|
||||||
|
fields = _form_fields()
|
||||||
|
vals, flags = {}, list(flags or [])
|
||||||
|
for fid, answer in answers.items():
|
||||||
f = fields.get(fid)
|
f = fields.get(fid)
|
||||||
if not f:
|
if not f:
|
||||||
continue
|
continue
|
||||||
@@ -96,7 +175,7 @@ def reports(name, spec):
|
|||||||
vals[f["column"]] = f["options"][answer]
|
vals[f["column"]] = f["options"][answer]
|
||||||
else:
|
else:
|
||||||
flags.append(f"unrecognised answer to {fid}")
|
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 = blank_row(run_id=run_id, source=source, date=date, **vals)
|
||||||
row["attempt_group"] = attempt_group(row["attempt"])
|
row["attempt_group"] = attempt_group(row["attempt"])
|
||||||
if row["outcome"] == "Died before the hour" and row["hour"] == "Unknown":
|
if row["outcome"] == "Died before the hour" and row["hour"] == "Unknown":
|
||||||
row["hour"] = "DIED before the hour"
|
row["hour"] = "DIED before the hour"
|
||||||
@@ -114,8 +193,7 @@ def reports(name, spec):
|
|||||||
flags.append("bonded, colour not given")
|
flags.append("bonded, colour not given")
|
||||||
encounter_columns(row)
|
encounter_columns(row)
|
||||||
row["data_flags"] = "; ".join(flags)
|
row["data_flags"] = "; ".join(flags)
|
||||||
rows.append(row)
|
return row
|
||||||
return rows
|
|
||||||
|
|
||||||
|
|
||||||
def _norm(text):
|
def _norm(text):
|
||||||
@@ -137,7 +215,7 @@ def bot_trajectories(spec):
|
|||||||
def bot_variables(traj, crosswalk):
|
def bot_variables(traj, crosswalk):
|
||||||
"""A bot attempt -> columns, through the crosswalk in collection/specs/bot.yaml. First match wins."""
|
"""A bot attempt -> columns, through the crosswalk in collection/specs/bot.yaml. First match wins."""
|
||||||
v, unmapped = {}, []
|
v, unmapped = {}, []
|
||||||
for s in traj["steps"]:
|
for s in played(traj["steps"]):
|
||||||
t = _norm(s["optionText"])
|
t = _norm(s["optionText"])
|
||||||
hit = next((c for c in crosswalk if c[0].search(t)), None)
|
hit = next((c for c in crosswalk if c[0].search(t)), None)
|
||||||
if hit:
|
if hit:
|
||||||
@@ -150,10 +228,36 @@ def bot_variables(traj, crosswalk):
|
|||||||
return v, unmapped
|
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):
|
def bot(name, spec):
|
||||||
cw = [(re.compile(rx), col, val) for rx, col, val in read_yaml(spec["transform"]["spec"])["crosswalk"]]
|
cw = [(re.compile(rx), col, val) for rx, col, val in read_yaml(spec["transform"]["spec"])["crosswalk"]]
|
||||||
rows = []
|
rows = []
|
||||||
for traj in bot_trajectories(spec):
|
for traj in bot_trajectories(spec):
|
||||||
|
traj = {**traj, "steps": played(traj["steps"])}
|
||||||
|
steps = traj["steps"]
|
||||||
v, _ = bot_variables(traj, cw)
|
v, _ = bot_variables(traj, cw)
|
||||||
red = v.pop("red", None)
|
red = v.pop("red", None)
|
||||||
v.pop("scream_investigate", None)
|
v.pop("scream_investigate", None)
|
||||||
@@ -165,24 +269,47 @@ def bot(name, spec):
|
|||||||
if o["type"] == "BONDED":
|
if o["type"] == "BONDED":
|
||||||
outcome, colour = "Bonded", (o.get("colour") or "").capitalize() or None
|
outcome, colour = "Bonded", (o.get("colour") or "").capitalize() or None
|
||||||
elif o["type"] == "BURNED":
|
elif o["type"] == "BURNED":
|
||||||
last_tint = traj["steps"][-1].get("tint")
|
last_tint = steps[-1].get("tint") if steps else None
|
||||||
outcome = "Incinerated" if v.get("hour") else "Died before the hour"
|
outcome = "Incinerated" if v.get("hour") else "Died before the hour"
|
||||||
colour = last_tint.capitalize() if last_tint and v.get("hour") else None
|
colour = last_tint.capitalize() if last_tint and v.get("hour") else None
|
||||||
if o.get("intentional"):
|
if o.get("intentional"):
|
||||||
flags.append("deliberate burn (the bot chose to die)")
|
why = BURN_REASONS.get(o.get("reason") or "", "")
|
||||||
else:
|
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
|
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
|
target = (meta.get("target") or "").capitalize() or None
|
||||||
row = blank_row(run_id=traj["id"], source=spec["run_source"], date=(meta.get("startedAt") or "")[:10] or None,
|
row = blank_row(run_id=traj["id"], source=spec["run_source"], bot_mode=meta.get("decisionMode"),
|
||||||
attempt=meta.get("attempt"), goal=target if target in COLOURS else None,
|
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)
|
outcome=outcome, outcome_color=colour, data_flags="; ".join(flags), **v)
|
||||||
row["attempt_group"] = attempt_group(row["attempt"])
|
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")))
|
encounter_columns(row, intentional=bool(o.get("intentional")))
|
||||||
rows.append(row)
|
rows.append(row)
|
||||||
return rows
|
return rows
|
||||||
|
|
||||||
|
|
||||||
CODERS = {"spreadsheet": spreadsheet, "reddit_results": reddit_results, "reports": reports, "bot": bot}
|
CODERS = {"spreadsheet": spreadsheet, "reddit_results": reddit_results, "reddit_comments": reddit_comments,
|
||||||
|
"reports": reports, "bot": bot, "register": register}
|
||||||
|
|
||||||
|
|
||||||
def build_runs(pipe):
|
def build_runs(pipe):
|
||||||
|
|||||||
@@ -0,0 +1,116 @@
|
|||||||
|
"""Send the community route PDF to the bot's private repo when it changed (python -m collection send-pdf).
|
||||||
|
|
||||||
|
The PDF is never published by the Atlas: the daily check keeps it in the private raw store only
|
||||||
|
(data/raw/reddit_pdf/current.pdf). The bot's repo (private, same host) keeps its own copy, "Threshing Options.pdf",
|
||||||
|
which its hand-written routes (src/pdfRoutes.js) were transcribed from. When the two differ, this opens (or updates)
|
||||||
|
one pull request there, on branch atlas/route-pdf, with the new file and the lines its text gained and lost.
|
||||||
|
|
||||||
|
The token is ATLAS_BOT_TOKEN (write access to the bot's repo); git gets it through GIT_CONFIG_* variables, never argv.
|
||||||
|
"""
|
||||||
|
import hashlib
|
||||||
|
import io
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
import tempfile
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from . import forge
|
||||||
|
from .common import path
|
||||||
|
|
||||||
|
BOT_REPO = "DragonKind/DragonKind"
|
||||||
|
BOT_PDF = "Threshing Options.pdf"
|
||||||
|
BRANCH = "atlas/route-pdf"
|
||||||
|
RAW_PDF = "data/raw/reddit_pdf/current.pdf"
|
||||||
|
MAX_LINES = 60
|
||||||
|
|
||||||
|
|
||||||
|
def pdf_lines(data):
|
||||||
|
"""The PDF's text, one entry per non-empty line, whitespace collapsed."""
|
||||||
|
from pypdf import PdfReader
|
||||||
|
out = []
|
||||||
|
for page in PdfReader(io.BytesIO(data)).pages:
|
||||||
|
for line in (page.extract_text() or "").splitlines():
|
||||||
|
line = " ".join(line.split())
|
||||||
|
if line:
|
||||||
|
out.append(line)
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
def text_changes(old, new):
|
||||||
|
"""(lines only in the new PDF, lines only in the old one), each in the order they appear."""
|
||||||
|
o, n = pdf_lines(old), pdf_lines(new)
|
||||||
|
so, sn = set(o), set(n)
|
||||||
|
gained = list(dict.fromkeys(l for l in n if l not in so))
|
||||||
|
lost = list(dict.fromkeys(l for l in o if l not in sn))
|
||||||
|
return gained, lost
|
||||||
|
|
||||||
|
|
||||||
|
def _bullets(lines):
|
||||||
|
if not lines:
|
||||||
|
return "- (none)"
|
||||||
|
shown = [f"- {l}" for l in lines[:MAX_LINES]]
|
||||||
|
if len(lines) > MAX_LINES:
|
||||||
|
shown.append(f"- ... and {len(lines) - MAX_LINES} more")
|
||||||
|
return "\n".join(shown)
|
||||||
|
|
||||||
|
|
||||||
|
def body(new, old, gained, lost):
|
||||||
|
h = lambda b: hashlib.sha256(b).hexdigest()[:12]
|
||||||
|
return (
|
||||||
|
"The community route PDF (u/ClumsyBadger's Threshing Options, the Google Drive file linked from the "
|
||||||
|
"megathreads) changed. This replaces `Threshing Options.pdf` with the current version.\n\n"
|
||||||
|
f"| | bytes | sha256 |\n|---|---|---|\n| this repo's copy | {len(old):,} | `{h(old)}` |\n"
|
||||||
|
f"| current PDF | {len(new):,} | `{h(new)}` |\n\n"
|
||||||
|
"**The bot does not read the PDF itself**: its routes are written out by hand in `src/pdfRoutes.js`. "
|
||||||
|
"Check them against the changes below.\n\n"
|
||||||
|
f"### Text that is new in this version\n{_bullets(gained)}\n\n"
|
||||||
|
f"### Text no longer in it\n{_bullets(lost)}\n\n"
|
||||||
|
"(Text extracted line by line from a flowchart, so some lines are fragments of boxes.) "
|
||||||
|
"Opened automatically by the Threshing Atlas's daily source check; it is updated in place when the PDF "
|
||||||
|
"changes again.\n"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _git(args, cwd=None, env=None):
|
||||||
|
subprocess.run(["git", *args], cwd=cwd, env=env, check=True, capture_output=True, text=True)
|
||||||
|
|
||||||
|
|
||||||
|
def send(env=None):
|
||||||
|
env = dict(os.environ if env is None else env)
|
||||||
|
src = path(RAW_PDF)
|
||||||
|
if not src.exists():
|
||||||
|
print("no route PDF in the raw store: nothing to send")
|
||||||
|
return 0
|
||||||
|
tok = forge.token(env)
|
||||||
|
if not tok:
|
||||||
|
print("ATLAS_BOT_TOKEN is not set: the PDF is not sent")
|
||||||
|
return 0
|
||||||
|
f = forge.config()
|
||||||
|
host = f["url"].rstrip("/")
|
||||||
|
genv = {**env, "GIT_TERMINAL_PROMPT": "0", "GIT_CONFIG_COUNT": "1",
|
||||||
|
"GIT_CONFIG_KEY_0": f"http.{host}/.extraheader", "GIT_CONFIG_VALUE_0": f"AUTHORIZATION: token {tok}"}
|
||||||
|
new = src.read_bytes()
|
||||||
|
tmp = Path(tempfile.mkdtemp(prefix="dragonkind-"))
|
||||||
|
try:
|
||||||
|
repo = tmp / "repo"
|
||||||
|
_git(["clone", "--quiet", "--depth", "1", f"{host}/{BOT_REPO}.git", str(repo)], env=genv)
|
||||||
|
dst = repo / BOT_PDF
|
||||||
|
old = dst.read_bytes() if dst.exists() else b""
|
||||||
|
if old == new:
|
||||||
|
print("the bot already has the current route PDF")
|
||||||
|
return 0
|
||||||
|
gained, lost = text_changes(old, new) if old else (pdf_lines(new), [])
|
||||||
|
dst.write_bytes(new)
|
||||||
|
_git(["config", "user.name", "Atlas data bot"], cwd=repo)
|
||||||
|
_git(["config", "user.email", "atlas-bot@noreply.localhost"], cwd=repo)
|
||||||
|
_git(["checkout", "-q", "-b", BRANCH], cwd=repo)
|
||||||
|
_git(["add", BOT_PDF], cwd=repo)
|
||||||
|
_git(["commit", "-q", "-m", f"Community route PDF: current version ({len(new):,} bytes)"], cwd=repo)
|
||||||
|
_git(["push", "-q", "--force", "origin", BRANCH], cwd=repo, env=genv)
|
||||||
|
n = forge.open_pr(BRANCH, "Community route PDF changed", body(new, old, gained, lost), env=env,
|
||||||
|
repo=BOT_REPO, base="main")
|
||||||
|
print(f"route PDF sent: pull request #{n} on {BOT_REPO} ({len(gained)} lines new, {len(lost)} gone)")
|
||||||
|
return 0
|
||||||
|
finally:
|
||||||
|
shutil.rmtree(tmp, ignore_errors=True)
|
||||||
@@ -215,17 +215,145 @@ def merge_scenes(existing, scenes):
|
|||||||
return dict(sorted(out.items()))
|
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):
|
def transform(raw_path, spec, ctx):
|
||||||
with open(raw_path, encoding="utf-8") as f:
|
with open(raw_path, encoding="utf-8") as f:
|
||||||
files = json.load(f)
|
files = json.load(f)
|
||||||
k = files.get("data/knowledge.json")
|
k = files.get("data/knowledge.json")
|
||||||
knowledge = json.loads(k) if k else {"nodes": {}}
|
knowledge = json.loads(k) if k else {"nodes": {}}
|
||||||
encounters = _jsonl(files.get("logs/encounters.jsonl"))
|
|
||||||
runs = _jsonl(files.get("data/runs.jsonl"))
|
|
||||||
privacy = spec.get("privacy") or {}
|
privacy = spec.get("privacy") or {}
|
||||||
scenes, trajectories, unlabeled = import_bot(knowledge, encounters, runs, ctx.get("env", {}).get(privacy.get("account_salt_env", "")))
|
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):
|
for obj in (scenes, trajectories):
|
||||||
check_public(obj, set(privacy.get("refuse_fields", [])), privacy.get("max_string", 200))
|
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}
|
return {"scenes": scenes, "trajectories": trajectories, "_unlabeled": unlabeled}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# Hand corrections to the runs read from the r/fourthwing megathread comments (data/public/reddit_comments.json).
|
||||||
|
# The threshing-reddit scraper reads them automatically; every new run it finds is listed, with a link to its
|
||||||
|
# comment, in the pull request that brings it in. Check them there and correct them here. Applied when the
|
||||||
|
# runs are built (`python -m collection build`), so a correction never waits for the threads to change.
|
||||||
|
#
|
||||||
|
# reject: comment ids whose "run" is not a run (a joke, a friend's run, two runs told as one). An id without
|
||||||
|
# its "-n" suffix rejects every run read from that comment.
|
||||||
|
# fix: comment id -> answers that replace the ones read (form option labels from
|
||||||
|
# collection/specs/report_form.yaml; null removes an answer). A fixed run counts as checked by hand.
|
||||||
|
# add: runs the reader missed: { id, thread, posted: YYYY-MM-DD, answers: {...} }
|
||||||
|
# No usernames: the comment id is enough to find the comment again.
|
||||||
|
version: 1
|
||||||
|
reject: []
|
||||||
|
fix: {}
|
||||||
|
add: []
|
||||||
@@ -18,7 +18,7 @@ manifest: data/manifest.json # for each source: the sha256 of the current
|
|||||||
runs:
|
runs:
|
||||||
path: data/public/runs_clean.csv
|
path: data/public/runs_clean.csv
|
||||||
# sources in this order; within a source, the order the coder returns
|
# sources in this order; within a source, the order the coder returns
|
||||||
order: [reddit_spreadsheet, reddit_thread, reported, bot, reddit_pdf]
|
order: [reddit_spreadsheet, reddit_thread, reddit_comments, register, reported, bot, reddit_pdf]
|
||||||
|
|
||||||
sources:
|
sources:
|
||||||
reddit_spreadsheet:
|
reddit_spreadsheet:
|
||||||
@@ -35,12 +35,16 @@ sources:
|
|||||||
|
|
||||||
register:
|
register:
|
||||||
label: Unofficial Dragon Register (which dragon each rider bonded)
|
label: Unofficial Dragon Register (which dragon each rider bonded)
|
||||||
|
run_source: register
|
||||||
links: { sheet: https://docs.google.com/spreadsheets/d/1KMiE9sec0l597Pzue1OhGYf07NF4howtQ_lPeqx7jXQ }
|
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 }
|
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 }
|
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
|
privacy: { redact_emails: true, drop_columns_matching: [photo, cadet name] } # no rider names, no photos
|
||||||
load: data/public/register.json
|
load: data/public/register.json
|
||||||
runs: null # bonded dragons without the route that led there
|
# 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:
|
reddit_pdf:
|
||||||
label: Community route PDF (u/ClumsyBadger)
|
label: Community route PDF (u/ClumsyBadger)
|
||||||
@@ -65,12 +69,30 @@ sources:
|
|||||||
load: null # the public source file is the hand-checked collection/manual/reddit_results.yaml
|
load: null # the public source file is the hand-checked collection/manual/reddit_results.yaml
|
||||||
runs: reddit_results
|
runs: reddit_results
|
||||||
|
|
||||||
|
reddit_comments:
|
||||||
|
label: Runs riders describe in the r/fourthwing Dragonkind megathread comments
|
||||||
|
run_source: reddit comment
|
||||||
|
links:
|
||||||
|
part3: https://www.reddit.com/r/fourthwing/comments/1wvwfp9/
|
||||||
|
part4: https://www.reddit.com/r/fourthwing/comments/1wz5cnj/
|
||||||
|
scraper: https://git.kenschiano.net/DragonKind/threshing-reddit
|
||||||
|
# delivered, not extracted: the threshing-reddit scraper (its own repository) reads the threads every 6 hours and
|
||||||
|
# opens a pull request here that changes data/public/reddit_comments.json. Each comment is read into the
|
||||||
|
# "Report a run" answers (option labels of specs/report_form.yaml); only the comment id, the day and the
|
||||||
|
# answers are kept: no usernames, no comment text. `update` leaves this source alone.
|
||||||
|
extract: { kind: delivered, by: threshing-reddit }
|
||||||
|
transform: null
|
||||||
|
load: data/public/reddit_comments.json
|
||||||
|
# hand corrections (reject / fix / add a run), applied when the runs are built
|
||||||
|
manual: collection/manual/reddit_comments.yaml
|
||||||
|
runs: reddit_comments
|
||||||
|
|
||||||
reported:
|
reported:
|
||||||
label: Runs reported on the Atlas ("Report a run", a GitHub issue form)
|
label: Runs reported on the Atlas ("Report a run", an issue form on the Atlas's repository)
|
||||||
run_source: reported
|
run_source: reported
|
||||||
links: { report: "https://github.com/ekcSchiano/threshing-atlas/issues/new?template=report-a-run.yml" }
|
# the repository's host is forge.yaml (Gitea or GitHub); its "new issue" link is made from it
|
||||||
extract: { kind: github_issues, repo: ekcSchiano/threshing-atlas, label: run report, ext: json }
|
extract: { kind: forge_issues, label: run report, ext: json }
|
||||||
# GitHub usernames are dropped; issues closed as "not planned" or labelled "invalid" are left out
|
# 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] }
|
transform: { name: reports, form: collection/specs/report_form.yaml, reject_labels: [invalid, duplicate] }
|
||||||
load: data/public/reports.json
|
load: data/public/reports.json
|
||||||
runs: reports
|
runs: reports
|
||||||
@@ -79,11 +101,17 @@ sources:
|
|||||||
label: DragonKind bot runs (Ken's private bot, imported locally)
|
label: DragonKind bot runs (Ken's private bot, imported locally)
|
||||||
run_source: bot
|
run_source: bot
|
||||||
# the bot's repo is private: this step runs only on a machine with a copy of it
|
# the bot's repo is private: this step runs only on a machine with a copy of it
|
||||||
extract: { kind: local_dir, env: DRAGONKIND_BOT_DIR, files: [data/knowledge.json, data/runs.jsonl, logs/encounters.jsonl] }
|
# 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 }
|
transform: { name: bot, spec: collection/specs/bot.yaml }
|
||||||
privacy:
|
privacy:
|
||||||
account_salt_env: DK_ACCOUNT_SALT # account ids are hashed with this salt, which is never committed
|
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]
|
refuse_fields: [prose, proseNorm, proseExcerpt, email, password, accountId, accountName]
|
||||||
max_string: 200 # anything longer looks like game prose
|
max_string: 200 # anything longer looks like game prose
|
||||||
load: data/bot # scenes.json (merged) + trajectories-<date>.jsonl
|
load: data/bot # scenes.json and trajectories-bot.jsonl, both merged with what is published
|
||||||
runs: bot
|
runs: bot
|
||||||
|
|||||||
+54
-6
@@ -8,7 +8,10 @@
|
|||||||
Locally, what the daily workflow does: update every source (plus bot folders or zips someone sent), then
|
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.
|
rebuild the graph, the route model, the statistics and the build.
|
||||||
python -m collection export-bot-kit
|
python -m collection export-bot-kit
|
||||||
exports/atlas-for-bot-<date>-<policy id>.zip: policy.json, solver.js and graph.js for the bot.
|
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]
|
python -m collection build [--check]
|
||||||
Code every public source file into data/public/runs_clean.csv (validated against data/dictionary.yaml),
|
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
|
and write the files generated from the specs: the "Report a run" issue form, the bot crosswalk in
|
||||||
@@ -25,10 +28,33 @@ from datetime import datetime, timezone
|
|||||||
from .etl import extract as E
|
from .etl import extract as E
|
||||||
from .etl import load as L
|
from .etl import load as L
|
||||||
from .etl import codegen, metadata, report_form, runs, validate
|
from .etl import codegen, metadata, report_form, runs, validate
|
||||||
from .etl.common import Report, path, pipeline
|
from .etl.common import Report, path, pipeline, read_jsonl
|
||||||
from .etl.transform import TRANSFORMS
|
from .etl.transform import TRANSFORMS
|
||||||
|
|
||||||
|
|
||||||
|
BOT_FILE = "trajectories-bot.jsonl"
|
||||||
|
|
||||||
|
|
||||||
|
def merge_trajectories(target, new):
|
||||||
|
"""Every bot attempt ever imported, in one file (data/bot/trajectories-bot.jsonl), sorted by id. The bot's repo
|
||||||
|
holds each account's full history, so an import is a superset: a re-imported attempt replaces its old copy, and
|
||||||
|
attempts no longer in the bot's repo (an archived account) stay. Older per-import files are folded in."""
|
||||||
|
d = path(target)
|
||||||
|
olds = sorted(d.glob("trajectories-*.jsonl"))
|
||||||
|
by_id = {}
|
||||||
|
for f in olds:
|
||||||
|
for t in read_jsonl(f):
|
||||||
|
by_id.setdefault(t["id"], t)
|
||||||
|
for t in new:
|
||||||
|
by_id[t["id"]] = t
|
||||||
|
wrote = L.jsonl_file(f"{target}/{BOT_FILE}", [by_id[k] for k in sorted(by_id)])
|
||||||
|
for f in olds:
|
||||||
|
if f.name != BOT_FILE:
|
||||||
|
f.unlink()
|
||||||
|
wrote = True
|
||||||
|
return wrote
|
||||||
|
|
||||||
|
|
||||||
def update_source(name, spec, manifest, report, local_file=None, env=None):
|
def update_source(name, spec, manifest, report, local_file=None, env=None):
|
||||||
env = os.environ if env is None else env
|
env = os.environ if env is None else env
|
||||||
try:
|
try:
|
||||||
@@ -51,9 +77,7 @@ def update_source(name, spec, manifest, report, local_file=None, env=None):
|
|||||||
old = {"scenes": L.read_json(f"{target}/scenes.json") or {}}
|
old = {"scenes": L.read_json(f"{target}/scenes.json") or {}}
|
||||||
lines = mod.describe(old, new)
|
lines = mod.describe(old, new)
|
||||||
wrote = L.json_file(f"{target}/scenes.json", mod.merge_scenes(old["scenes"], new["scenes"]), compact=False)
|
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
|
wrote |= merge_trajectories(target, new["trajectories"])
|
||||||
tag = f"{ctx['changed']}-{manifest[name]['sha256'][:8]}"
|
|
||||||
wrote |= L.jsonl_file(f"{target}/trajectories-{tag}.jsonl", new["trajectories"])
|
|
||||||
elif target:
|
elif target:
|
||||||
old = L.read_json(target)
|
old = L.read_json(target)
|
||||||
lines = mod.describe(old, new)
|
lines = mod.describe(old, new)
|
||||||
@@ -78,6 +102,8 @@ def build(check=False, report=None):
|
|||||||
out.append(report_form.TEMPLATE)
|
out.append(report_form.TEMPLATE)
|
||||||
if L.write_bytes(codegen.GRAPH_JS, codegen.graph_js().encode("utf-8"), check):
|
if L.write_bytes(codegen.GRAPH_JS, codegen.graph_js().encode("utf-8"), check):
|
||||||
out.append(codegen.GRAPH_JS)
|
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
|
# 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 not check or not out:
|
||||||
if L.write_bytes(metadata.OUT, metadata.render(metadata.build()).encode("utf-8"), check):
|
if L.write_bytes(metadata.OUT, metadata.render(metadata.build()).encode("utf-8"), check):
|
||||||
@@ -100,16 +126,38 @@ def main(argv=None):
|
|||||||
up.add_argument("--report")
|
up.add_argument("--report")
|
||||||
b = sub.add_parser("build")
|
b = sub.add_parser("build")
|
||||||
b.add_argument("--check", action="store_true")
|
b.add_argument("--check", action="store_true")
|
||||||
k = sub.add_parser("export-bot-kit", help="zip policy.json, solver.js and graph.js for the bot")
|
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")
|
k.add_argument("--out", default="exports")
|
||||||
|
sub.add_parser("rebuild", help="rebuild everything made from the runs: graph, route model, plan, reports, statistics, build")
|
||||||
|
sub.add_parser("send-pdf", help="open a pull request on the bot's repo when the route PDF changed (private copy only)")
|
||||||
r = sub.add_parser("refresh", help="update every source, then rebuild everything (the daily workflow, locally)")
|
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)")
|
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)
|
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":
|
if a.cmd == "export-bot-kit":
|
||||||
from .etl.handoff import export_bot_kit
|
from .etl.handoff import export_bot_kit
|
||||||
print(f"wrote {export_bot_kit(a.out)}")
|
print(f"wrote {export_bot_kit(a.out)}")
|
||||||
return 0
|
return 0
|
||||||
|
if a.cmd == "rebuild":
|
||||||
|
from .etl.handoff import rebuild
|
||||||
|
return rebuild()
|
||||||
|
if a.cmd == "send-pdf":
|
||||||
|
from .etl.send_pdf import send
|
||||||
|
return send()
|
||||||
if a.cmd == "refresh":
|
if a.cmd == "refresh":
|
||||||
from .etl.handoff import refresh
|
from .etl.handoff import refresh
|
||||||
return refresh(main, a.bot)
|
return refresh(main, a.bot)
|
||||||
|
|||||||
@@ -46,15 +46,20 @@ crosswalk:
|
|||||||
- ["^enter the valley alone", company, "Alone"]
|
- ["^enter the valley alone", company, "Alone"]
|
||||||
- ["^enter the valley with one of your squadmates", company, "1 Squadmate"]
|
- ["^enter the valley with one of your squadmates", company, "1 Squadmate"]
|
||||||
- ["^enter the valley with two of your squadmates", company, "2 Squadmates"]
|
- ["^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 east toward the roar", direction, "East"]
|
||||||
- ["^head west toward the scent", direction, "West"]
|
- ["^head west toward the scent", direction, "West"]
|
||||||
- ["^head toward the center of the forest", direction, "Center"]
|
- ["^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"]
|
- ["^keep walking the cadets are just as dangerous", scream, "Ignore the scream"]
|
||||||
- ["^run and hope", sighting_action, "Retreat / run"]
|
- ["^run and hope", sighting_action, "Retreat / run"]
|
||||||
- ["hold still", sighting_action, "Hold still"]
|
- ["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"]
|
- ["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"]
|
- ["meeting its gaze", sighting_action, "Meet its gaze"]
|
||||||
- ["^hide behind a tree", sighting_action, "Hide"]
|
- ["^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]
|
- ["^investigate the scream", scream_investigate, true]
|
||||||
- ["^help your squadmate", scream, "Investigate & help"]
|
- ["^help your squadmate", scream, "Investigate & help"]
|
||||||
- ["^play it safe and leave them", scream, "Investigate & leave"]
|
- ["^play it safe and leave them", scream, "Investigate & leave"]
|
||||||
@@ -68,14 +73,22 @@ crosswalk:
|
|||||||
- ["^leave the bullies alive", resolution, "Left bullies to the dragons"]
|
- ["^leave the bullies alive", resolution, "Left bullies to the dragons"]
|
||||||
- ["tourniquet", resolution, "Tourniquet"]
|
- ["tourniquet", resolution, "Tourniquet"]
|
||||||
# the wounded cadet's other two choices (the bot has not logged this screen yet, so these are kept loose)
|
# 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", resolution, "Left injured cadet"]
|
- ["leave (them|him|her) to die|^keep going clearly they've been found lacking", resolution, "Left injured cadet"]
|
||||||
- ["take (their|his|her) weapons?", resolution, "Took their weapons"]
|
- ["take (their|his|her|the cadet's) weapons?", resolution, "Took their weapons"]
|
||||||
- ["^walk toward the east", post_path, "East"]
|
- ["^walk toward the east", post_path, "East"]
|
||||||
- ["^walk toward the west", post_path, "West"]
|
- ["^walk toward the west", post_path, "West"]
|
||||||
- ["^walk farther into the forest", post_path, "Forest"]
|
- ["^walk farther into the forest", post_path, "Forest"]
|
||||||
- ["^continue toward the center of the valley", hour, "Valley"]
|
- ["^continue toward the center of the valley", hour, "Valley"]
|
||||||
- ["^find the tallest tree", hour, "Tree"]
|
- ["^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"]
|
- ["^descend quickly", branch, "Descend quickly: Red"]
|
||||||
- ["^climb down slowly to pursue the green", branch, "Descend slowly: two Greens"]
|
- ["^climb down slowly to pursue the green", branch, "Descend slowly: two Greens"]
|
||||||
- ["^reds are too hot tempered", red, "Let it pass (two Greens)"]
|
- ["^reds are too hot tempered", red, "Let it pass (two Greens)"]
|
||||||
- ["^jump (now|in a few seconds)", red, "Jump onto the Red"]
|
- ["^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
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# "Report a run": the questions of the GitHub issue form, and how each answer becomes a column of runs_clean.csv.
|
# "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
|
# 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";
|
# up to date), and collection/etl/runs.py codes every report with it. Each option is "label shown: column value";
|
||||||
@@ -11,7 +11,8 @@ title: "Run report"
|
|||||||
label: run report
|
label: run report
|
||||||
intro: |
|
intro: |
|
||||||
Thanks for reporting a run! Answer what you remember; leave anything you're unsure of on "Not sure".
|
Thanks for reporting a run! Answer what you remember; leave anything you're unsure of on "Not sure".
|
||||||
Every answer here is **public** (this is a GitHub issue) and goes into the Atlas's open data as source "reported".
|
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.
|
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.
|
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.
|
||||||
|
|
||||||
|
|||||||
@@ -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,6 +150,10 @@ def code_row(r, C):
|
|||||||
company = company_raw[: -len(suffix)] if left_squad else company_raw
|
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"]):
|
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"
|
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"]
|
pools = F["sighting_pool"]
|
||||||
pool = list(pools.get(company, {}).get(direction, [])) + (list(pools["Alone"].get(direction, [])) if left_squad else [])
|
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:
|
if first and first != "Unsure" and pool and first not in pool:
|
||||||
@@ -250,7 +254,7 @@ def code_row(r, C):
|
|||||||
goal = g("goal") or (A["goal_v2"].get(goal_raw, goal_raw) if goal_raw and goal_raw != "Unknown" else None) or "(not asked/blank)"
|
goal = g("goal") or (A["goal_v2"].get(goal_raw, goal_raw) if goal_raw and goal_raw != "Unknown" else None) or "(not asked/blank)"
|
||||||
return {
|
return {
|
||||||
"source": source, "date": date, "wing": wing, "section": section,
|
"source": source, "date": date, "wing": wing, "section": section,
|
||||||
"squad": g("squad") or "Unknown", "attempt": attempt,
|
"squad": A["squad_any_case"].get((g("squad") or "").strip().lower(), g("squad") or "Unknown"), "attempt": attempt,
|
||||||
# "I've lost count" means many attempts, so it is a later attempt, not missing
|
# "I've lost count" means many attempts, so it is a later attempt, not missing
|
||||||
"attempt_group": "First attempt" if attempt == 1 else ("Later attempt" if (attempt and attempt > 1) or "lost count" in (g("attempt") or "").lower() else "Unknown"),
|
"attempt_group": "First attempt" if attempt == 1 else ("Later attempt" if (attempt and attempt > 1) or "lost count" in (g("attempt") or "").lower() else "Unknown"),
|
||||||
"goal": goal, "company": company, "left_squadmates": left_squad,
|
"goal": goal, "company": company, "left_squadmates": left_squad,
|
||||||
|
|||||||
+71
-15
@@ -28,6 +28,8 @@ ALONE = "(alone)"
|
|||||||
ALPHA = 20
|
ALPHA = 20
|
||||||
ALPHA_GRID = [1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 20000, 100000]
|
ALPHA_GRID = [1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 20000, 100000]
|
||||||
ENC_CATS = G["encounter_outcomes"]
|
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):
|
def enc_colour(ctx):
|
||||||
@@ -62,6 +64,8 @@ def prepare_run(r):
|
|||||||
v = {"company": r["company"] if r["company"] in DECISIONS["company"] else None,
|
v = {"company": r["company"] if r["company"] in DECISIONS["company"] else None,
|
||||||
"direction": r["direction"] if r["direction"] in DECISIONS["direction"] 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}
|
"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")
|
lf = r.get("left_squadmates")
|
||||||
known = lf is not None and not (isinstance(lf, float) and lf != lf) and lf != ""
|
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["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)
|
||||||
@@ -69,7 +73,14 @@ def prepare_run(r):
|
|||||||
v["diedSight"] = r["scream"] == "DIED at first sighting"
|
v["diedSight"] = r["scream"] == "DIED at first sighting"
|
||||||
if v["diedSight"]:
|
if v["diedSight"]:
|
||||||
return v
|
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"]
|
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":
|
if r["scream"] == "Investigate & help":
|
||||||
v["help"] = True
|
v["help"] = True
|
||||||
v["fight"] = FIGHT_OF.get(r.get("combat_first"))
|
v["fight"] = FIGHT_OF.get(r.get("combat_first"))
|
||||||
@@ -113,7 +124,9 @@ def prepare_run(r):
|
|||||||
ended = lambda c: r.get("enc_" + c) and r.get("enc_" + c) != "Changed my mind" # noqa: E731
|
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 \
|
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 ended("Orange") else "Brown" if ended("Brown") else \
|
||||||
"Orange" if r.get("enc_Orange") else "Brown" if r.get("enc_Brown") else None
|
"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"]:
|
if v["meadow"]:
|
||||||
v["encCtx"] = "meadow-" + v["meadow"]
|
v["encCtx"] = "meadow-" + v["meadow"]
|
||||||
if v.get("encCtx"):
|
if v.get("encCtx"):
|
||||||
@@ -124,13 +137,19 @@ def prepare_run(r):
|
|||||||
return v
|
return v
|
||||||
|
|
||||||
|
|
||||||
# what each chance event observed in a prepared run
|
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 = {
|
OBSERVE = {
|
||||||
"fs": lambda v: v.get("fs"),
|
"fs": lambda v: v.get("fs"),
|
||||||
"dieSight": lambda v: ("die" if v.get("diedSight") else "live") if v.get("fs") else None,
|
"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,
|
"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,
|
"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 else ("yes" if v["shadow"] else "no"),
|
"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"),
|
"shadowColour": lambda v: v.get("shadowColour"),
|
||||||
"meadow": lambda v: v.get("meadow"),
|
"meadow": lambda v: v.get("meadow"),
|
||||||
}
|
}
|
||||||
@@ -143,31 +162,46 @@ def ctx_key(v, names):
|
|||||||
|
|
||||||
# ---------------------------------------------------------------- 2. counts
|
# ---------------------------------------------------------------- 2. counts
|
||||||
|
|
||||||
def count_tables(prepared):
|
def can_bond(ctx, colour):
|
||||||
"""Counts for every chance event at every back-off level, plus each encounter's outcomes."""
|
"""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 = {}
|
T = {}
|
||||||
for node, sp in CHANCE.items():
|
for node, sp in CHANCE.items():
|
||||||
t = T[node] = {}
|
t = T[node] = {}
|
||||||
for v in prepared:
|
for i, v in enumerate(prepared):
|
||||||
y = OBSERVE[node](v)
|
y = OBSERVE[node](v)
|
||||||
if not y:
|
if not y:
|
||||||
continue
|
continue
|
||||||
|
w = weights[i].get(node, 1) if weights else 1
|
||||||
|
if w == 0:
|
||||||
|
continue
|
||||||
for L in range(len(sp["context"]) + 1):
|
for L in range(len(sp["context"]) + 1):
|
||||||
names = sp["context"][:L]
|
names = sp["context"][:L]
|
||||||
if any(v.get(k) is None for k in names):
|
if any(v.get(k) is None for k in names):
|
||||||
break
|
break
|
||||||
c = t.setdefault(f"{L}:{ctx_key(v, names)}", {})
|
c = t.setdefault(f"{L}:{ctx_key(v, names)}", {})
|
||||||
c[y] = c.get(y, 0) + 1
|
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"] = {}
|
enc = T["encounter"] = {}
|
||||||
for v in prepared:
|
for v in prepared:
|
||||||
if not v.get("encCtx"):
|
if not v.get("encCtx"):
|
||||||
continue
|
continue
|
||||||
c = enc.setdefault(v["encCtx"], {"outcomes": {}, "seen": {}})
|
c = enc.setdefault(v["encCtx"], {"outcomes": {}, "seen": {}})
|
||||||
if v.get("encOutcome"):
|
if v.get("encOutcome") and can_bond(v["encCtx"], v["encOutcome"]):
|
||||||
c["outcomes"][v["encOutcome"]] = c["outcomes"].get(v["encOutcome"], 0) + 1
|
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)
|
# which colours can ever end a run in this context (from all runs, genuine or not)
|
||||||
for v in prepared:
|
for v in prepared:
|
||||||
if v.get("encCtx") and v.get("encOutcome") and v["encOutcome"] != "burn":
|
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
|
enc[v["encCtx"]]["seen"][v["encOutcome"]] = 1
|
||||||
return T
|
return T
|
||||||
|
|
||||||
@@ -249,13 +283,17 @@ def fit_alpha(T, node):
|
|||||||
pairs = []
|
pairs = []
|
||||||
for key in t:
|
for key in t:
|
||||||
L = int(key.split(":")[0])
|
L = int(key.split(":")[0])
|
||||||
if L == 0:
|
if L <= CHANCE[node].get("distinct", 0): # the top level, and levels that are not pooled (game.yaml)
|
||||||
continue
|
continue
|
||||||
ctx = key[key.index(":") + 1:].split("|")
|
ctx = key[key.index(":") + 1:].split("|")
|
||||||
parent = f"{L - 1}:" + "|".join(ctx[:L - 1])
|
parent = f"{L - 1}:" + "|".join(ctx[:L - 1])
|
||||||
pairs.append(([t[key].get(k, 0) for k in cats], pooled(parent)))
|
pairs.append(([t[key].get(k, 0) for k in cats], pooled(parent)))
|
||||||
if not pairs:
|
if not pairs:
|
||||||
return {"alpha": ALPHA, "logLik": None}
|
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, {}
|
best_a, best_ll, lls = ALPHA, -math.inf, {}
|
||||||
for a in ALPHA_GRID:
|
for a in ALPHA_GRID:
|
||||||
ll = 0
|
ll = 0
|
||||||
@@ -334,10 +372,14 @@ class Params:
|
|||||||
In draw mode each world draws its numbers in the order its own walk of the game first needs them (a branch with
|
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.
|
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)}.
|
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):
|
def __init__(self, T, mode="mean", seeds=(), alphas=None, given=None):
|
||||||
self.T, self.mode, self.alphas = T, mode, alphas or {}
|
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.rngs = [Rng(s) for s in seeds] if mode == "draw" else []
|
||||||
self.D = len(self.rngs) if mode == "draw" else 1
|
self.D = len(self.rngs) if mode == "draw" else 1
|
||||||
self.memo = {} # (node, level key) or ("enc", ctx) -> array (K, D)
|
self.memo = {} # (node, level key) or ("enc", ctx) -> array (K, D)
|
||||||
@@ -345,6 +387,14 @@ class Params:
|
|||||||
self.world = None # while drawing one world (see draw_world), its index
|
self.world = None # while drawing one world (see draw_world), its index
|
||||||
self._cache = {}
|
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):
|
def _levels(self, node, state):
|
||||||
sp = CHANCE[node]
|
sp = CHANCE[node]
|
||||||
out = []
|
out = []
|
||||||
@@ -371,6 +421,10 @@ class Params:
|
|||||||
return self.memo[mk]
|
return self.memo[mk]
|
||||||
|
|
||||||
def chance(self, node, state):
|
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
|
# 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"]))
|
ck = (node, tuple(state.get(k) for k in CHANCE[node]["context"]))
|
||||||
if self.world is None and ck in self._cache:
|
if self.world is None and ck in self._cache:
|
||||||
@@ -382,13 +436,15 @@ class Params:
|
|||||||
|
|
||||||
def _chance(self, node, state):
|
def _chance(self, node, state):
|
||||||
cats = CHANCE[node]["outcomes"]
|
cats = CHANCE[node]["outcomes"]
|
||||||
al = self.alphas.get(node) or ALPHA
|
fitted = self.alphas.get(node) or ALPHA
|
||||||
|
distinct = CHANCE[node].get("distinct", 0)
|
||||||
p = None
|
p = None
|
||||||
for key in self._levels(node, state):
|
for L, key in enumerate(self._levels(node, state)):
|
||||||
c = self.T[node].get(key, {})
|
c = self.T[node].get(key, {})
|
||||||
parent = p
|
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):
|
def make_a(d, c=c, parent=parent, al=al):
|
||||||
if parent is None:
|
if parent is None:
|
||||||
return [c.get(k, 0) + 0.5 for k in cats]
|
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)]
|
return [c.get(k, 0) + al * (parent[i] if d is None else parent[i][d]) for i, k in enumerate(cats)]
|
||||||
|
|||||||
+54
-5
@@ -250,13 +250,30 @@ def draw_worlds(T, seeds, alphas, support):
|
|||||||
"""Posterior draws, one world per seed, each drawn in its own walk of the game (see Params)."""
|
"""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 = model.Params(T, "draw", seeds=seeds, alphas=alphas)
|
||||||
p.reached = {}
|
p.reached = {}
|
||||||
|
default = dict(p.given)
|
||||||
for d in range(p.D):
|
for d in range(p.D):
|
||||||
p.world = d
|
p.world = d
|
||||||
_Drawer(p, support, d, p.reached).root()
|
_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
|
p.world = None
|
||||||
return p
|
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
|
# ---------------------------------------------------------------- objectives
|
||||||
|
|
||||||
def solve(params, X, support, lam=0.0, record=False, only=None):
|
def solve(params, X, support, lam=0.0, record=False, only=None):
|
||||||
@@ -311,12 +328,18 @@ def summarise(xs):
|
|||||||
|
|
||||||
# ---------------------------------------------------------------- the published policy
|
# ---------------------------------------------------------------- the published policy
|
||||||
|
|
||||||
def build_policy(runs, draws=200, seed=20261101, min_support=None, alpha=None, colours=None):
|
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 (atlas.coding), as dicts."""
|
"""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
|
colours = colours or model.COLOURS
|
||||||
min_support = G["min_support"] if min_support is None else min_support
|
min_support = G["min_support"] if min_support is None else min_support
|
||||||
prepared = [model.prepare_run(r) for r in runs]
|
prepared = [model.prepare_run(r) for r in runs]
|
||||||
T = model.count_tables(prepared)
|
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)
|
support, counts = model.support_from(prepared, min_support)
|
||||||
fitted = {k: model.fit_alpha(T, k) for k in model.CHANCE}
|
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()}
|
alphas = {k: alpha for k in model.CHANCE} if alpha else {k: f["alpha"] for k, f in fitted.items()}
|
||||||
@@ -325,7 +348,8 @@ def build_policy(runs, draws=200, seed=20261101, min_support=None, alpha=None, c
|
|||||||
# Cross-fitting: choose the policy on one random half of the runs and score it on the other half.
|
# Cross-fitting: choose the policy on one random half of the runs and score it on the other half.
|
||||||
r = model.Rng(seed)
|
r = model.Rng(seed)
|
||||||
fold = [0 if r() < 0.5 else 1 for _ in prepared]
|
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]) for h in (0, 1)]
|
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]
|
half_params = [model.Params(Th, "mean", alphas=alphas) for Th in halves]
|
||||||
|
|
||||||
targets = {}
|
targets = {}
|
||||||
@@ -357,6 +381,28 @@ def build_policy(runs, draws=200, seed=20261101, min_support=None, alpha=None, c
|
|||||||
"crossFit": {"inSample": (cross[0]["inSample"] + cross[1]["inSample"]) / 2,
|
"crossFit": {"inSample": (cross[0]["inSample"] + cross[1]["inSample"]) / 2,
|
||||||
"heldOut": (cross[0]["heldOut"] + cross[1]["heldOut"]) / 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 {
|
return {
|
||||||
"schema": 1,
|
"schema": 1,
|
||||||
"model": {
|
"model": {
|
||||||
@@ -364,10 +410,13 @@ def build_policy(runs, draws=200, seed=20261101, min_support=None, alpha=None, c
|
|||||||
"alphas": alphas, "alphaFit": {k: f["logLik"] for k, f in fitted.items()}, "draws": draws, "seed": seed,
|
"alphas": alphas, "alphaFit": {k: f["logLik"] for k, f in fitted.items()}, "draws": draws, "seed": seed,
|
||||||
"minSupport": min_support,
|
"minSupport": min_support,
|
||||||
"chanceContext": {k: s["context"] for k, s in model.CHANCE.items()},
|
"chanceContext": {k: s["context"] for k, s in model.CHANCE.items()},
|
||||||
|
"given": model.DEFAULT_GIVEN,
|
||||||
"decisions": model.DECISIONS, "support": support, "supportCounts": counts,
|
"decisions": model.DECISIONS, "support": support, "supportCounts": counts,
|
||||||
"tables": T,
|
"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
|
# 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", "decisions", "chance", "encounters", "encounter_outcomes",
|
"game": {k: G[k] for k in ("version", "colours", "givens", "decisions", "chance", "encounters", "encounter_outcomes",
|
||||||
"by_colour", "start", "steps", "from_form", "bot_text")},
|
"by_colour", "start", "steps", "from_form", "bot_text")},
|
||||||
},
|
},
|
||||||
"data": {"runs": len(runs)},
|
"data": {"runs": len(runs)},
|
||||||
|
|||||||
+23
-7
@@ -84,15 +84,19 @@
|
|||||||
[/^enter the valley alone/, "company", "Alone"],
|
[/^enter the valley alone/, "company", "Alone"],
|
||||||
[/^enter the valley with one of your squadmates/, "company", "1 Squadmate"],
|
[/^enter the valley with one of your squadmates/, "company", "1 Squadmate"],
|
||||||
[/^enter the valley with two of your squadmates/, "company", "2 Squadmates"],
|
[/^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 east toward the roar/, "direction", "East"],
|
||||||
[/^head west toward the scent/, "direction", "West"],
|
[/^head west toward the scent/, "direction", "West"],
|
||||||
[/^head toward the center of the forest/, "direction", "Center"],
|
[/^head toward the center of the forest/, "direction", "Center"],
|
||||||
|
[/^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"],
|
[/^keep walking the cadets are just as dangerous/, "scream", "Ignore the scream"],
|
||||||
[/^run and hope/, "sighting_action", "Retreat / run"],
|
[/^run and hope/, "sighting_action", "Retreat / run"],
|
||||||
[/hold still/, "sighting_action", "Hold still"],
|
[/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"],
|
[/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"],
|
[/meeting its gaze/, "sighting_action", "Meet its gaze"],
|
||||||
[/^hide behind a tree/, "sighting_action", "Hide"],
|
[/^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],
|
[/^investigate the scream/, "scream_investigate", true],
|
||||||
[/^help your squadmate/, "scream", "Investigate & help"],
|
[/^help your squadmate/, "scream", "Investigate & help"],
|
||||||
[/^play it safe and leave them/, "scream", "Investigate & leave"],
|
[/^play it safe and leave them/, "scream", "Investigate & leave"],
|
||||||
@@ -105,13 +109,15 @@
|
|||||||
[/^allow your squadmate to exact/, "resolution", "Squadmate's revenge"],
|
[/^allow your squadmate to exact/, "resolution", "Squadmate's revenge"],
|
||||||
[/^leave the bullies alive/, "resolution", "Left bullies to the dragons"],
|
[/^leave the bullies alive/, "resolution", "Left bullies to the dragons"],
|
||||||
[/tourniquet/, "resolution", "Tourniquet"],
|
[/tourniquet/, "resolution", "Tourniquet"],
|
||||||
[/leave (them|him|her) to die/, "resolution", "Left injured cadet"],
|
[/leave (them|him|her) to die|^keep going clearly they've been found lacking/, "resolution", "Left injured cadet"],
|
||||||
[/take (their|his|her) weapons?/, "resolution", "Took their weapons"],
|
[/take (their|his|her|the cadet's) weapons?/, "resolution", "Took their weapons"],
|
||||||
[/^walk toward the east/, "post_path", "East"],
|
[/^walk toward the east/, "post_path", "East"],
|
||||||
[/^walk toward the west/, "post_path", "West"],
|
[/^walk toward the west/, "post_path", "West"],
|
||||||
[/^walk farther into the forest/, "post_path", "Forest"],
|
[/^walk farther into the forest/, "post_path", "Forest"],
|
||||||
[/^continue toward the center of the valley/, "hour", "Valley"],
|
[/^continue toward the center of the valley/, "hour", "Valley"],
|
||||||
[/^find the tallest tree/, "hour", "Tree"],
|
[/^find the tallest tree/, "hour", "Tree"],
|
||||||
|
[/^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"],
|
[/^descend quickly/, "branch", "Descend quickly: Red"],
|
||||||
[/^climb down slowly to pursue the green/, "branch", "Descend slowly: two Greens"],
|
[/^climb down slowly to pursue the green/, "branch", "Descend slowly: two Greens"],
|
||||||
[/^reds are too hot tempered/, "red", "Let it pass (two Greens)"],
|
[/^reds are too hot tempered/, "red", "Let it pass (two Greens)"],
|
||||||
@@ -120,9 +126,19 @@
|
|||||||
// END CROSSWALK
|
// END CROSSWALK
|
||||||
|
|
||||||
/** Map one bot trajectory onto the form's decision variables. Unmapped choices are listed, not guessed. */
|
/** Map one bot trajectory onto the form's decision variables. Unmapped choices are listed, not guessed. */
|
||||||
|
/**
|
||||||
|
* 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. A step without `to` (a run in progress) is kept unless the next step is on the
|
||||||
|
* same screen.
|
||||||
|
*/
|
||||||
|
function playedSteps(steps) {
|
||||||
|
return (steps || []).filter((s, i) => !(i + 1 < steps.length && steps[i + 1].scene != null && steps[i + 1].scene === s.scene && s.to !== steps[i + 1].scene));
|
||||||
|
}
|
||||||
|
|
||||||
function trajectoryVariables(traj) {
|
function trajectoryVariables(traj) {
|
||||||
const vars = {}, unmapped = [];
|
const vars = {}, unmapped = [];
|
||||||
for (const s of traj.steps) {
|
for (const s of playedSteps(traj.steps)) {
|
||||||
const t = norm(s.optionText);
|
const t = norm(s.optionText);
|
||||||
const hit = CROSSWALK.find(([re]) => re.test(t));
|
const hit = CROSSWALK.find(([re]) => re.test(t));
|
||||||
if (hit) { if (!(hit[1] in vars)) vars[hit[1]] = hit[2]; }
|
if (hit) { if (!(hit[1] in vars)) vars[hit[1]] = hit[2]; }
|
||||||
@@ -202,7 +218,7 @@
|
|||||||
for (const o of s.options) g[id].options[o.id] = { id: o.id, text: o.text, n: 0, to: {}, bySource: {}, intentionalBurns: 0 };
|
for (const o of s.options) g[id].options[o.id] = { id: o.id, text: o.text, n: 0, to: {}, bySource: {}, intentionalBurns: 0 };
|
||||||
}
|
}
|
||||||
for (const t of trajs) {
|
for (const t of trajs) {
|
||||||
for (const s of t.steps) {
|
for (const s of playedSteps(t.steps)) {
|
||||||
const node = g[s.scene] || (g[s.scene] = { id: s.scene, stage: s.stage, tint: s.tint, label: s.stage, visits: 0, options: {} });
|
const node = g[s.scene] || (g[s.scene] = { id: s.scene, stage: s.stage, tint: s.tint, label: s.stage, visits: 0, options: {} });
|
||||||
node.visits++;
|
node.visits++;
|
||||||
const o = node.options[s.option] || (node.options[s.option] = { id: s.option, text: s.optionText, n: 0, to: {}, bySource: {}, intentionalBurns: 0 });
|
const o = node.options[s.option] || (node.options[s.option] = { id: s.option, text: s.optionText, n: 0, to: {}, bySource: {}, intentionalBurns: 0 });
|
||||||
@@ -225,5 +241,5 @@
|
|||||||
return g;
|
return g;
|
||||||
}
|
}
|
||||||
|
|
||||||
return { betaPosterior, betaQuantile, ibeta, CROSSWALK, trajectoryVariables, formRunVariables, VAR_STAGES, buildVariableGraph, buildSceneGraph, norm };
|
return { betaPosterior, betaQuantile, ibeta, CROSSWALK, trajectoryVariables, playedSteps, formRunVariables, VAR_STAGES, buildVariableGraph, buildSceneGraph, norm };
|
||||||
});
|
});
|
||||||
|
|||||||
+204
-20
@@ -11,6 +11,10 @@
|
|||||||
*
|
*
|
||||||
* Public API (unchanged for the bot): advisor(sample, colour, objective, { only }), recommendOption(adv, h, texts),
|
* Public API (unchanged for the bot): advisor(sample, colour, objective, { only }), recommendOption(adv, h, texts),
|
||||||
* solverHistory(formVars, seen), makeParams(tables, { alphas, game }), ENCOUNTERS (set from the first sample).
|
* solverHistory(formVars, seen), makeParams(tables, { alphas, game }), ENCOUNTERS (set from the first sample).
|
||||||
|
* Since November 2026: advisor options `attempt` (the account's attempt number: a first attempt has its own
|
||||||
|
* 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.
|
||||||
* UMD: window.ThreshSolver in the browser, module.exports in Node. No dependencies.
|
* UMD: window.ThreshSolver in the browser, module.exports in Node. No dependencies.
|
||||||
*/
|
*/
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
@@ -24,22 +28,57 @@
|
|||||||
const encColour = (ctx) => (ctx === "tree-Greens" ? "Green" : ctx.split("-")[1]);
|
const encColour = (ctx) => (ctx === "tree-Greens" ? "Green" : ctx.split("-")[1]);
|
||||||
const api = {};
|
const api = {};
|
||||||
|
|
||||||
/* ---------- the odds: posterior means with hierarchical back-off (as in core/atlas/model.py) ---------- */
|
/* ---------- posterior draws, for Thompson sampling ---------- */
|
||||||
function makeParams(T, { alphas = {}, game }) {
|
function rng(seed) {
|
||||||
const memo = new Map();
|
let x = (seed >>> 0) || 0x9e3779b9;
|
||||||
|
return () => { x ^= x << 13; x >>>= 0; x ^= x >>> 17; x ^= x << 5; x >>>= 0; return (x + 0.5) / 4294967296; };
|
||||||
|
}
|
||||||
|
function normal(rand) { return Math.sqrt(-2 * Math.log(rand())) * Math.cos(2 * Math.PI * rand()); }
|
||||||
|
function gamma(k, rand) { // Marsaglia and Tsang
|
||||||
|
if (k < 1) return gamma(k + 1, rand) * Math.pow(rand(), 1 / k);
|
||||||
|
const d = k - 1 / 3, c = 1 / Math.sqrt(9 * d);
|
||||||
|
for (;;) {
|
||||||
|
let x, v;
|
||||||
|
do { x = normal(rand); v = 1 + c * x; } while (v <= 0);
|
||||||
|
v = v * v * v;
|
||||||
|
const u = rand();
|
||||||
|
if (u < 1 - 0.0331 * x ** 4 || Math.log(u) < 0.5 * x * x + d * (1 - v + Math.log(v))) return d * v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function dirichlet(a, rand) {
|
||||||
|
const g = a.map((x) => Math.max(gamma(x, rand), 1e-300));
|
||||||
|
let s = 0; for (const x of g) s += x;
|
||||||
|
return g.map((x) => x / s);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- the odds: posterior means (or, with rand, one posterior draw) with hierarchical back-off ---------- */
|
||||||
|
/** The givens of a run (game.yaml `givens`): the defaults, with `attempt` set from an attempt number or name. */
|
||||||
|
function givenFor(game, { attempt = null, given = null } = {}) {
|
||||||
|
const g = Object.fromEntries(Object.entries(game.givens || {}).map(([k, v]) => [k, v.default]));
|
||||||
|
if (attempt != null && game.givens && game.givens.attempt) g.attempt = attempt === 1 || attempt === "1" || attempt === "First attempt" ? "First attempt" : "Later attempt";
|
||||||
|
return { ...g, ...(given || {}) };
|
||||||
|
}
|
||||||
|
// given: the run's givens; memo: pass the same Map to get the same posterior draw for another given
|
||||||
|
function makeParams(T, { alphas = {}, game, rand = null, given = null, memo = new Map() }) {
|
||||||
|
const normalise = (a) => { let sum = 0; for (const x of a) sum += x; return a.map((x) => x / sum); };
|
||||||
|
const estimate = rand ? (a) => dirichlet(a, rand) : normalise;
|
||||||
|
const known = given || givenFor(game);
|
||||||
const ctxKey = (s, names) => names.map((k) => (s[k] == null ? "?" : s[k])).join("|");
|
const ctxKey = (s, names) => names.map((k) => (s[k] == null ? "?" : s[k])).join("|");
|
||||||
function chance(node, state) {
|
function chance(node, walked) {
|
||||||
const sp = game.chance[node], cats = sp.outcomes;
|
const sp = game.chance[node], cats = sp.outcomes;
|
||||||
|
// a closed gate (game.yaml `requires`): the roll always comes out as `otherwise`
|
||||||
|
if (sp.requires && Object.entries(sp.requires).some(([k, v]) => walked[k] !== v)) return Object.fromEntries(cats.map((k) => [k, k === sp.otherwise ? 1 : 0]));
|
||||||
|
const state = { ...known, ...walked };
|
||||||
let p = null;
|
let p = null;
|
||||||
for (let L = 0; L <= sp.context.length; L++) {
|
for (let L = 0; L <= sp.context.length; L++) {
|
||||||
const names = sp.context.slice(0, L);
|
const names = sp.context.slice(0, L);
|
||||||
if (names.some((k) => state[k] == null)) break;
|
if (names.some((k) => state[k] == null)) break;
|
||||||
const key = L + ":" + ctxKey(state, names), mk = node + "#" + key;
|
const key = L + ":" + ctxKey(state, names), mk = node + "#" + key;
|
||||||
if (memo.has(mk)) { p = memo.get(mk); continue; }
|
if (memo.has(mk)) { p = memo.get(mk); continue; }
|
||||||
const c = T[node][key] || {}, al = alphas[node] || ALPHA;
|
// a level that is not pooled (game.yaml `distinct`) keeps a token prior of one run
|
||||||
|
const c = T[node][key] || {}, al = L <= (sp.distinct || 0) ? 1 : alphas[node] || ALPHA;
|
||||||
const a = cats.map((k, i) => (c[k] || 0) + (p ? al * p[i] : 0.5));
|
const a = cats.map((k, i) => (c[k] || 0) + (p ? al * p[i] : 0.5));
|
||||||
let sum = 0; for (const x of a) sum += x;
|
p = estimate(a);
|
||||||
p = a.map((x) => x / sum);
|
|
||||||
memo.set(mk, p);
|
memo.set(mk, p);
|
||||||
}
|
}
|
||||||
return Object.fromEntries(cats.map((k, i) => [k, p[i]]));
|
return Object.fromEntries(cats.map((k, i) => [k, p[i]]));
|
||||||
@@ -49,9 +88,8 @@
|
|||||||
if (!memo.has(mk)) {
|
if (!memo.has(mk)) {
|
||||||
const e = T.encounter[ctx] || { outcomes: {}, seen: {} };
|
const e = T.encounter[ctx] || { outcomes: {}, seen: {} };
|
||||||
const cats = game.encounter_outcomes.filter((k) => k === "burn" || e.seen[k] || (e.outcomes[k] || 0) > 0 || k === encColour(ctx));
|
const cats = game.encounter_outcomes.filter((k) => k === "burn" || e.seen[k] || (e.outcomes[k] || 0) > 0 || k === encColour(ctx));
|
||||||
const a = cats.map((k) => (e.outcomes[k] || 0) + 0.5);
|
const a = estimate(cats.map((k) => (e.outcomes[k] || 0) + 0.5));
|
||||||
let sum = 0; for (const x of a) sum += x;
|
memo.set(mk, Object.fromEntries(cats.map((k, i) => [k, a[i]])));
|
||||||
memo.set(mk, Object.fromEntries(cats.map((k, i) => [k, a[i] / sum])));
|
|
||||||
}
|
}
|
||||||
return memo.get(mk);
|
return memo.get(mk);
|
||||||
}
|
}
|
||||||
@@ -149,17 +187,59 @@
|
|||||||
* the deadly roll just passed on the step after it. When h already has a later step but skips an earlier
|
* the deadly roll just passed on the step after it. When h already has a later step but skips an earlier
|
||||||
* decision (an older form record, say), the recommended option is assumed for the skipped one.
|
* decision (an older form record, say), the recommended option is assumed for the skipped one.
|
||||||
*/
|
*/
|
||||||
function advisor(sample, X, objective = "eventually", { only = null } = {}) {
|
function advisor(sample, X, objective = "eventually", { only = null, sampling = "best", seed = 1, draws = 40, attempt = null, given = null, fix = null } = {}) {
|
||||||
const m = sample.model, game = m.game;
|
const m = sample.model, game = m.game;
|
||||||
api.game = game; api.ENCOUNTERS = game.by_colour;
|
api.game = game; api.ENCOUNTERS = game.by_colour;
|
||||||
const params = makeParams(m.tables, { alphas: m.alphas, game });
|
// attempt: the account's attempt number (or "First attempt" / "Later attempt"). A first attempt has its own odds
|
||||||
const sol = objective === "eventually" ? solveRatio(params, game, m.support, X, only) : solve(params, game, m.support, X, 0, only);
|
// for the rolls that depend on it (the shadow); without it, a later attempt is assumed.
|
||||||
|
const defaults = givenFor(game), known = givenFor(game, { attempt, given });
|
||||||
|
const special = Object.keys(known).some((k) => known[k] !== defaults[k]);
|
||||||
|
// "uniform" (mapping) may take any option the game has, so it is solved without the minimum-support rule
|
||||||
|
const all = Object.fromEntries(Object.entries(game.decisions).map(([k, d]) => [k, d.options]));
|
||||||
|
const base = sampling === "uniform" ? { ...all, encounter: m.support.encounter } : m.support;
|
||||||
|
// fix: { decision: option } holds those decisions to one option (an experiment arm); the rest is solved around it
|
||||||
|
let support = base;
|
||||||
|
if (fix) {
|
||||||
|
support = { ...base };
|
||||||
|
for (const [k, o] of Object.entries(fix)) {
|
||||||
|
if (!game.decisions[k] || !game.decisions[k].options.includes(o)) throw new Error(`fix: ${k} has no option "${o}"`);
|
||||||
|
support[k] = [o];
|
||||||
|
if (game.decisions[k].support_by) for (const key of Object.keys(support)) if (key.startsWith(k + ":")) support[key] = [o];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// One world (the posterior means, or one draw): the odds for this run's givens, solved for the objective.
|
||||||
|
// "Eventually" on a first attempt: every later attempt is an ordinary one, worth its own ratio (lam), so the
|
||||||
|
// best play now maximises P(X now) + P(no bond now) * lam: the same score with lam fixed.
|
||||||
|
const solveWith = (rand) => {
|
||||||
|
const memo = new Map();
|
||||||
|
const mk = (g) => makeParams(m.tables, { alphas: m.alphas, game, rand, given: g, memo });
|
||||||
|
if (objective !== "eventually") { const params = mk(known); return { params, sol: solve(params, game, support, X, 0, only) }; }
|
||||||
|
if (!special) { const params = mk(known); return { params, sol: solveRatio(params, game, support, X, only) }; }
|
||||||
|
const lam = solveRatio(mk(defaults), game, base, X, only).lam;
|
||||||
|
const params = mk(known);
|
||||||
|
return { params, sol: { ...solve(params, game, support, X, lam, only), lam } };
|
||||||
|
};
|
||||||
|
// "best": the best route under the posterior means. "thompson": the best route of one posterior draw of the odds
|
||||||
|
// (one per attempt: make a new advisor with a new seed for each attempt), so every option is tried about as
|
||||||
|
// often as it is likely to be the best one; as the data firm up, sampling settles on the best route.
|
||||||
|
// "uniform": every option on the screen is equally likely (recommendOption picks; see there).
|
||||||
|
const thompson = sampling === "thompson";
|
||||||
|
const { params, sol } = solveWith(thompson ? rng(seed) : null);
|
||||||
|
// the chance Thompson sampling picks each option at a history, estimated from `draws` other draws: the
|
||||||
|
// propensity to log, so the runs can be re-weighted later
|
||||||
|
let worlds = null;
|
||||||
|
const propensityAt = (key, choice) => {
|
||||||
|
if (!thompson) return 1;
|
||||||
|
if (!worlds) worlds = Array.from({ length: draws }, (_, i) => solveWith(rng(seed * 7919 + i + 1)).sol.choices);
|
||||||
|
return worlds.filter((c) => c.get(key) === choice).length / draws;
|
||||||
|
};
|
||||||
const VARS = new Set([...Object.keys(game.decisions), ...Object.keys(game.chance), "encounter"]);
|
const VARS = new Set([...Object.keys(game.decisions), ...Object.keys(game.chance), "encounter"]);
|
||||||
const fmt = (v) => ({ pX: v.x, pOther: v.o, pReach: v.r });
|
const fmt = (v) => ({ pX: v.x, pOther: v.o, pReach: v.r });
|
||||||
const label = (k) => (game.decisions[k] || game.chance[k]).label;
|
const label = (k) => (game.decisions[k] || game.chance[k]).label;
|
||||||
const decisionAt = (name, key, extra) => {
|
const decisionAt = (name, key, extra) => {
|
||||||
const vals = sol.optVals.get(key) || {};
|
const vals = sol.optVals.get(key) || {};
|
||||||
return { kind: "decision", var: name, label: label(name), choice: sol.choices.get(key),
|
const choice = sol.choices.get(key);
|
||||||
|
return { kind: "decision", var: name, label: label(name), choice, propensity: propensityAt(key, choice),
|
||||||
options: Object.fromEntries(Object.entries(vals).map(([o, v]) => [o, fmt(v)])), ...extra };
|
options: Object.fromEntries(Object.entries(vals).map(([o, v]) => [o, fmt(v)])), ...extra };
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -197,13 +277,13 @@
|
|||||||
throw new Error("the game has no end");
|
throw new Error("the game has no end");
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
colour: X, objective, only, value: sol.value, step, params, game,
|
colour: X, objective, only, sampling, seed: sampling === "best" ? null : seed, given: known, fix, value: sol.value, step, params, game,
|
||||||
/** attempts recorded at an encounter (genuine attempts only), to show how much data a bond chance rests on */
|
/** attempts recorded at an encounter (genuine attempts only), to show how much data a bond chance rests on */
|
||||||
attempts: (ctx) => Object.values(((m.tables.encounter || {})[ctx] || { outcomes: {} }).outcomes).reduce((a, b) => a + b, 0),
|
attempts: (ctx) => Object.values(((m.tables.encounter || {})[ctx] || { outcomes: {} }).outcomes).reduce((a, b) => a + b, 0),
|
||||||
/** the next decision only (null when the next step is a roll or the run is over) */
|
/** the next decision only (null when the next step is a roll or the run is over) */
|
||||||
next(h) {
|
next(h) {
|
||||||
const s = step(h);
|
const s = step(h);
|
||||||
return s.kind === "decision" ? { decision: s.var, label: s.label, choice: s.choice, options: s.options } : null;
|
return s.kind === "decision" ? { decision: s.var, label: s.label, choice: s.choice, propensity: s.propensity, options: s.options } : null;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -219,10 +299,29 @@
|
|||||||
function recommendOption(adv, h, offered) {
|
function recommendOption(adv, h, offered) {
|
||||||
const rec = adv.next(h);
|
const rec = adv.next(h);
|
||||||
if (!rec) return null;
|
if (!rec) return null;
|
||||||
const pat = ((adv.game.bot_text || {})[rec.decision] || {})[rec.choice];
|
const texts = offered.map(norm), pats = (adv.game.bot_text || {})[rec.decision] || {};
|
||||||
const idx = pat ? offered.map(norm).findIndex((t) => new RegExp(pat).test(t)) : -1;
|
// mapping (sampling "uniform"): every option on the screen that the game knows is equally likely, except a
|
||||||
|
// decision held by `fix` and the bonding encounter (where the advisor's own choice stands)
|
||||||
|
if (adv.sampling === "uniform" && rec.decision !== "encounter" && !(adv.fix && adv.fix[rec.decision])) {
|
||||||
|
const on = Object.keys(rec.options).map((o) => [o, pats[o] ? texts.findIndex((t) => new RegExp(pats[o]).test(t)) : -1]).filter(([, i]) => i >= 0);
|
||||||
|
if (on.length) {
|
||||||
|
const [o, i] = on[Math.floor(rng(hash(`${adv.seed}|${rec.decision}|${canon(h)}`))() * on.length)];
|
||||||
|
return { index: i, decision: rec.decision, choice: o, propensity: 1 / on.length, margin: null, options: rec.options, reason: `${rec.label}: ${o} (mapping: 1 of ${on.length} at random)` };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// With squadmates, staying and the direction are one screen ("Go west with your squadmate", "Convince them to
|
||||||
|
// head east instead", "Leave your squadmate"): staying is answered with the direction that follows it.
|
||||||
|
if (rec.decision === "leave" && rec.choice === "Stay together") {
|
||||||
|
const then = adv.next({ ...h, leave: rec.choice });
|
||||||
|
const dp = then && then.decision === "direction" ? ((adv.game.bot_text || {}).direction || {})[then.choice] : null;
|
||||||
|
const di = dp ? texts.findIndex((t) => new RegExp(dp).test(t)) : -1;
|
||||||
|
if (di >= 0) return { index: di, decision: "leave", choice: rec.choice, also: { direction: then.choice }, propensity: rec.propensity * then.propensity, margin: null, options: rec.options, reason: `${rec.label}: ${rec.choice}, ${then.label}: ${then.choice}` };
|
||||||
|
}
|
||||||
|
const pat = pats[rec.choice];
|
||||||
|
const idx = pat ? texts.findIndex((t) => new RegExp(pat).test(t)) : -1;
|
||||||
const values = Object.values(rec.options).map((v) => v.pX).sort((a, b) => b - a);
|
const values = Object.values(rec.options).map((v) => v.pX).sort((a, b) => b - a);
|
||||||
return { index: idx < 0 ? null : idx, decision: rec.decision, choice: rec.choice, margin: values.length > 1 ? values[0] - values[1] : null,
|
return { index: idx < 0 ? null : idx, decision: rec.decision, choice: rec.choice, propensity: rec.propensity,
|
||||||
|
margin: values.length > 1 ? values[0] - values[1] : null,
|
||||||
options: rec.options,
|
options: rec.options,
|
||||||
reason: idx < 0 && rec.decision !== "encounter" ? "the recommended choice is not on this screen; use the bot's own rules" : `${rec.label}: ${rec.choice}` };
|
reason: idx < 0 && rec.decision !== "encounter" ? "the recommended choice is not on this screen; use the bot's own rules" : `${rec.label}: ${rec.choice}` };
|
||||||
}
|
}
|
||||||
@@ -262,8 +361,93 @@
|
|||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------- the experiment plan (planner/experiments.yaml, published as experiments.json) ---------- */
|
||||||
|
function hash(s) { let x = 2166136261; for (const ch of String(s)) { x ^= ch.codePointAt(0); x = Math.imul(x, 16777619) >>> 0; } return x || 1; }
|
||||||
|
/** The arm of the n-th unit (0-based) of an experiment: balanced blocks, each block a seeded shuffle of the arms. */
|
||||||
|
function armFor(experiment, n) {
|
||||||
|
const arms = experiment.arms, k = arms.length, rand = rng(hash(`${experiment.id}|${experiment.seed || 0}|${Math.floor(n / k)}`));
|
||||||
|
const order = arms.map((_, i) => i);
|
||||||
|
for (let i = k - 1; i > 0; i--) { const j = Math.floor(rand() * (i + 1)); [order[i], order[j]] = [order[j], order[i]]; }
|
||||||
|
return arms[order[n % k]];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* What an attempt is for, under the plan: assign(plan, { accountSeq, attempt, facts }) ->
|
||||||
|
* { experimentId, arm, fix, target, objective, sampling, seed, propensity, burn, planId }, or null when no
|
||||||
|
* experiment covers the attempt (use the account's own goal).
|
||||||
|
* accountSeq: the account's number in the order the accounts were made (0, 1, 2, ...), the same for its whole
|
||||||
|
* life; attempt: the account's attempt number (1 = its first threshing); facts: what the plan's `when` rules ask
|
||||||
|
* about the account, e.g. { sawShadowBefore: true }. The answer is the same every time for
|
||||||
|
* the same plan id, so a restart mid-attempt changes nothing. Pass the result to advisor():
|
||||||
|
* advisor(policy.samples.all, a.target, a.objective, { attempt, fix: a.fix, sampling: a.sampling, seed: a.seed })
|
||||||
|
* and log experimentId, arm, planId and the propensity on the run.
|
||||||
|
*/
|
||||||
|
function assign(plan, { accountSeq, attempt, facts = {} }) {
|
||||||
|
const takes = (e) => !e.accounts || ((((accountSeq - (e.accounts.offset || 0)) % e.accounts.every) + e.accounts.every) % e.accounts.every) < e.accounts.take;
|
||||||
|
// when: facts about the account that must hold (a fact the bot does not pass counts as false)
|
||||||
|
const holds = (e) => Object.entries(e.when || {}).every(([k, v]) => (facts[k] == null ? false : facts[k]) === v);
|
||||||
|
let open = (plan.experiments || []).filter((e) => e.status === "running" && attempt >= e.attempts.from && (e.attempts.to == null || attempt <= e.attempts.to)
|
||||||
|
&& takes(e) && holds(e));
|
||||||
|
if (!open.length) return null;
|
||||||
|
if (open.some((e) => e.exclusive)) open = open.filter((e) => e.exclusive); // an exclusive experiment takes its attempts whole
|
||||||
|
const total = open.reduce((s, e) => s + e.share, 0);
|
||||||
|
let u = rng(hash(`${plan.seed || 0}|${accountSeq}|${attempt}`))() * total, exp = open[open.length - 1];
|
||||||
|
for (const e of open) { if (u < e.share) { exp = e; break; } u -= e.share; }
|
||||||
|
// the unit that is randomised: the account (one arm for life) or the attempt (blocks within the account)
|
||||||
|
// (accounts are counted among those the experiment takes, so its blocks stay balanced)
|
||||||
|
const off = exp.accounts ? (((accountSeq - (exp.accounts.offset || 0)) % exp.accounts.every) + exp.accounts.every) % exp.accounts.every : 0;
|
||||||
|
const nth = exp.accounts ? Math.floor(accountSeq / exp.accounts.every) * exp.accounts.take + off : accountSeq;
|
||||||
|
let arm = exp.unit === "account" ? armFor(exp, nth) : armFor({ ...exp, seed: `${exp.seed || 0}|${accountSeq}` }, attempt - exp.attempts.from);
|
||||||
|
// cycle: a different combination of these decisions on every attempt of the account, none repeated until all
|
||||||
|
// are used (the combinations are walked with a step that shares no factor with their number)
|
||||||
|
if (arm.cycle) {
|
||||||
|
const keys = Object.keys(arm.cycle), total = keys.reduce((n, k) => n * arm.cycle[k].length, 1);
|
||||||
|
const gcd = (a, b) => (b ? gcd(b, a % b) : a), h = hash(`${exp.seed || 0}|${exp.id}|${accountSeq}`);
|
||||||
|
let step = (h % total) || 1;
|
||||||
|
while (gcd(step, total) !== 1) step = (step % total) + 1;
|
||||||
|
let i = ((h >>> 8) + (attempt - exp.attempts.from) * step) % total;
|
||||||
|
const combo = {};
|
||||||
|
for (const k of keys) { combo[k] = arm.cycle[k][i % arm.cycle[k].length]; i = Math.floor(i / arm.cycle[k].length); }
|
||||||
|
arm = { id: keys.map((k) => `${k}=${combo[k]}`).join(" / "), fix: { ...arm.fix, ...combo } };
|
||||||
|
}
|
||||||
|
return { experimentId: exp.id, arm: arm.id, fix: arm.fix || null, target: exp.target, objective: exp.objective || "eventually",
|
||||||
|
sampling: exp.sampling || "best", seed: hash(`${plan.seed || 0}|${exp.id}|${accountSeq}|${attempt}`),
|
||||||
|
propensity: (exp.share / total) / exp.arms.length, burn: exp.burn || null, planId: plan.id };
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- picks made from the screen tree (analysis/tree/build_tree.py, published as tree.json) ---------- */
|
||||||
|
/**
|
||||||
|
* Which option to pick on a screen, from what the tree knows about that screen:
|
||||||
|
* screenPick(tree, sceneId, offered, { mode, seed }) -> { index, text, n, mode, reason } (null: nothing offered)
|
||||||
|
* sceneId is the bot's own id for the screen; offered the option texts on it. An option the tree has never seen
|
||||||
|
* counts as never played.
|
||||||
|
* mode "least-tried": the option played least so far (mapping: fills the tree's gaps first).
|
||||||
|
* mode "thompson": for each option, draw a survival rate from what has been seen (survived + 1, died + 1) and
|
||||||
|
* take the highest: untested options get tried, deadly ones fade out. It looks one step
|
||||||
|
* ahead only, so use it where dying is the risk (a bonding encounter).
|
||||||
|
* Ties and draws use `seed` (give a new one per attempt and screen).
|
||||||
|
*/
|
||||||
|
function screenPick(tree, sceneId, offered, { mode = "least-tried", seed = 1 } = {}) {
|
||||||
|
if (!offered || !offered.length) return null;
|
||||||
|
const sc = ((tree || {}).screens || {})[sceneId], rand = rng(hash(`${seed}|${sceneId}|${mode}`));
|
||||||
|
const known = sc ? Object.values(sc.options) : [];
|
||||||
|
const rows = offered.map((text, index) => {
|
||||||
|
const o = known.find((k) => norm(k.text) === norm(text)) || { n: 0, to: {} };
|
||||||
|
const died = (o.to.DIED || { n: 0 }).n;
|
||||||
|
return { index, text, n: o.n, survived: o.n - died, died, tie: rand() };
|
||||||
|
});
|
||||||
|
let pick;
|
||||||
|
if (mode === "thompson") {
|
||||||
|
for (const r of rows) { const a = gamma(r.survived + 1, rand), b = gamma(r.died + 1, rand); r.draw = a / (a + b); }
|
||||||
|
pick = rows.reduce((x, y) => (y.draw > x.draw ? y : x));
|
||||||
|
} else {
|
||||||
|
pick = rows.reduce((x, y) => (y.n < x.n || (y.n === x.n && y.tie < x.tie) ? y : x));
|
||||||
|
}
|
||||||
|
return { index: pick.index, text: pick.text, n: pick.n, mode,
|
||||||
|
reason: mode === "thompson" ? `survived ${pick.survived} of ${pick.n} so far` : `played ${pick.n} times, the fewest on this screen` };
|
||||||
|
}
|
||||||
|
|
||||||
return Object.assign(api, {
|
return Object.assign(api, {
|
||||||
advisor, recommendOption, solverHistory, norm,
|
advisor, recommendOption, solverHistory, norm, assign, armFor, givenFor, screenPick,
|
||||||
makeParams: (T, { alphas, game } = {}) => makeParams(T, { alphas, game: game || api.game }),
|
makeParams: (T, { alphas, game } = {}) => makeParams(T, { alphas, game: game || api.game }),
|
||||||
/** remember the game of a policy sample (sets ENCOUNTERS) without solving anything */
|
/** 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; },
|
useGame(sample) { api.game = sample.model.game; api.ENCOUNTERS = api.game.by_colour; return api.game; },
|
||||||
|
|||||||
@@ -104,11 +104,18 @@ answers:
|
|||||||
"Trying to bond the Red dragon under the tree": "Red (tree)"
|
"Trying to bond the Red dragon under the tree": "Red (tree)"
|
||||||
"Daily Run Assignment data": "Daily run data"
|
"Daily Run Assignment data": "Daily run data"
|
||||||
"Just here for fun, and maybe a dragon": "Any (for fun)"
|
"Just here for fun, and maybe a dragon": "Any (for fun)"
|
||||||
|
# Squad: matched ignoring case and spaces (riders type it); an answer not listed still stops the build
|
||||||
|
squad_any_case:
|
||||||
|
"first": "First"
|
||||||
|
"second": "Second"
|
||||||
|
"third": "Third"
|
||||||
|
"don't know": "Don't know"
|
||||||
sighting_action:
|
sighting_action:
|
||||||
"Hold Ground / Stay Still": "Hold still"
|
"Hold Ground / Stay Still": "Hold still"
|
||||||
"Respect / Face it": "Respect / face it"
|
"Respect / Face it": "Respect / face it"
|
||||||
"Retreat / Run / Back Away": "Retreat / run"
|
"Retreat / Run / Back Away": "Retreat / run"
|
||||||
"Hide / Duck": "Hide"
|
"Hide / Duck": "Hide"
|
||||||
|
"Protect / Help Squadmate": "Protect squadmate"
|
||||||
"Draw / Drop Weapon": "Weapon"
|
"Draw / Drop Weapon": "Weapon"
|
||||||
"Meet Gaze": "Meet its gaze"
|
"Meet Gaze": "Meet its gaze"
|
||||||
"Protect / Help Sqaudmate": "Protect squadmate"
|
"Protect / Help Sqaudmate": "Protect squadmate"
|
||||||
@@ -146,5 +153,10 @@ sighting_pool:
|
|||||||
1 Squadmate: { East: [Green, Orange, Red], West: [Red, Brown, Green], Center: [Red, Brown] }
|
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] }
|
2 Squadmates: { East: [Red, Orange], West: [Green, Brown, Red], Center: [Red, Brown] }
|
||||||
|
|
||||||
|
# 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
|
# How a bulk-pasted row's attempt answer is read
|
||||||
attempt_words: { first: 1, second: 2, third: 3, fourth: 4, fifth: 5 }
|
attempt_words: { first: 1, second: 2, third: 3, fourth: 4, fifth: 5 }
|
||||||
|
|||||||
+42
-6
@@ -9,6 +9,16 @@ version: 1
|
|||||||
# Colours in the order the route model reports them
|
# Colours in the order the route model reports them
|
||||||
colours: [Red, Orange, Brown, Green, Blue, Black]
|
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
|
# ---------------------------------------------------------------- decisions: the rider's choices
|
||||||
# options: every option the game offers, in a fixed order (ties go to the first). Options seen fewer than
|
# 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.
|
# min_support times in the data are not recommended, except where `always_offered` says so.
|
||||||
@@ -48,22 +58,46 @@ min_support: 20
|
|||||||
# ---------------------------------------------------------------- chance events: the game's rolls
|
# ---------------------------------------------------------------- chance events: the game's rolls
|
||||||
# outcomes: in a fixed order. context: the earlier steps the odds may depend on, most important first; the
|
# 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,
|
# estimate for a full context is shrunk toward the estimate for a shorter one (hierarchical Dirichlet back-off,
|
||||||
# strength learned from the data).
|
# 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:
|
chance:
|
||||||
fs: { label: First dragon, outcomes: [Red, Brown, Green, Orange], context: [direction, company, left] }
|
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
|
# 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 }
|
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 }
|
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 }
|
dieHour: { label: Survive the hour, outcomes: [die, live], context: [cadet, post], risk_label: Killed before the hour }
|
||||||
shadow: { label: Shadow at the tree, outcomes: ["yes", "no"], context: [cadet, post, fs, direction, company] }
|
shadow:
|
||||||
shadowColour: { label: Shadow dragon, outcomes: [Black, Blue], context: [] }
|
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] }
|
meadow: { label: Meadow dragon, outcomes: [Orange, Brown, Blue], context: [cadet, post, fs, direction, company] }
|
||||||
|
|
||||||
# Bonding encounters: where each colour can be bonded. tree-Greens can also end in an Orange or Brown rescue.
|
# 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:
|
encounters:
|
||||||
valley-Red: { label: The valley Red, colour: Red }
|
valley-Red: { label: The valley Red, colour: Red }
|
||||||
tree-Red: { label: The Red below the tree, colour: Red }
|
tree-Red: { label: The Red below the tree, colour: Red }
|
||||||
tree-Greens: { label: The two Greens, colour: Green }
|
tree-Greens: { label: The two Greens, colour: Green, also: [Orange, Brown] }
|
||||||
meadow-Orange: { label: The meadow Orange, colour: Orange }
|
meadow-Orange: { label: The meadow Orange, colour: Orange }
|
||||||
meadow-Brown: { label: The meadow Brown, colour: Brown }
|
meadow-Brown: { label: The meadow Brown, colour: Brown }
|
||||||
meadow-Blue: { label: The meadow Blue, colour: Blue }
|
meadow-Blue: { label: The meadow Blue, colour: Blue }
|
||||||
@@ -199,7 +233,9 @@ from_form:
|
|||||||
# recommendOption() in core/solver.js uses these to point the bot at the recommended option on its screen.
|
# recommendOption() in core/solver.js uses these to point the bot at the recommended option on its screen.
|
||||||
bot_text:
|
bot_text:
|
||||||
company: { Alone: "^enter the valley alone", "1 Squadmate": "^enter the valley with one", "2 Squadmates": "^enter the valley with two" }
|
company: { Alone: "^enter the valley alone", "1 Squadmate": "^enter the valley with one", "2 Squadmates": "^enter the valley with two" }
|
||||||
direction: { East: "^head east", West: "^head west", Center: "^head toward the center of the forest" }
|
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" }
|
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" }
|
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" }
|
clearing: { Help your squadmate: "^help your squadmate", Walk away: "^play it safe and leave them" }
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ Every source is declared in `collection/pipeline.yaml` and collected by `python
|
|||||||
|---|---|
|
|---|---|
|
||||||
| Community "Threshing Routes" form and spreadsheet, u/ClumsyBadger (`reddit spreadsheet`) | `public/form_responses.json` (emails redacted) |
|
| 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` |
|
| Result pages posted in the r/fourthwing megathreads (`reddit thread`) | `collection/manual/reddit_results.yaml` |
|
||||||
|
| Runs described in the r/fourthwing megathread comments (`reddit comment`) | `public/reddit_comments.json` (comment id, day and answers; no usernames or comment text) |
|
||||||
| The Atlas's "Report a run" form (`reported`) | `public/reports.json` (answers only, no usernames) |
|
| 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`) |
|
| 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 |
|
| Community route PDF, u/ClumsyBadger (`reddit pdf`) | not redistributed: `derived/pdf_fingerprint.json` only; it maps the choices and holds no runs |
|
||||||
|
|||||||
@@ -1,4 +1,20 @@
|
|||||||
{
|
{
|
||||||
|
"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": {
|
"07e24681e3b3": {
|
||||||
"stage": "TREE_SHADOW_CHECK",
|
"stage": "TREE_SHADOW_CHECK",
|
||||||
"tint": "green",
|
"tint": "green",
|
||||||
@@ -19,6 +35,22 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"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": {
|
"0a561d53ad19": {
|
||||||
"stage": "THORN_WALK",
|
"stage": "THORN_WALK",
|
||||||
"tint": null,
|
"tint": null,
|
||||||
@@ -75,6 +107,218 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"2650580d6868": {
|
||||||
|
"stage": "TARGET_BONDING",
|
||||||
|
"tint": "red",
|
||||||
|
"backdrop": "clearing",
|
||||||
|
"label": "TARGET_BONDING · red",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"id": "497d06baa6",
|
||||||
|
"text": "Reach a hand slowly to touch its talon"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "88c219021d",
|
||||||
|
"text": "Break into a run toward its foreleg to mount"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"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": {
|
"84780dab01e3": {
|
||||||
"stage": "FIRST_SIGHTING",
|
"stage": "FIRST_SIGHTING",
|
||||||
"tint": "red",
|
"tint": "red",
|
||||||
@@ -87,6 +331,62 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"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": {
|
"96b68612eaf4": {
|
||||||
"stage": "FORK_IN_FOREST",
|
"stage": "FORK_IN_FOREST",
|
||||||
"tint": null,
|
"tint": null,
|
||||||
@@ -103,6 +403,22 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"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": {
|
"a2368b0dc212": {
|
||||||
"stage": "SCREAM_AND_CADETS",
|
"stage": "SCREAM_AND_CADETS",
|
||||||
"tint": null,
|
"tint": null,
|
||||||
@@ -143,6 +459,26 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"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": {
|
"abe3011378ac": {
|
||||||
"stage": "ENTER_THRESHING",
|
"stage": "ENTER_THRESHING",
|
||||||
"tint": "brown",
|
"tint": "brown",
|
||||||
@@ -163,6 +499,22 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"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": {
|
"b209bacacec3": {
|
||||||
"stage": "SCREAM_AND_CADETS",
|
"stage": "SCREAM_AND_CADETS",
|
||||||
"tint": null,
|
"tint": null,
|
||||||
@@ -183,6 +535,90 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"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": {
|
"bc4ee4754b9c": {
|
||||||
"stage": "ENTER_THRESHING",
|
"stage": "ENTER_THRESHING",
|
||||||
"tint": "red",
|
"tint": "red",
|
||||||
@@ -259,6 +695,58 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"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": {
|
"f4b4944d3f3b": {
|
||||||
"stage": "SCREAM_AND_CADETS",
|
"stage": "SCREAM_AND_CADETS",
|
||||||
"tint": null,
|
"tint": null,
|
||||||
@@ -295,6 +783,46 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"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": {
|
"fbe0f0bea700": {
|
||||||
"stage": "SCREAM_AND_CADETS",
|
"stage": "SCREAM_AND_CADETS",
|
||||||
"tint": null,
|
"tint": null,
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,6 +0,0 @@
|
|||||||
{"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}}
|
|
||||||
+56
-32
@@ -46,13 +46,12 @@
|
|||||||
"conformsTo": "http://mlcommons.org/croissant/1.0",
|
"conformsTo": "http://mlcommons.org/croissant/1.0",
|
||||||
"name": "Threshing Atlas",
|
"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.",
|
"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://ekcschiano.github.io/threshing-atlas/",
|
"url": "https://git.kenschiano.net/DragonKind/threshing-atlas",
|
||||||
"sameAs": "https://github.com/ekcSchiano/threshing-atlas",
|
"sameAs": "https://git.kenschiano.net/DragonKind/threshing-atlas",
|
||||||
"license": "https://creativecommons.org/licenses/by/4.0/",
|
"license": "https://creativecommons.org/licenses/by/4.0/",
|
||||||
"creator": {
|
"creator": {
|
||||||
"@type": "sc:Person",
|
"@type": "sc:Person",
|
||||||
"name": "ekcSchiano",
|
"name": "ekcSchiano"
|
||||||
"url": "https://github.com/ekcSchiano"
|
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Dragonkind",
|
"Dragonkind",
|
||||||
@@ -62,7 +61,7 @@
|
|||||||
"route planning",
|
"route planning",
|
||||||
"community data"
|
"community data"
|
||||||
],
|
],
|
||||||
"citeAs": "ekcSchiano and contributors (2026). Threshing Atlas. https://github.com/ekcSchiano/threshing-atlas",
|
"citeAs": "ekcSchiano and contributors (2026). Threshing Atlas. https://git.kenschiano.net/DragonKind/threshing-atlas",
|
||||||
"isLiveDataset": true,
|
"isLiveDataset": true,
|
||||||
"isBasedOn": [
|
"isBasedOn": [
|
||||||
{
|
{
|
||||||
@@ -82,8 +81,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"@type": "sc:CreativeWork",
|
"@type": "sc:CreativeWork",
|
||||||
"name": "Runs reported on the Atlas (\"Report a run\", a GitHub issue form)",
|
"name": "Runs riders describe in the r/fourthwing Dragonkind megathread comments",
|
||||||
"url": "https://github.com/ekcSchiano/threshing-atlas/issues/new?template=report-a-run.yml"
|
"url": "https://www.reddit.com/r/fourthwing/comments/1wvwfp9/"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"distribution": [
|
"distribution": [
|
||||||
@@ -92,70 +91,80 @@
|
|||||||
"@id": "runs_clean",
|
"@id": "runs_clean",
|
||||||
"name": "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.",
|
"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://ekcschiano.github.io/threshing-atlas/data/runs_clean.csv",
|
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/runs_clean.csv",
|
||||||
"encodingFormat": "text/csv",
|
"encodingFormat": "text/csv",
|
||||||
"sha256": "766d8708dad77327534063df42cd4ff806ab707497618ab5263cf3dce98a30c7",
|
"sha256": "ce944619f3a8ca03e67e05438a630d632d6dbe10c13e557e9fcc2fa897cdc932",
|
||||||
"contentSize": "2146368 B"
|
"contentSize": "3685124 B"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"@type": "cr:FileObject",
|
"@type": "cr:FileObject",
|
||||||
"@id": "form_responses",
|
"@id": "form_responses",
|
||||||
"name": "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.",
|
"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://github.com/ekcSchiano/threshing-atlas/blob/main/data/public/form_responses.json",
|
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/form_responses.json",
|
||||||
"encodingFormat": "application/json",
|
"encodingFormat": "application/json",
|
||||||
"sha256": "4c5791f78ce81f5e88f1fb99d933acd06d8223ff9a573e96b6fcb3a6fd9c8d22",
|
"sha256": "3a3322da84274416880d87a400b06e44e0ed97feaf93df839b5269bdaa1badad",
|
||||||
"contentSize": "8293395 B"
|
"contentSize": "12640700 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": "c180f8b82ed1119d4ff28697fcf45d0c7f22859597cd10f5e82a2e50ca1dc51a",
|
||||||
|
"contentSize": "105 B"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"@type": "cr:FileObject",
|
"@type": "cr:FileObject",
|
||||||
"@id": "reports",
|
"@id": "reports",
|
||||||
"name": "reports",
|
"name": "reports",
|
||||||
"description": "Runs reported through the Atlas's \"Report a run\" form (GitHub issues), answers only, no usernames.",
|
"description": "Runs reported through the Atlas's \"Report a run\" form (issues on its repository), answers only, no usernames.",
|
||||||
"contentUrl": "https://github.com/ekcSchiano/threshing-atlas/blob/main/data/public/reports.json",
|
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/reports.json",
|
||||||
"encodingFormat": "application/json",
|
"encodingFormat": "application/json",
|
||||||
"sha256": "d42eb04b9923eb1d2a8e5c356452f52daab78293be5a29a448cfb69c974eab30",
|
"sha256": "51510ed7a0b4016501fe4e0324a352842e831a48773a08b084dec6ff7dde2d14",
|
||||||
"contentSize": "92 B"
|
"contentSize": "112 B"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"@type": "cr:FileObject",
|
"@type": "cr:FileObject",
|
||||||
"@id": "register",
|
"@id": "register",
|
||||||
"name": "register",
|
"name": "register",
|
||||||
"description": "The Unofficial Dragon Register (which dragon each rider bonded), without rider names.",
|
"description": "The Unofficial Dragon Register (which dragon each rider bonded), without rider names.",
|
||||||
"contentUrl": "https://ekcschiano.github.io/threshing-atlas/data/register.json",
|
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/register.json",
|
||||||
"encodingFormat": "application/json",
|
"encodingFormat": "application/json",
|
||||||
"sha256": "f889c7e18068a934eb6872efda9b43599f4870d2e42bfdb3d447405976d59df8",
|
"sha256": "40b725a39dff447025de5dda0eb6850e0929764ab53549863f2efc5d9414731b",
|
||||||
"contentSize": "111095 B"
|
"contentSize": "118558 B"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"@type": "cr:FileObject",
|
"@type": "cr:FileObject",
|
||||||
"@id": "stats",
|
"@id": "stats",
|
||||||
"name": "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).",
|
"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://ekcschiano.github.io/threshing-atlas/data/stats.json",
|
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/stats.json",
|
||||||
"encodingFormat": "application/json",
|
"encodingFormat": "application/json",
|
||||||
"sha256": "dc79c0762e5c27423f9fa2086f06aa7019b0aec6ae41d6a6dcbe59a1016cffab",
|
"sha256": "d2a551e785c8593b442d95338a99ea0710ed7df2cd6c6f3ef341bddff1f3689e",
|
||||||
"contentSize": "4269546 B"
|
"contentSize": "5475502 B"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"@type": "cr:FileObject",
|
"@type": "cr:FileObject",
|
||||||
"@id": "policy",
|
"@id": "policy",
|
||||||
"name": "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).",
|
"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://ekcschiano.github.io/threshing-atlas/data/policy.json",
|
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/policy.json",
|
||||||
"encodingFormat": "application/json",
|
"encodingFormat": "application/json",
|
||||||
"sha256": "26c3adad2236493b4a77b7d46454fe01c84e8f750f0f03b6e7dbe968af32ea4e",
|
"sha256": "ef607b9a7fbc7f7d0e647f988fbac94a1685109a78218ce8c6f0ada3e62e2ee4",
|
||||||
"contentSize": "617892 B"
|
"contentSize": "986552 B"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"@type": "cr:FileObject",
|
"@type": "cr:FileObject",
|
||||||
"@id": "graph",
|
"@id": "graph",
|
||||||
"name": "graph",
|
"name": "graph",
|
||||||
"description": "The route graph over every run in runs_clean.csv, counted per source (analysis/network/build-graph.js).",
|
"description": "The route graph over every run in runs_clean.csv, counted per source (analysis/network/build-graph.js).",
|
||||||
"contentUrl": "https://ekcschiano.github.io/threshing-atlas/data/graph.json",
|
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/graph.json",
|
||||||
"encodingFormat": "application/json",
|
"encodingFormat": "application/json",
|
||||||
"sha256": "72ef6fa6d6edc3a53026eff3f9cf39a883f7a709eacaaf21351c9ca1251a986a",
|
"sha256": "112895b711ade4e0aad8e4b7a61dea5db00f4734e484bc20198740e924c14974",
|
||||||
"contentSize": "48783 B"
|
"contentSize": "75580 B"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"recordSet": [
|
"recordSet": [
|
||||||
@@ -172,7 +181,7 @@
|
|||||||
"@type": "cr:Field",
|
"@type": "cr:Field",
|
||||||
"@id": "runs/run_id",
|
"@id": "runs/run_id",
|
||||||
"name": "run_id",
|
"name": "run_id",
|
||||||
"description": "Unique id of the run: sheet-<row of the form export>, thread-<result id>, reported-<issue number> or bot-<hash>.",
|
"description": "Unique id of the run: sheet-<row of the form export>, thread-<result id>, comment-<Reddit comment id>, reported-<issue number> or bot-<hash>.",
|
||||||
"dataType": "sc:Text",
|
"dataType": "sc:Text",
|
||||||
"source": {
|
"source": {
|
||||||
"fileObject": {
|
"fileObject": {
|
||||||
@@ -187,7 +196,7 @@
|
|||||||
"@type": "cr:Field",
|
"@type": "cr:Field",
|
||||||
"@id": "runs/source",
|
"@id": "runs/source",
|
||||||
"name": "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). \"reported\": the Atlas's own \"Report a run\" form. \"bot\": an attempt logged by the DragonKind bot. \"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; 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). \"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.",
|
||||||
"dataType": "sc:Text",
|
"dataType": "sc:Text",
|
||||||
"source": {
|
"source": {
|
||||||
"fileObject": {
|
"fileObject": {
|
||||||
@@ -202,7 +211,7 @@
|
|||||||
"@type": "cr:Field",
|
"@type": "cr:Field",
|
||||||
"@id": "runs/entry",
|
"@id": "runs/entry",
|
||||||
"name": "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.",
|
"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.",
|
||||||
"dataType": "sc:Text",
|
"dataType": "sc:Text",
|
||||||
"source": {
|
"source": {
|
||||||
"fileObject": {
|
"fileObject": {
|
||||||
@@ -213,6 +222,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/bot_mode",
|
||||||
|
"name": "bot_mode",
|
||||||
|
"description": "For bot runs, how the bot chose: \"auto_learn\" (its own rules and the route PDF), \"atlas_policy\" (the Atlas's route model), \"atlas_thompson\" (the route model, sampling routes in proportion to how likely each is best), \"explore\" (trying untested options), \"experiment\" (a randomised test), \"manual\" (a person clicked). Matters for analysis: the bot follows a strategy, so its choices are not like a player's. Empty for other sources. Values: auto_learn; atlas_policy; atlas_thompson; explore; experiment; manual.",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "bot_mode"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"@type": "cr:Field",
|
"@type": "cr:Field",
|
||||||
"@id": "runs/date",
|
"@id": "runs/date",
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"sha256": "1c1b2b4e27c673cae4070a6abf57dbfbe98ab0f4b43b3d7232741a23612c490c",
|
"sha256": "99953503376b54ee2ca2061bc277c712681a66add4d62737535e4afca11ba03e",
|
||||||
"bytes": 633332,
|
"bytes": 638678,
|
||||||
"pages": 1,
|
"pages": 1,
|
||||||
"page_hashes": [
|
"page_hashes": [
|
||||||
"d3b0a8d99799997a"
|
"513739c2cb809008"
|
||||||
],
|
],
|
||||||
"line_hashes": [
|
"line_hashes": [
|
||||||
"0005ef79b6b0",
|
"0005ef79b6b0",
|
||||||
@@ -27,7 +27,6 @@
|
|||||||
"09ede21a5670",
|
"09ede21a5670",
|
||||||
"0a6389a6b822",
|
"0a6389a6b822",
|
||||||
"0c3e015009e5",
|
"0c3e015009e5",
|
||||||
"0c5d7989af41",
|
|
||||||
"0c6edb02c260",
|
"0c6edb02c260",
|
||||||
"0caca604d8ec",
|
"0caca604d8ec",
|
||||||
"0d00728c456e",
|
"0d00728c456e",
|
||||||
@@ -38,6 +37,7 @@
|
|||||||
"0e5021c854fd",
|
"0e5021c854fd",
|
||||||
"0fa4700b553a",
|
"0fa4700b553a",
|
||||||
"0fb542ca6733",
|
"0fb542ca6733",
|
||||||
|
"1060c135e592",
|
||||||
"106a5842fc5f",
|
"106a5842fc5f",
|
||||||
"115b5cad43c0",
|
"115b5cad43c0",
|
||||||
"119a95345c45",
|
"119a95345c45",
|
||||||
@@ -46,6 +46,7 @@
|
|||||||
"14558e7e73c8",
|
"14558e7e73c8",
|
||||||
"14e2d4c37b5b",
|
"14e2d4c37b5b",
|
||||||
"1584dc810a09",
|
"1584dc810a09",
|
||||||
|
"16367aacb67a",
|
||||||
"16477688c0e0",
|
"16477688c0e0",
|
||||||
"16486a0e2e7e",
|
"16486a0e2e7e",
|
||||||
"16552853f950",
|
"16552853f950",
|
||||||
@@ -58,10 +59,9 @@
|
|||||||
"1a1d05853cee",
|
"1a1d05853cee",
|
||||||
"1aefe47e20eb",
|
"1aefe47e20eb",
|
||||||
"1b4c9133da73",
|
"1b4c9133da73",
|
||||||
"1de5fa381999",
|
|
||||||
"1fa9e3998e8b",
|
"1fa9e3998e8b",
|
||||||
|
"1fbdd6f48a30",
|
||||||
"20539cda4fc1",
|
"20539cda4fc1",
|
||||||
"208a6d1ce0de",
|
|
||||||
"21499b8293b5",
|
"21499b8293b5",
|
||||||
"21e4274038e8",
|
"21e4274038e8",
|
||||||
"2287d8613d2a",
|
"2287d8613d2a",
|
||||||
@@ -132,6 +132,7 @@
|
|||||||
"41f20dee5da8",
|
"41f20dee5da8",
|
||||||
"429e5436f520",
|
"429e5436f520",
|
||||||
"42a21ed159ef",
|
"42a21ed159ef",
|
||||||
|
"42ff6957f0a3",
|
||||||
"447048356f8c",
|
"447048356f8c",
|
||||||
"453962996160",
|
"453962996160",
|
||||||
"45847b618b88",
|
"45847b618b88",
|
||||||
@@ -212,6 +213,7 @@
|
|||||||
"743b4e8706ef",
|
"743b4e8706ef",
|
||||||
"7488af2a0881",
|
"7488af2a0881",
|
||||||
"75ad72417087",
|
"75ad72417087",
|
||||||
|
"75fdd9027b0a",
|
||||||
"7692c3ad3540",
|
"7692c3ad3540",
|
||||||
"76a796208b71",
|
"76a796208b71",
|
||||||
"771b94c11b83",
|
"771b94c11b83",
|
||||||
@@ -239,6 +241,7 @@
|
|||||||
"860ce7852dc3",
|
"860ce7852dc3",
|
||||||
"87094fc18528",
|
"87094fc18528",
|
||||||
"877de8ebb965",
|
"877de8ebb965",
|
||||||
|
"87ad118c11e5",
|
||||||
"87c3e080dcb4",
|
"87c3e080dcb4",
|
||||||
"8838a3634b92",
|
"8838a3634b92",
|
||||||
"883caeb7ca11",
|
"883caeb7ca11",
|
||||||
@@ -258,8 +261,8 @@
|
|||||||
"919bc9b8d743",
|
"919bc9b8d743",
|
||||||
"920a5924f124",
|
"920a5924f124",
|
||||||
"935f14ac67b6",
|
"935f14ac67b6",
|
||||||
"94844cb129a8",
|
|
||||||
"94ab1f4a7216",
|
"94ab1f4a7216",
|
||||||
|
"954f0ca1b653",
|
||||||
"95a14ed2a7fc",
|
"95a14ed2a7fc",
|
||||||
"95d77302ee47",
|
"95d77302ee47",
|
||||||
"961836168b5b",
|
"961836168b5b",
|
||||||
@@ -285,16 +288,17 @@
|
|||||||
"a060335c66cf",
|
"a060335c66cf",
|
||||||
"a093d3f5ecff",
|
"a093d3f5ecff",
|
||||||
"a0f941fee4c0",
|
"a0f941fee4c0",
|
||||||
|
"a2972765764c",
|
||||||
"a2a92faf51c6",
|
"a2a92faf51c6",
|
||||||
"a35c9fb774e6",
|
"a35c9fb774e6",
|
||||||
"a36373ed77ba",
|
"a36373ed77ba",
|
||||||
"a3d7a6bf2036",
|
"a3d7a6bf2036",
|
||||||
"a3f146576c0e",
|
"a3f146576c0e",
|
||||||
"a5973cf86c17",
|
"a5973cf86c17",
|
||||||
"a69204c67bcd",
|
|
||||||
"a69a4139b340",
|
"a69a4139b340",
|
||||||
"a6e0a42de76e",
|
"a6e0a42de76e",
|
||||||
"a6e8ab03915b",
|
"a6e8ab03915b",
|
||||||
|
"a7937b64b8ca",
|
||||||
"a7cdf72224c0",
|
"a7cdf72224c0",
|
||||||
"a7dbeb539e04",
|
"a7dbeb539e04",
|
||||||
"a854942a3868",
|
"a854942a3868",
|
||||||
@@ -337,16 +341,17 @@
|
|||||||
"b4fbbe802d67",
|
"b4fbbe802d67",
|
||||||
"b5afeb8db3aa",
|
"b5afeb8db3aa",
|
||||||
"b627f4168840",
|
"b627f4168840",
|
||||||
|
"b724cc07becf",
|
||||||
"b7bd4220ff85",
|
"b7bd4220ff85",
|
||||||
"b8ab74d65421",
|
"b8ab74d65421",
|
||||||
"b8b0e7effd20",
|
"b8b0e7effd20",
|
||||||
"b95206531cb4",
|
"b95206531cb4",
|
||||||
"ba4788b226aa",
|
"ba4788b226aa",
|
||||||
"bac081e175b0",
|
"bac081e175b0",
|
||||||
|
"bb0e505c6386",
|
||||||
"bb36f57782ca",
|
"bb36f57782ca",
|
||||||
"bb6db2fb1f33",
|
"bb6db2fb1f33",
|
||||||
"bb8b9de8437d",
|
"bc807bf2a135",
|
||||||
"bd2f2e2ce114",
|
|
||||||
"be5ba8fe14a3",
|
"be5ba8fe14a3",
|
||||||
"bec9019352b4",
|
"bec9019352b4",
|
||||||
"bf1563e43ef8",
|
"bf1563e43ef8",
|
||||||
@@ -373,6 +378,7 @@
|
|||||||
"c98e94e2a5f1",
|
"c98e94e2a5f1",
|
||||||
"caa6a9ced701",
|
"caa6a9ced701",
|
||||||
"cb28392914d1",
|
"cb28392914d1",
|
||||||
|
"cc2e668bb959",
|
||||||
"cca94b79f1f1",
|
"cca94b79f1f1",
|
||||||
"cd1bb3012bcf",
|
"cd1bb3012bcf",
|
||||||
"ce8371563887",
|
"ce8371563887",
|
||||||
@@ -393,7 +399,6 @@
|
|||||||
"d413d29b87df",
|
"d413d29b87df",
|
||||||
"d4536f255583",
|
"d4536f255583",
|
||||||
"d5a0d90574d5",
|
"d5a0d90574d5",
|
||||||
"d611fd25b98f",
|
|
||||||
"d61483fb5f57",
|
"d61483fb5f57",
|
||||||
"d76d5e7a3df7",
|
"d76d5e7a3df7",
|
||||||
"d88c2c2a6831",
|
"d88c2c2a6831",
|
||||||
@@ -403,6 +408,7 @@
|
|||||||
"d978e0e48792",
|
"d978e0e48792",
|
||||||
"d9a847a1a79a",
|
"d9a847a1a79a",
|
||||||
"d9ae6af36f3c",
|
"d9ae6af36f3c",
|
||||||
|
"dab3df07f542",
|
||||||
"dab61aea1eb7",
|
"dab61aea1eb7",
|
||||||
"db875b25b06f",
|
"db875b25b06f",
|
||||||
"dbb3b50e59c7",
|
"dbb3b50e59c7",
|
||||||
@@ -433,6 +439,7 @@
|
|||||||
"e5a05ee2bbba",
|
"e5a05ee2bbba",
|
||||||
"e644b77bfa11",
|
"e644b77bfa11",
|
||||||
"e6c66d78c859",
|
"e6c66d78c859",
|
||||||
|
"e6e6263ada92",
|
||||||
"e76566a6d54c",
|
"e76566a6d54c",
|
||||||
"e774d221fc45",
|
"e774d221fc45",
|
||||||
"e7c0d9c5bc32",
|
"e7c0d9c5bc32",
|
||||||
@@ -463,7 +470,6 @@
|
|||||||
"f4909e20a51e",
|
"f4909e20a51e",
|
||||||
"f51563619474",
|
"f51563619474",
|
||||||
"f6a4807a956f",
|
"f6a4807a956f",
|
||||||
"f6e897aa0150",
|
|
||||||
"f70b7769ae02",
|
"f70b7769ae02",
|
||||||
"f763b9be2dc9",
|
"f763b9be2dc9",
|
||||||
"f8c25133ee80",
|
"f8c25133ee80",
|
||||||
@@ -474,10 +480,11 @@
|
|||||||
"fbd161e2c059",
|
"fbd161e2c059",
|
||||||
"fca413c36342",
|
"fca413c36342",
|
||||||
"fd5cd809e2aa",
|
"fd5cd809e2aa",
|
||||||
|
"fdbbfc2be926",
|
||||||
"fe4c73974e0e",
|
"fe4c73974e0e",
|
||||||
"ff06886f82e3",
|
"ff06886f82e3",
|
||||||
"ff1f017072cc",
|
"ff1f017072cc",
|
||||||
"ffe503ead4e4"
|
"ffe503ead4e4"
|
||||||
],
|
],
|
||||||
"checked": "2026-11-03"
|
"checked": "2026-11-16"
|
||||||
}
|
}
|
||||||
+26
-15
@@ -14,19 +14,17 @@ dataset:
|
|||||||
Community-logged runs of the Dragonkind "threshing" (the dragon-bonding game based on Fourth Wing), coded into
|
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
|
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.
|
them, the statistics shown on the Threshing Atlas page, and the route graph shared with a DragonKind bot.
|
||||||
url: https://ekcschiano.github.io/threshing-atlas/
|
# the repository, the page and every file's link come from forge.yaml
|
||||||
repository: https://github.com/ekcSchiano/threshing-atlas
|
|
||||||
license: https://creativecommons.org/licenses/by/4.0/
|
license: https://creativecommons.org/licenses/by/4.0/
|
||||||
code_license: MIT
|
code_license: MIT
|
||||||
creator: ekcSchiano
|
creator: ekcSchiano
|
||||||
keywords: [Dragonkind, Fourth Wing, threshing, decision tree, route planning, community data]
|
keywords: [Dragonkind, Fourth Wing, threshing, decision tree, route planning, community data]
|
||||||
citation: "ekcSchiano and contributors (2026). Threshing Atlas. https://github.com/ekcSchiano/threshing-atlas"
|
citation: "ekcSchiano and contributors (2026). Threshing Atlas. {repository}"
|
||||||
# Third-party sources keep their own terms (DATA_LICENSE.md); the route PDF is never redistributed.
|
# Third-party sources keep their own terms (DATA_LICENSE.md); the route PDF is never redistributed.
|
||||||
|
|
||||||
files:
|
files:
|
||||||
runs_clean:
|
runs_clean:
|
||||||
path: data/public/runs_clean.csv
|
path: data/public/runs_clean.csv
|
||||||
url: https://ekcschiano.github.io/threshing-atlas/data/runs_clean.csv
|
|
||||||
format: text/csv
|
format: text/csv
|
||||||
description: >-
|
description: >-
|
||||||
Every run from every source, one per row, coded into the same columns (collection/etl/runs.py; the form's
|
Every run from every source, one per row, coded into the same columns (collection/etl/runs.py; the form's
|
||||||
@@ -37,56 +35,69 @@ files:
|
|||||||
description: >-
|
description: >-
|
||||||
The community "Threshing Routes" form export as published (headers and rows), with email addresses in
|
The community "Threshing Routes" form export as published (headers and rows), with email addresses in
|
||||||
free-text answers redacted. The source of runs_clean.
|
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.
|
||||||
reports:
|
reports:
|
||||||
path: data/public/reports.json
|
path: data/public/reports.json
|
||||||
format: application/json
|
format: application/json
|
||||||
description: Runs reported through the Atlas's "Report a run" form (GitHub issues), answers only, no usernames.
|
description: Runs reported through the Atlas's "Report a run" form (issues on its repository), answers only, no usernames.
|
||||||
register:
|
register:
|
||||||
path: data/public/register.json
|
path: data/public/register.json
|
||||||
url: https://ekcschiano.github.io/threshing-atlas/data/register.json
|
|
||||||
format: application/json
|
format: application/json
|
||||||
description: The Unofficial Dragon Register (which dragon each rider bonded), without rider names.
|
description: The Unofficial Dragon Register (which dragon each rider bonded), without rider names.
|
||||||
stats:
|
stats:
|
||||||
path: data/public/stats.json
|
path: data/public/stats.json
|
||||||
url: https://ekcschiano.github.io/threshing-atlas/data/stats.json
|
|
||||||
format: application/json
|
format: application/json
|
||||||
description: >-
|
description: >-
|
||||||
Every number the Atlas page shows, for six filter presets (analysis/stats/site_stats.py; what is measured is
|
Every number the Atlas page shows, for six filter presets (analysis/stats/site_stats.py; what is measured is
|
||||||
analysis/stats/measures.yaml).
|
analysis/stats/measures.yaml).
|
||||||
policy:
|
policy:
|
||||||
path: data/public/policy.json
|
path: data/public/policy.json
|
||||||
url: https://ekcschiano.github.io/threshing-atlas/data/policy.json
|
|
||||||
format: application/json
|
format: application/json
|
||||||
description: >-
|
description: >-
|
||||||
The route model: the game (core/spec/game.yaml), the count tables behind every roll, and the best decision
|
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).
|
tree for every dragon colour under two goals, with posterior intervals (planner/build_policy.py).
|
||||||
graph:
|
graph:
|
||||||
path: data/public/graph.json
|
path: data/public/graph.json
|
||||||
url: https://ekcschiano.github.io/threshing-atlas/data/graph.json
|
|
||||||
format: application/json
|
format: application/json
|
||||||
description: The route graph over every run in runs_clean.csv, counted per source (analysis/network/build-graph.js).
|
description: The route graph over every run in runs_clean.csv, counted per source (analysis/network/build-graph.js).
|
||||||
|
|
||||||
# The columns of runs_clean. type: text, integer, boolean or date. values: every value the column may take
|
# 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").
|
# (empty cells are always allowed and mean "does not apply" or "not recorded").
|
||||||
columns:
|
columns:
|
||||||
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>." }
|
run_id: { type: text, required: true, description: "Unique id of the run: sheet-<row of the form export>, thread-<result id>, comment-<Reddit comment id>, reported-<issue number> or bot-<hash>." }
|
||||||
source:
|
source:
|
||||||
type: text
|
type: text
|
||||||
required: true
|
required: true
|
||||||
description: >-
|
description: >-
|
||||||
Where the run came from. "reddit spreadsheet": the community Threshing Routes form and spreadsheet linked from
|
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,
|
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
|
route not recorded). "reddit comment": a run a rider described in a megathread comment, read automatically into
|
||||||
DragonKind bot. "reddit pdf": the community route PDF (a flowchart of the routes, not a log of runs, so it
|
the "Report a run" answers by the threshing-reddit scraper, which delivers them by pull request (hand
|
||||||
adds no rows today).
|
corrections in collection/manual/reddit_comments.yaml). "reported": the Atlas's own "Report a run" form. "bot": an attempt logged by the
|
||||||
values: [reddit spreadsheet, reddit thread, reported, bot, reddit pdf]
|
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]
|
||||||
entry:
|
entry:
|
||||||
type: text
|
type: text
|
||||||
description: >-
|
description: >-
|
||||||
For spreadsheet runs, the sheet's own row label: "Form" for a form submission (it has a timestamp);
|
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
|
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.
|
them, so they are the least selectively reported rows. Empty for other sources.
|
||||||
values: [Form, Data Import, BulkUpload3, Manual Upload, Historical import, Unknown import]
|
values: [Form, Data Import, BulkUpload3, Manual Upload, Historical import, Unknown import, Unknown]
|
||||||
|
bot_mode:
|
||||||
|
type: text
|
||||||
|
description: >-
|
||||||
|
For bot runs, how the bot chose: "auto_learn" (its own rules and the route PDF), "atlas_policy" (the Atlas's
|
||||||
|
route model), "atlas_thompson" (the route model, sampling routes in proportion to how likely each is best), "explore" (trying untested options), "experiment" (a randomised test), "manual" (a person
|
||||||
|
clicked). Matters for analysis: the bot follows a strategy, so its choices are not like a player's. Empty for
|
||||||
|
other sources.
|
||||||
|
values: [auto_learn, atlas_policy, atlas_thompson, explore, experiment, manual]
|
||||||
date: { type: date, description: "Date of the run or its report (YYYY-MM-DD): the form submission, the issue, or the bot attempt. Empty for bulk-pasted rows and result pages." }
|
date: { type: date, description: "Date of the run or its report (YYYY-MM-DD): the form submission, the issue, or the bot attempt. Empty for bulk-pasted rows and result pages." }
|
||||||
wing: { type: text, description: The rider's wing, from the form., values: [First, Second, Third, Fourth, Multiple, Unknown] }
|
wing: { type: text, description: The rider's wing, from the form., values: [First, Second, Third, Fourth, Multiple, Unknown] }
|
||||||
section: { type: text, description: The rider's section within the wing (free text as answered). }
|
section: { type: text, description: The rider's section within the wing (free text as answered). }
|
||||||
|
|||||||
+21
-6
@@ -1,12 +1,27 @@
|
|||||||
{
|
{
|
||||||
"bot": {
|
"bot": {
|
||||||
"sha256": "e7e6a3245170dba7320eab98d9721e6c1174e16143c4bb2ed827dc84f1eda00f",
|
"sha256": "3d92c7b855d5f928f0c99fa4895840ab1a6cdea543f10eae707af071ba25389c",
|
||||||
"bytes": 149013,
|
"bytes": 11801732,
|
||||||
"changed": "2026-11-10"
|
"changed": "2026-11-19"
|
||||||
|
},
|
||||||
|
"reddit_pdf": {
|
||||||
|
"sha256": "99953503376b54ee2ca2061bc277c712681a66add4d62737535e4afca11ba03e",
|
||||||
|
"bytes": 638678,
|
||||||
|
"changed": "2026-11-16"
|
||||||
|
},
|
||||||
|
"reddit_spreadsheet": {
|
||||||
|
"sha256": "ca06bbb6914483214801b54b58ed08039c21dc858c59347456ea473b1417fbb4",
|
||||||
|
"bytes": 5941127,
|
||||||
|
"changed": "2026-11-19"
|
||||||
|
},
|
||||||
|
"register": {
|
||||||
|
"sha256": "d6e5085f73adbf047163578c150dd034e2387fe37bd91030b36592df46147261",
|
||||||
|
"bytes": 51331,
|
||||||
|
"changed": "2026-11-19"
|
||||||
},
|
},
|
||||||
"reported": {
|
"reported": {
|
||||||
"sha256": "4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945",
|
"sha256": "8c8721b9c698e155c406da97fb69dda1729a9546290773dc0a044b1cd7eae628",
|
||||||
"bytes": 2,
|
"bytes": 27492,
|
||||||
"changed": "2026-11-04"
|
"changed": "2026-11-19"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,147 @@
|
|||||||
|
{
|
||||||
|
"schema": 1,
|
||||||
|
"by_attempt": {
|
||||||
|
"form": {
|
||||||
|
"1": [
|
||||||
|
97,
|
||||||
|
960
|
||||||
|
],
|
||||||
|
"2": [
|
||||||
|
0,
|
||||||
|
296
|
||||||
|
],
|
||||||
|
"3": [
|
||||||
|
0,
|
||||||
|
193
|
||||||
|
],
|
||||||
|
"4-10": [
|
||||||
|
0,
|
||||||
|
538
|
||||||
|
],
|
||||||
|
"11-30": [
|
||||||
|
0,
|
||||||
|
627
|
||||||
|
],
|
||||||
|
"31 or more": [
|
||||||
|
0,
|
||||||
|
694
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"bulk logs": {
|
||||||
|
"1": [
|
||||||
|
0,
|
||||||
|
29
|
||||||
|
],
|
||||||
|
"2": [
|
||||||
|
0,
|
||||||
|
21
|
||||||
|
],
|
||||||
|
"3": [
|
||||||
|
0,
|
||||||
|
14
|
||||||
|
],
|
||||||
|
"4-10": [
|
||||||
|
0,
|
||||||
|
102
|
||||||
|
],
|
||||||
|
"11-30": [
|
||||||
|
0,
|
||||||
|
57
|
||||||
|
],
|
||||||
|
"31 or more": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"bot": {
|
||||||
|
"1": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"2": [
|
||||||
|
0,
|
||||||
|
4
|
||||||
|
],
|
||||||
|
"3": [
|
||||||
|
0,
|
||||||
|
5
|
||||||
|
],
|
||||||
|
"4-10": [
|
||||||
|
0,
|
||||||
|
36
|
||||||
|
],
|
||||||
|
"11-30": [
|
||||||
|
0,
|
||||||
|
137
|
||||||
|
],
|
||||||
|
"31 or more": [
|
||||||
|
0,
|
||||||
|
333
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"same_route": {
|
||||||
|
"routes": 325,
|
||||||
|
"first_shadows": 93,
|
||||||
|
"expected": 39.9,
|
||||||
|
"odds_ratio": Infinity,
|
||||||
|
"z": 12.3
|
||||||
|
},
|
||||||
|
"form_first": [
|
||||||
|
97,
|
||||||
|
960
|
||||||
|
],
|
||||||
|
"form_later": [
|
||||||
|
0,
|
||||||
|
2348
|
||||||
|
],
|
||||||
|
"best_route": {
|
||||||
|
"route": [
|
||||||
|
"Alone",
|
||||||
|
"West",
|
||||||
|
"Assess the situation",
|
||||||
|
"Engage the smaller cadet",
|
||||||
|
"Squadmate's revenge",
|
||||||
|
"West"
|
||||||
|
],
|
||||||
|
"first": [
|
||||||
|
23,
|
||||||
|
114
|
||||||
|
],
|
||||||
|
"later": [
|
||||||
|
0,
|
||||||
|
94
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"shadow_routes": {
|
||||||
|
"runs": 97,
|
||||||
|
"routes": 47,
|
||||||
|
"off_gate": 3
|
||||||
|
},
|
||||||
|
"after_shadow": {
|
||||||
|
"reached_black": 79,
|
||||||
|
"bonded_black": 57,
|
||||||
|
"died_at_blue": 16,
|
||||||
|
"answers": {
|
||||||
|
"held its gaze": [
|
||||||
|
29,
|
||||||
|
41
|
||||||
|
],
|
||||||
|
"lowered eyes": [
|
||||||
|
0,
|
||||||
|
7
|
||||||
|
],
|
||||||
|
"ignored the sound": [
|
||||||
|
0,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bot": {
|
||||||
|
"attempts": 878,
|
||||||
|
"accounts": 27,
|
||||||
|
"gated_tree": 515,
|
||||||
|
"shadows": 0,
|
||||||
|
"earliest_attempt": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,977 @@
|
|||||||
|
{
|
||||||
|
"schema": 2,
|
||||||
|
"seed": 20261116,
|
||||||
|
"lifecycle": {
|
||||||
|
"research_days": 3,
|
||||||
|
"retire": true,
|
||||||
|
"long_lived": {
|
||||||
|
"every": 10,
|
||||||
|
"take": 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"record": [
|
||||||
|
"accountSeq",
|
||||||
|
"accountAttempt",
|
||||||
|
"accountCreatedAt",
|
||||||
|
"wing",
|
||||||
|
"section",
|
||||||
|
"squad",
|
||||||
|
"sawShadowBefore"
|
||||||
|
],
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"screenPicks": [
|
||||||
|
{
|
||||||
|
"where": "after the shadow shows",
|
||||||
|
"use": "script",
|
||||||
|
"script": "shadow"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"where": "bonding the target dragon",
|
||||||
|
"use": "thompson"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"where": "experiment mapping",
|
||||||
|
"use": "least-tried"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"experiments": [
|
||||||
|
{
|
||||||
|
"id": "fresh-replicate",
|
||||||
|
"status": "running",
|
||||||
|
"question": "On a fresh account, does one exact path always show the shadow, sometimes, or never?",
|
||||||
|
"attempts": {
|
||||||
|
"from": 1,
|
||||||
|
"to": 1
|
||||||
|
},
|
||||||
|
"unit": "account",
|
||||||
|
"share": 1,
|
||||||
|
"exclusive": true,
|
||||||
|
"target": "Black",
|
||||||
|
"objective": "eventually",
|
||||||
|
"sampling": "best",
|
||||||
|
"seed": 20261116,
|
||||||
|
"measures": {
|
||||||
|
"roll": "shadow",
|
||||||
|
"rare": "yes"
|
||||||
|
},
|
||||||
|
"burn": {
|
||||||
|
"reason": "TREE_NO_SHADOW_AUTO_BURN",
|
||||||
|
"when": "no shadow at the tree"
|
||||||
|
},
|
||||||
|
"arms": [
|
||||||
|
{
|
||||||
|
"id": "all",
|
||||||
|
"fix": {
|
||||||
|
"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"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 60
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"unknownArms": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "fresh-ablate",
|
||||||
|
"status": "waiting",
|
||||||
|
"note": "starts when fresh-replicate is complete",
|
||||||
|
"question": "Which choices on that path does the shadow need?",
|
||||||
|
"attempts": {
|
||||||
|
"from": 1,
|
||||||
|
"to": 1
|
||||||
|
},
|
||||||
|
"unit": "account",
|
||||||
|
"share": 1,
|
||||||
|
"exclusive": true,
|
||||||
|
"target": "Black",
|
||||||
|
"objective": "eventually",
|
||||||
|
"sampling": "best",
|
||||||
|
"seed": 20261116,
|
||||||
|
"measures": {
|
||||||
|
"roll": "shadow",
|
||||||
|
"rare": "yes"
|
||||||
|
},
|
||||||
|
"burn": {
|
||||||
|
"reason": "TREE_NO_SHADOW_AUTO_BURN",
|
||||||
|
"when": "no shadow at the tree"
|
||||||
|
},
|
||||||
|
"arms": [
|
||||||
|
{
|
||||||
|
"id": "with one squadmate",
|
||||||
|
"change": {
|
||||||
|
"company": "1 Squadmate",
|
||||||
|
"leave": "Stay together"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"company": "1 Squadmate",
|
||||||
|
"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",
|
||||||
|
"leave": "Stay together"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "with two squadmates",
|
||||||
|
"change": {
|
||||||
|
"company": "2 Squadmates",
|
||||||
|
"leave": "Stay together"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"company": "2 Squadmates",
|
||||||
|
"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",
|
||||||
|
"leave": "Stay together"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "leave the squad",
|
||||||
|
"change": {
|
||||||
|
"company": "2 Squadmates",
|
||||||
|
"leave": "Leave them"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"company": "2 Squadmates",
|
||||||
|
"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",
|
||||||
|
"leave": "Leave them"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "east first",
|
||||||
|
"change": {
|
||||||
|
"direction": "East"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"company": "Alone",
|
||||||
|
"direction": "East",
|
||||||
|
"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"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "centre first",
|
||||||
|
"change": {
|
||||||
|
"direction": "Center"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"company": "Alone",
|
||||||
|
"direction": "Center",
|
||||||
|
"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"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "face the first dragon",
|
||||||
|
"change": {
|
||||||
|
"react": "Respect / face it"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"company": "Alone",
|
||||||
|
"direction": "West",
|
||||||
|
"react": "Respect / face it",
|
||||||
|
"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"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "charge the smaller cadet",
|
||||||
|
"change": {
|
||||||
|
"fight": "Charge the smaller cadet"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"company": "Alone",
|
||||||
|
"direction": "West",
|
||||||
|
"react": "Hold still",
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"clearing": "Help your squadmate",
|
||||||
|
"fight": "Charge the smaller cadet",
|
||||||
|
"dagger": "Engage the smaller cadet",
|
||||||
|
"fate": "Squadmate's revenge",
|
||||||
|
"post": "West",
|
||||||
|
"hour": "Tree"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "charge the bigger cadet",
|
||||||
|
"change": {
|
||||||
|
"dagger": "Charge the bigger cadet anyway"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"company": "Alone",
|
||||||
|
"direction": "West",
|
||||||
|
"react": "Hold still",
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"clearing": "Help your squadmate",
|
||||||
|
"fight": "Pause to assess",
|
||||||
|
"dagger": "Charge the bigger cadet anyway",
|
||||||
|
"fate": "Squadmate's revenge",
|
||||||
|
"post": "West",
|
||||||
|
"hour": "Tree"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "kill the bullies",
|
||||||
|
"change": {
|
||||||
|
"fate": "Killed the bullies yourself"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"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": "Killed the bullies yourself",
|
||||||
|
"post": "West",
|
||||||
|
"hour": "Tree"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "leave the bullies",
|
||||||
|
"change": {
|
||||||
|
"fate": "Left bullies to the dragons"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"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": "Left bullies to the dragons",
|
||||||
|
"post": "West",
|
||||||
|
"hour": "Tree"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "fork to the forest",
|
||||||
|
"change": {
|
||||||
|
"post": "Forest"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"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": "Forest",
|
||||||
|
"hour": "Tree"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "fork east",
|
||||||
|
"change": {
|
||||||
|
"post": "East"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"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": "East",
|
||||||
|
"hour": "Tree"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 15
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"unknownArms": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "shadow-again",
|
||||||
|
"status": "running",
|
||||||
|
"question": "Does an account that saw the shadow, and died, see it again on the same path?",
|
||||||
|
"attempts": {
|
||||||
|
"from": 2,
|
||||||
|
"to": 4
|
||||||
|
},
|
||||||
|
"unit": "account",
|
||||||
|
"share": 1,
|
||||||
|
"exclusive": true,
|
||||||
|
"when": {
|
||||||
|
"sawShadowBefore": true
|
||||||
|
},
|
||||||
|
"target": "Black",
|
||||||
|
"objective": "eventually",
|
||||||
|
"sampling": "best",
|
||||||
|
"seed": 20261116,
|
||||||
|
"measures": {
|
||||||
|
"roll": "shadow",
|
||||||
|
"rare": "yes"
|
||||||
|
},
|
||||||
|
"burn": {
|
||||||
|
"reason": "TREE_NO_SHADOW_AUTO_BURN",
|
||||||
|
"when": "no shadow at the tree"
|
||||||
|
},
|
||||||
|
"arms": [
|
||||||
|
{
|
||||||
|
"id": "all",
|
||||||
|
"fix": {
|
||||||
|
"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"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 12
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"unknownArms": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "second-attempt-same-path",
|
||||||
|
"status": "running",
|
||||||
|
"question": "Does an account that missed on its first attempt miss again on the same path?",
|
||||||
|
"attempts": {
|
||||||
|
"from": 2,
|
||||||
|
"to": 2
|
||||||
|
},
|
||||||
|
"unit": "account",
|
||||||
|
"share": 1,
|
||||||
|
"accounts": {
|
||||||
|
"every": 2,
|
||||||
|
"take": 1,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"exclusive": true,
|
||||||
|
"when": {
|
||||||
|
"sawShadowBefore": false
|
||||||
|
},
|
||||||
|
"target": "Black",
|
||||||
|
"objective": "eventually",
|
||||||
|
"sampling": "best",
|
||||||
|
"seed": 20261116,
|
||||||
|
"measures": {
|
||||||
|
"roll": "shadow",
|
||||||
|
"rare": "yes"
|
||||||
|
},
|
||||||
|
"burn": {
|
||||||
|
"reason": "TREE_NO_SHADOW_AUTO_BURN",
|
||||||
|
"when": "no shadow at the tree"
|
||||||
|
},
|
||||||
|
"arms": [
|
||||||
|
{
|
||||||
|
"id": "all",
|
||||||
|
"fix": {
|
||||||
|
"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"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 60
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"unknownArms": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "veteran-repeat",
|
||||||
|
"status": "running",
|
||||||
|
"question": "Does an older account open up by repeating one path?",
|
||||||
|
"attempts": {
|
||||||
|
"from": 3,
|
||||||
|
"to": null
|
||||||
|
},
|
||||||
|
"unit": "account",
|
||||||
|
"share": 1,
|
||||||
|
"accounts": {
|
||||||
|
"every": 10,
|
||||||
|
"take": 1,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"exclusive": true,
|
||||||
|
"when": {
|
||||||
|
"sawShadowBefore": false
|
||||||
|
},
|
||||||
|
"target": "Black",
|
||||||
|
"objective": "eventually",
|
||||||
|
"sampling": "best",
|
||||||
|
"seed": 20261116,
|
||||||
|
"measures": {
|
||||||
|
"roll": "shadow",
|
||||||
|
"rare": "yes"
|
||||||
|
},
|
||||||
|
"burn": {
|
||||||
|
"reason": "TREE_NO_SHADOW_AUTO_BURN",
|
||||||
|
"when": "no shadow at the tree"
|
||||||
|
},
|
||||||
|
"arms": [
|
||||||
|
{
|
||||||
|
"id": "all",
|
||||||
|
"fix": {
|
||||||
|
"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"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 300
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"unknownArms": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "veteran-variety",
|
||||||
|
"status": "running",
|
||||||
|
"question": "Does an older account open up by varying its choices?",
|
||||||
|
"attempts": {
|
||||||
|
"from": 3,
|
||||||
|
"to": null
|
||||||
|
},
|
||||||
|
"unit": "account",
|
||||||
|
"share": 1,
|
||||||
|
"accounts": {
|
||||||
|
"every": 10,
|
||||||
|
"take": 1,
|
||||||
|
"offset": 1
|
||||||
|
},
|
||||||
|
"exclusive": true,
|
||||||
|
"when": {
|
||||||
|
"sawShadowBefore": false
|
||||||
|
},
|
||||||
|
"target": "Black",
|
||||||
|
"objective": "eventually",
|
||||||
|
"sampling": "best",
|
||||||
|
"seed": 20261116,
|
||||||
|
"measures": {
|
||||||
|
"roll": "shadow",
|
||||||
|
"rare": "yes"
|
||||||
|
},
|
||||||
|
"burn": {
|
||||||
|
"reason": "TREE_NO_SHADOW_AUTO_BURN",
|
||||||
|
"when": "no shadow at the tree"
|
||||||
|
},
|
||||||
|
"arms": [
|
||||||
|
{
|
||||||
|
"id": "all",
|
||||||
|
"fix": {
|
||||||
|
"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"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 300
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"unknownArms": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "meadow-blue-route",
|
||||||
|
"status": "running",
|
||||||
|
"question": "Does anything before the meadow change how often the Blue waits there?",
|
||||||
|
"attempts": {
|
||||||
|
"from": 2,
|
||||||
|
"to": null
|
||||||
|
},
|
||||||
|
"unit": "attempt",
|
||||||
|
"share": 0.5,
|
||||||
|
"target": "Blue",
|
||||||
|
"objective": "eventually",
|
||||||
|
"sampling": "best",
|
||||||
|
"seed": 20261116,
|
||||||
|
"measures": {
|
||||||
|
"roll": "meadow",
|
||||||
|
"rare": "Blue"
|
||||||
|
},
|
||||||
|
"burn": {
|
||||||
|
"reason": "MEADOW_NO_BLUE_AUTO_BURN",
|
||||||
|
"when": "no Blue in the meadow"
|
||||||
|
},
|
||||||
|
"arms": [
|
||||||
|
{
|
||||||
|
"id": "scream=Investigate the scream / direction=West",
|
||||||
|
"levels": {
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"direction": "West"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"hour": "Valley",
|
||||||
|
"valley": "Pass the Red (meadow)",
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"direction": "West"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 70
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "scream=Investigate the scream / direction=East",
|
||||||
|
"levels": {
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"direction": "East"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"hour": "Valley",
|
||||||
|
"valley": "Pass the Red (meadow)",
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"direction": "East"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 70
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "scream=Investigate the scream / direction=Center",
|
||||||
|
"levels": {
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"direction": "Center"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"hour": "Valley",
|
||||||
|
"valley": "Pass the Red (meadow)",
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"direction": "Center"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 70
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "scream=Keep walking / direction=West",
|
||||||
|
"levels": {
|
||||||
|
"scream": "Keep walking",
|
||||||
|
"direction": "West"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"hour": "Valley",
|
||||||
|
"valley": "Pass the Red (meadow)",
|
||||||
|
"scream": "Keep walking",
|
||||||
|
"direction": "West"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 70
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "scream=Keep walking / direction=East",
|
||||||
|
"levels": {
|
||||||
|
"scream": "Keep walking",
|
||||||
|
"direction": "East"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"hour": "Valley",
|
||||||
|
"valley": "Pass the Red (meadow)",
|
||||||
|
"scream": "Keep walking",
|
||||||
|
"direction": "East"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 70
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "scream=Keep walking / direction=Center",
|
||||||
|
"levels": {
|
||||||
|
"scream": "Keep walking",
|
||||||
|
"direction": "Center"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"hour": "Valley",
|
||||||
|
"valley": "Pass the Red (meadow)",
|
||||||
|
"scream": "Keep walking",
|
||||||
|
"direction": "Center"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 70
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"unknownArms": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "mapping",
|
||||||
|
"status": "running",
|
||||||
|
"question": "What does every option on every screen lead to?",
|
||||||
|
"attempts": {
|
||||||
|
"from": 2,
|
||||||
|
"to": null
|
||||||
|
},
|
||||||
|
"unit": "attempt",
|
||||||
|
"share": 0.35,
|
||||||
|
"target": "Blue",
|
||||||
|
"objective": "eventually",
|
||||||
|
"sampling": "uniform",
|
||||||
|
"seed": 20261116,
|
||||||
|
"measures": null,
|
||||||
|
"burn": {
|
||||||
|
"reason": "NOT_TARGET_AUTO_BURN",
|
||||||
|
"when": "the encounter is not a Blue or a Black"
|
||||||
|
},
|
||||||
|
"arms": [
|
||||||
|
{
|
||||||
|
"id": "all",
|
||||||
|
"fix": {},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 1000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"unknownArms": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sentinel",
|
||||||
|
"status": "running",
|
||||||
|
"question": "Have the game's odds changed?",
|
||||||
|
"attempts": {
|
||||||
|
"from": 2,
|
||||||
|
"to": null
|
||||||
|
},
|
||||||
|
"unit": "attempt",
|
||||||
|
"share": 0.15,
|
||||||
|
"target": "Blue",
|
||||||
|
"objective": "eventually",
|
||||||
|
"sampling": "best",
|
||||||
|
"seed": 20261116,
|
||||||
|
"measures": {
|
||||||
|
"roll": "meadow",
|
||||||
|
"rare": "Blue"
|
||||||
|
},
|
||||||
|
"burn": {
|
||||||
|
"reason": "MEADOW_NO_BLUE_AUTO_BURN",
|
||||||
|
"when": "no Blue in the meadow"
|
||||||
|
},
|
||||||
|
"arms": [
|
||||||
|
{
|
||||||
|
"id": "all",
|
||||||
|
"fix": {
|
||||||
|
"company": "Alone",
|
||||||
|
"direction": "Center",
|
||||||
|
"scream": "Keep walking",
|
||||||
|
"wounded": "Tourniquet",
|
||||||
|
"hour": "Valley",
|
||||||
|
"valley": "Pass the Red (meadow)"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"unknownArms": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id": "a7b307abeaaa"
|
||||||
|
}
|
||||||
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/DragonKind/threshing-atlas",
|
||||||
|
"repo_label": "git.kenschiano.net/DragonKind/threshing-atlas",
|
||||||
|
"host": "git.kenschiano.net",
|
||||||
|
"kind": "gitea",
|
||||||
|
"visibility": "limited",
|
||||||
|
"report": "https://git.kenschiano.net/DragonKind/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
@@ -0,0 +1 @@
|
|||||||
|
{"source":"Runs riders describe in the r/fourthwing Dragonkind megathread comments","runs":[],"unread":0}
|
||||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
|||||||
{"source":"Runs reported on the Atlas (\"Report a run\", a GitHub issue form)","reports":[]}
|
{"source":"Runs reported on the Atlas (\"Report a run\", an issue form on the Atlas's repository)","reports":[]}
|
||||||
+10535
-6017
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
@@ -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.
|
||||||
+117
-10
@@ -9,14 +9,89 @@ Data flows both ways:
|
|||||||
└──────────── collection --source bot + PR ◄┘
|
└──────────── collection --source bot + PR ◄┘
|
||||||
```
|
```
|
||||||
|
|
||||||
## Without GitHub: swapping zips
|
## 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:
|
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`
|
- **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/`.
|
(`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/runs.jsonl`, `data/knowledge.json` and `logs/encounters.jsonl` (folder names
|
- **Bot → atlas:** zip the bot's `data/` and `logs/` folders (folder names kept; a zip of the whole repo works too;
|
||||||
kept; a zip of the whole repo works too) and send it. Put it in the atlas's `inbox/` and run
|
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),
|
`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.
|
rebuilds everything, and then `export-bot-kit` makes the new zip to send back.
|
||||||
|
|
||||||
@@ -120,12 +195,33 @@ The atlas is advice. The bot's own safety rules stay in charge:
|
|||||||
Log every atlas pick with `rule: 'ATLAS_POLICY'`, `source: 'atlas'`, and the run-level `policyId: policy.id`
|
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.
|
(see `docs/BOT_DATA_PROTOCOL.md`), so we can tell which policy produced which runs.
|
||||||
|
|
||||||
### Ties are free experiments
|
### Learning: goal accounts follow the best route, research accounts sample
|
||||||
|
|
||||||
Many choices barely matter by the data we have (for Black, the first direction differs by a tenth of a percentage
|
The atlas learns from the bot's own runs: every zip of the bot's data that is imported adds its rolls (first dragon,
|
||||||
point). When `margin` is below the tie threshold (start with 0.002, i.e. 0.2 percentage points), pick at random
|
deaths, the shadow, the meadow dragon, bond results) to the route model, and the next `atlas-for-bot` zip carries
|
||||||
among the tied options and log `propensity` (1 / number of tied options). That costs nothing in expected success,
|
the updated model. Deliberate burns (Malek, "no shadow", "no Blue") never count as failed bond attempts.
|
||||||
and it is exactly the randomised data the atlas needs to tell real history effects from guide-copying.
|
|
||||||
|
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
|
### Which numbers to trust
|
||||||
|
|
||||||
@@ -135,8 +231,19 @@ and it is exactly the randomised data the atlas needs to tell real history effec
|
|||||||
- `samples.lowBias`: bulk logs and riders not chasing a rare dragon. Use it for absolute expectations, such as how
|
- `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.
|
many attempts a Blue should take. Rare sightings are over-reported in form posts, so `all` is optimistic for Blue.
|
||||||
|
|
||||||
Current headline (from `analysis/reports/POLICY.md`): Black about 1.7% per attempt (about 60 attempts), Blue 3.7–7% per attempt
|
Current headline (November 2026): Black about 1.4% on an account's first attempt (95% range 0.7–2.2%; 0.8% in the
|
||||||
(14–28 attempts), depending on the sample.
|
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
|
## 2. From the bot to the atlas
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ Rules every part of the project follows. If a change would break one, stop and a
|
|||||||
|
|
||||||
## Run reports
|
## Run reports
|
||||||
|
|
||||||
"Report a run" creates a public GitHub issue. The pipeline keeps only the issue number, the date and the answers
|
"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
|
(`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.
|
report closed as "not planned" or labelled `invalid` or `duplicate` is left out of the data.
|
||||||
|
|
||||||
|
|||||||
@@ -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: DragonKind/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.
|
||||||
@@ -1,5 +1,51 @@
|
|||||||
# Repository settings
|
# 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.
|
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
|
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.
|
it passes, and the token lets the daily data update do that on its own.
|
||||||
|
|||||||
+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: DragonKind/threshing-atlas # owner/name on the server (the DragonKind organization, beside the bot's repo)
|
||||||
|
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
|
||||||
+3
-2
@@ -6,11 +6,12 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node site/build.js",
|
"build": "node site/build.js",
|
||||||
"dev": "node site/build.js && python3 -m http.server 8000 -d dist",
|
"dev": "node site/build.js && python3 -m http.server 8000 -d dist",
|
||||||
"test:py": "python3 -m collection build --check && PYTHONPATH=core python3 -m unittest discover -s tests/core -p 'test_*.py' && python3 -m unittest discover -s tests/collection -p 'test_*.py'",
|
"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:unit": "node --test tests/core/graph.test.js tests/core/advisor.test.js",
|
||||||
"test": "npm run test:py && npm run test:unit",
|
"test": "npm run test:py && npm run test:unit",
|
||||||
"graph": "node analysis/network/build-graph.js",
|
"graph": "node analysis/network/build-graph.js",
|
||||||
"policy": "python3 planner/build_policy.py && python3 planner/policy_report.py",
|
"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",
|
"stats": "python3 analysis/stats/site_stats.py",
|
||||||
"collect": "python3 -m collection update",
|
"collect": "python3 -m collection update",
|
||||||
"build-data": "python3 -m collection build"
|
"build-data": "python3 -m collection build"
|
||||||
|
|||||||
+7
-3
@@ -7,9 +7,13 @@ The route planner: the best route to every dragon, and what goes back to Ken's b
|
|||||||
| `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. |
|
| `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`. |
|
| `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
|
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`).
|
`solver.js` and `graph.js` (see `docs/BOT_INTEGRATION.md`).
|
||||||
|
|
||||||
**The loop with the bot.** The planner's routes go out to the bot; the bot's runs come back through
|
**The loop with the bot.** `python -m collection cycle --bot <the bot's folder> --deliver <its vendor folder>`
|
||||||
`collection/bot/`. Experiments the bot should run to fill gaps the community form cannot (for example the
|
imports the bot's new runs, refits the route model, rebuilds the experiment plan and hands both back, in one
|
||||||
answers at each bonding encounter) belong here; `experiments.json` is on the roadmap.
|
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())
|
||||||
+22
-7
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
python planner/build_policy.py [--draws 200] [--out data/public/policy.json]
|
python planner/build_policy.py [--draws 200] [--out data/public/policy.json]
|
||||||
|
|
||||||
Two samples: every run, and a low-bias sample (bulk logs plus form runs from riders not chasing a rare dragon).
|
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.
|
The output has a content id, so each bot run can record which policy it followed.
|
||||||
"""
|
"""
|
||||||
import argparse
|
import argparse
|
||||||
@@ -20,9 +21,19 @@ from atlas import runs as runs_io # noqa: E402
|
|||||||
|
|
||||||
import yaml # noqa: E402
|
import yaml # noqa: E402
|
||||||
|
|
||||||
# the same runs the site's statistics use (analysis/stats/measures.yaml `sources`)
|
# which runs the model learns from, and the low-bias sample (planner/policy.yaml)
|
||||||
with open(ROOT / "analysis/stats/measures.yaml", encoding="utf-8") as _f:
|
with open(ROOT / "planner/policy.yaml", encoding="utf-8") as _f:
|
||||||
SOURCES = yaml.safe_load(_f)["sources"]
|
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):
|
def clean(o):
|
||||||
@@ -49,12 +60,16 @@ def main(argv=None):
|
|||||||
rows = len(runs)
|
rows = len(runs)
|
||||||
samples = {
|
samples = {
|
||||||
"all": runs,
|
"all": runs,
|
||||||
"lowBias": [r for r in runs if r["entry"] != "Form" or r["goal"] not in model.RARE_GOALS],
|
"lowBias": [r for r in runs if low_bias(r)],
|
||||||
}
|
}
|
||||||
t0 = time.time()
|
t0 = time.time()
|
||||||
out = {"schema": 1, "source": {"form_rows": rows}, "samples": {}}
|
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():
|
for name, rs in samples.items():
|
||||||
out["samples"][name] = clean(solver.build_policy(rs, draws=a.draws))
|
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")
|
print(f"{name}: {len(rs)} runs, {time.time() - t0:.1f} s")
|
||||||
# a content id (no timestamps: the build is reproducible)
|
# a content id (no timestamps: the build is reproducible)
|
||||||
out["id"] = hashlib.sha1(json.dumps(out["samples"], separators=(",", ":"), sort_keys=True).encode()).hexdigest()[:12]
|
out["id"] = hashlib.sha1(json.dumps(out["samples"], separators=(",", ":"), sort_keys=True).encode()).hexdigest()[:12]
|
||||||
|
|||||||
@@ -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 }
|
||||||
@@ -0,0 +1,171 @@
|
|||||||
|
# What the game's developer has said about how Dragonkind works, and what the Atlas does with each statement.
|
||||||
|
#
|
||||||
|
# Source: the developer's answers in a community Discord channel, forwarded there between 2026-10-19 and
|
||||||
|
# 2026-11-13 and exported on 2026-11-16. The export is private raw data (never committed: data/raw/). The
|
||||||
|
# statements below are paraphrased, with the date of the original message; no member is named.
|
||||||
|
#
|
||||||
|
# strength: said the developer stated it plainly
|
||||||
|
# hint said indirectly, or with a caveat ("I think", "maybe", a number offered half-seriously)
|
||||||
|
# declined the developer refused to answer (the community's "taps the sign"); recorded so that nobody
|
||||||
|
# reads a refusal as a yes or a no
|
||||||
|
# use: what in the Atlas depends on it. `open` lists what is still unknown and the experiment that tests it
|
||||||
|
# (planner/experiments.yaml). analysis/reports/BLACK.md is what the runs themselves show.
|
||||||
|
version: 1
|
||||||
|
|
||||||
|
engine:
|
||||||
|
- id: deterministic-engine
|
||||||
|
date: 2026-10-29
|
||||||
|
strength: said
|
||||||
|
statement: >
|
||||||
|
The game is a seeded, guarded, acyclic, deterministic transition system. The scene a reader stands in is a
|
||||||
|
function of the story and the path so far; the choices offered are a function of the story, the path, the
|
||||||
|
run's seed, and facts the site knows about the account. A run is deterministic once its seed is fixed.
|
||||||
|
use: The route model's rolls are fixed constants per scene, not quantities that drift; the game is a tree.
|
||||||
|
- id: seed
|
||||||
|
date: 2026-10-21
|
||||||
|
strength: said
|
||||||
|
statement: >
|
||||||
|
Each run gets a new id from the database; a keyed hash of it is the run's seed, the source of all the run's
|
||||||
|
randomness. The dice are in effect thrown before the first choice. The seed cannot be seen or influenced
|
||||||
|
from the browser, and neither time of day nor timing matters.
|
||||||
|
use: No experiment varies time of day or timing. Nothing a rider does before a run changes its dice.
|
||||||
|
- id: draws
|
||||||
|
date: 2026-11-04
|
||||||
|
strength: said
|
||||||
|
statement: A scene that uses the seed carries a chance out of 10,000 of an event.
|
||||||
|
use: Each roll is one fixed number per scene. Pooling a roll across routes that reach the same scene is right.
|
||||||
|
- id: one-in-twenty
|
||||||
|
date: 2026-10-19
|
||||||
|
strength: said
|
||||||
|
statement: No single event has worse than 1-in-20 odds; rare outcomes come from several events stacking.
|
||||||
|
use: >
|
||||||
|
A roll estimated below 5% is suspect: either several events are being counted as one, or it is not a roll.
|
||||||
|
The shadow (0.07% on later attempts) is the case in point: it is not a roll (see black/not-random).
|
||||||
|
- id: facts
|
||||||
|
date: 2026-10-21
|
||||||
|
strength: said
|
||||||
|
statement: >
|
||||||
|
The "facts" are what a web server knows about the request and the account. Neither part of the email address
|
||||||
|
is one. The site keeps little about readers, collects no analytics and does not fingerprint.
|
||||||
|
use: The bot records what it can see of the account on every run (planner/experiments.yaml, `record`).
|
||||||
|
- id: runs-remembered
|
||||||
|
date: 2026-10-29
|
||||||
|
strength: said
|
||||||
|
statement: A run is a small database entry and there is no reason ever to forget one.
|
||||||
|
use: An account's earlier runs can be among the facts. The bot keeps every account's full history.
|
||||||
|
- id: choice-order
|
||||||
|
date: 2026-10-25
|
||||||
|
strength: said
|
||||||
|
statement: The order of the choices on a screen is shuffled by the seed and belongs to the interface, not the engine.
|
||||||
|
use: Screen position is never analysed; options are matched by their text.
|
||||||
|
- id: size
|
||||||
|
date: 2026-10-25
|
||||||
|
strength: said
|
||||||
|
statement: There are about 24 million distinct paths; random play is bad at bonding.
|
||||||
|
use: Mapping cannot enumerate paths. It records each screen's options and where each leads.
|
||||||
|
- id: no-squad-bias
|
||||||
|
date: 2026-10-29
|
||||||
|
strength: said
|
||||||
|
statement: There is no squad bias toward the ability to bond anything.
|
||||||
|
use: Wing, section and squad are recorded but not expected to matter (BLACK.md section 3 agrees).
|
||||||
|
|
||||||
|
blue:
|
||||||
|
- id: blue-is-dice
|
||||||
|
date: 2026-11-04
|
||||||
|
strength: said
|
||||||
|
statement: >
|
||||||
|
Whether a Blue appears is a dice roll from the seed, like a loot drop. Someone who says they could
|
||||||
|
brute-force a Blue is right. Seeing one, the stacked odds of the bonding steps still kill most riders.
|
||||||
|
use: The meadow Blue stays a roll. Repeated attempts are the method; the gain is in the bonding answers.
|
||||||
|
|
||||||
|
black:
|
||||||
|
- id: not-random
|
||||||
|
date: 2026-11-04
|
||||||
|
strength: said
|
||||||
|
statement: >
|
||||||
|
The seed plays no part in whether the Black shows itself (repeated 2026-10-21, 2026-11-04, 2026-11-13). Its
|
||||||
|
conditions rest entirely on the rider's own choices. A rider who meets all of them gets the Black, and one
|
||||||
|
who knows the system can bond a Black with certainty, no luck involved.
|
||||||
|
use: >
|
||||||
|
The shadow is a guard, not a roll (core/spec/game.yaml `guard`). The model's "chance of the shadow" is the
|
||||||
|
share of runs like this one that met conditions we do not know yet, not the game's dice. Experiments on it
|
||||||
|
look for the rule (hold everything fixed, change one thing), not for a rate.
|
||||||
|
- id: gates
|
||||||
|
date: 2026-10-28
|
||||||
|
strength: said
|
||||||
|
statement: >
|
||||||
|
A rider must navigate the bullies encounter, and the tree is also a gate. There is no single route, and
|
||||||
|
there never will be a map that takes a rider down one specific route. The path does not change with time.
|
||||||
|
use: game.yaml `requires` on the shadow. BLACK.md section 4 (shadows on 44 different recorded routes) agrees.
|
||||||
|
- id: few-factors
|
||||||
|
date: 2026-10-28
|
||||||
|
strength: hint
|
||||||
|
statement: There are not forty factors; five "sounds like" a tolerable number.
|
||||||
|
use: The search is for a handful of conditions. Not relied on as an exact count.
|
||||||
|
- id: twenty
|
||||||
|
date: 2026-11-03
|
||||||
|
strength: hint
|
||||||
|
statement: Twenty is a discrete count the community would have a handle on once it understood how the Black is seen.
|
||||||
|
use: Unexplained. No analysis assumes what is counted.
|
||||||
|
- id: runs-never-hurt
|
||||||
|
date: 2026-11-07
|
||||||
|
strength: said
|
||||||
|
statement: >
|
||||||
|
Repeating the same path does not hurt an account's chances, so any given run either does nothing for them or
|
||||||
|
improves them. With a solution in hand there is no bad reputation to undo; the only risk is bonding
|
||||||
|
something unintended. Dooming an account at creation would be an accessibility problem.
|
||||||
|
use: >
|
||||||
|
Research attempts cannot spoil an account for the Black. Hard to square with section 2 of BLACK.md (the same
|
||||||
|
route works on a first attempt and almost never later), which is why the fresh-against-veteran experiments
|
||||||
|
come first.
|
||||||
|
- id: fresh-and-veteran
|
||||||
|
date: 2026-11-11
|
||||||
|
strength: hint
|
||||||
|
statement: >
|
||||||
|
Asked whether a rider with perfect knowledge would find the Black more easily on a first attempt or a later
|
||||||
|
one, the developer came close to answering and said the question was near a solution. Later: the community
|
||||||
|
is exploring what the developer would explore; the hard part is that an older account gives no feedback
|
||||||
|
until "it" happens; the task is to test the apparent success of a fresh account against the environment of
|
||||||
|
a veteran one.
|
||||||
|
use: Experiments fresh-replicate, shadow-again, second-attempt-same-path, veteran-repeat, veteran-variety.
|
||||||
|
- id: who-you-walk-with
|
||||||
|
date: 2026-11-07
|
||||||
|
strength: hint
|
||||||
|
statement: >
|
||||||
|
The valley might look different depending on who a rider walks in with, who they leave behind and who they
|
||||||
|
choose to fight; the dragons assess riders as riders assess dragons.
|
||||||
|
use: Company, leaving the squad, and the fight are the first decisions the ablation changes.
|
||||||
|
- id: death-does-not-matter
|
||||||
|
date: 2026-11-10
|
||||||
|
strength: said
|
||||||
|
statement: How a rider dies, the death message, and the scene a rider dies at are not factors in later runs.
|
||||||
|
use: Deliberate burns on research accounts are not a confound.
|
||||||
|
- id: order-does-not-matter
|
||||||
|
date: 2026-11-04
|
||||||
|
strength: hint
|
||||||
|
statement: As the developer understood the question, order does not matter.
|
||||||
|
use: None yet (the question it answered is not in the export).
|
||||||
|
|
||||||
|
declined: # refused, so neither confirmed nor denied
|
||||||
|
- Whether the conditions are only the answers to the questions (2026-10-25).
|
||||||
|
- Whether the shadow at the tree is the only way to meet a Black (2026-10-26).
|
||||||
|
- Whether choices repeated across runs raise or lower the chance (2026-10-21); later answered in part (runs-never-hurt).
|
||||||
|
- Whether older accounts can recover (2026-10-21).
|
||||||
|
- Whether there are hidden scores for personality, reputation or the like (2026-11-07, 2026-11-09, 2026-11-10).
|
||||||
|
- Whether the link riders see between cadet assignment and the Black is coincidence (2026-11-04).
|
||||||
|
|
||||||
|
open:
|
||||||
|
- question: On a fresh account, does one exact path always show the shadow, or only sometimes?
|
||||||
|
why: Always would mean the rule is in this run's choices. Sometimes would mean accounts differ in a fact we do not record.
|
||||||
|
experiment: fresh-replicate
|
||||||
|
- question: Which choices on that path are needed?
|
||||||
|
experiment: fresh-ablate
|
||||||
|
- question: Does an account that saw the shadow see it again on the same path?
|
||||||
|
experiment: shadow-again
|
||||||
|
- question: Does an account that missed on its first attempt miss again on the same path?
|
||||||
|
experiment: second-attempt-same-path
|
||||||
|
- question: Does an older account open up by repeating one path, or by varying its choices?
|
||||||
|
experiment: veteran-repeat, veteran-variety
|
||||||
|
- question: Holding the Black's gaze bonds about seven times in ten. What decides the rest?
|
||||||
|
why: The developer says knowledge gives certainty, so it should not be dice.
|
||||||
|
experiment: every screen after the shadow is logged; the bot follows the reported sequence (experiments.yaml `scripts`).
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
# Which runs the route model (data/public/policy.json) learns from. planner/build_policy.py reads this file.
|
||||||
|
#
|
||||||
|
# The model estimates the game's rolls (first dragon, deaths, shadow, meadow dragon, bond chances) given the choices
|
||||||
|
# made before them, so any run that records its choices and what happened can teach it, whoever chose the route.
|
||||||
|
# Deliberate deaths (Malek, the bot's "no shadow" / "no Blue" burns) are never counted as failed bond attempts.
|
||||||
|
version: 1
|
||||||
|
|
||||||
|
# the `source` values of data/public/runs_clean.csv the model learns from
|
||||||
|
sources: [reddit spreadsheet, reported, bot]
|
||||||
|
|
||||||
|
# Two samples. "all" is every run above. "lowBias" leaves out runs where a rare sighting is more likely to have
|
||||||
|
# been reported than a miss: form submissions and reports from riders chasing Blue or Black. The bot logs every
|
||||||
|
# run, and bulk-pasted logs record every run of the players who kept them, so both stay in.
|
||||||
|
low_bias:
|
||||||
|
always: [bot] # sources whose every run is kept
|
||||||
|
entries_kept: [bulk] # spreadsheet rows whose `entry` is not "Form" (bulk-pasted logs)
|
||||||
|
rare_goals: [Blue, Black, Blue or Black]
|
||||||
|
|
||||||
|
# Reporting bias (core/atlas/bias.py). A rider is more likely to write up a run with a shadow or a meadow Blue than
|
||||||
|
# one without, so those sightings are over-represented in form submissions. For each rare roll below and each group
|
||||||
|
# that is not complete, the model estimates how many times more often the group reports the rare outcome than the
|
||||||
|
# complete groups do (rho, with a 90% range), and counts each rare outcome it reports as 1/rho. The group's pattern
|
||||||
|
# across routes is kept; its overall level comes from complete logging. Assumes the bias is the same on every route.
|
||||||
|
reporting_bias:
|
||||||
|
rolls: { shadow: "yes", meadow: Blue } # roll: its rare outcome
|
||||||
|
min_runs: 30 # fewer runs than this in a group (or the complete groups): borrow
|
||||||
|
min_complete_rare: 5 # fewer rare outcomes than this in complete logs: the bias cannot be
|
||||||
|
# estimated, so the roll is learned from complete logs only, unless
|
||||||
|
# `borrow` names another roll for it
|
||||||
|
# An assumption, not an estimate: complete logs have never seen the shadow, so its reporting bias cannot be
|
||||||
|
# measured. Each group is taken to over-report the shadow as much as it over-reports the meadow Blue. Without
|
||||||
|
# this, form submissions are left out of the shadow roll and the first-attempt effect (seen only in them) is
|
||||||
|
# lost. Remove the line to go back to complete logs only; the bot's first-attempt runs will replace it.
|
||||||
|
borrow: { shadow: meadow }
|
||||||
|
groups: # first match wins
|
||||||
|
- { name: bot, when: { source: bot }, complete: true }
|
||||||
|
- { name: bulk logs, when: { source: reddit spreadsheet, entry_not: Form }, complete: true }
|
||||||
|
- { name: "form, chasing Blue/Black", when: { source: reddit spreadsheet, goal: rare } }
|
||||||
|
- { name: "form, other", when: { source: reddit spreadsheet } }
|
||||||
|
- { name: reported, when: { source: reported }, same_as: "form, other" }
|
||||||
@@ -74,6 +74,15 @@ def main():
|
|||||||
a, e, l = t["thisAttempt"], t["eventually"], lb["targets"][X]["thisAttempt"]
|
a, e, l = t["thisAttempt"], t["eventually"], lb["targets"][X]["thisAttempt"]
|
||||||
att = e["expectedAttempts"]["mean"]
|
att = e["expectedAttempts"]["mean"]
|
||||||
L.append(f"| {X} | {pct(a['pX']['mean'])} ({pct(a['pX']['lo'])}–{pct(a['pX']['hi'])}) | {pct(l['pX']['mean'])} ({pct(l['pX']['lo'])}–{pct(l['pX']['hi'])}) | {pct(t['crossFit']['heldOut'])} | {pct(e['ratio']['mean'])} | {'–' if att is None else js_round(att)} |")
|
L.append(f"| {X} | {pct(a['pX']['mean'])} ({pct(a['pX']['lo'])}–{pct(a['pX']['hi'])}) | {pct(l['pX']['mean'])} ({pct(l['pX']['lo'])}–{pct(l['pX']['hi'])}) | {pct(t['crossFit']['heldOut'])} | {pct(e['ratio']['mean'])} | {'–' if att is None else js_round(att)} |")
|
||||||
|
L += ["", "## First attempts", ""]
|
||||||
|
L += ["The shadow at the tree is close to a first-attempt event, so an account's first attempt is solved separately (`givens` in `core/spec/game.yaml`). Only the colours that can come from the shadow differ much.", ""]
|
||||||
|
L += ["| Colour | First attempt | Low-bias sample | Later attempt |", "|---|---|---|---|"]
|
||||||
|
for X, t in s["targets"].items():
|
||||||
|
f, fl, a = t["firstAttempt"]["thisAttempt"]["pX"], lb["targets"][X]["firstAttempt"]["thisAttempt"]["pX"], t["thisAttempt"]["pX"]
|
||||||
|
L.append(f"| {X} | {pct(f['mean'])} ({pct(f['lo'])}–{pct(f['hi'])}) | {pct(fl['mean'])} ({pct(fl['lo'])}–{pct(fl['hi'])}) | {pct(a['mean'])} ({pct(a['lo'])}–{pct(a['hi'])}) |")
|
||||||
|
sh = (s["model"].get("reportingBias") or {}).get("form, chasing Blue/Black", {}).get("shadow", {})
|
||||||
|
if sh.get("used", "").startswith("assumed"):
|
||||||
|
L += ["", f"The shadow's reporting bias cannot be measured yet (complete logs have never seen one), so it is assumed equal to the meadow Blue's (`borrow` in `planner/policy.yaml`): form reports of a shadow count 1/{sh['rho']:.1f} each. The bot's first-attempt runs will replace this assumption."]
|
||||||
L += ["", "## How much do earlier choices matter?", ""]
|
L += ["", "## How much do earlier choices matter?", ""]
|
||||||
L += ["Each chance event can depend on the choices before it. The model learns how much from the data (empirical-Bayes concentration; larger means the history matters less):", ""]
|
L += ["Each chance event can depend on the choices before it. The model learns how much from the data (empirical-Bayes concentration; larger means the history matters less):", ""]
|
||||||
L += ["| Chance event | Depends on (most important first) | Concentration |", "|---|---|---|"]
|
L += ["| Chance event | Depends on (most important first) | Concentration |", "|---|---|---|"]
|
||||||
|
|||||||
+1
-1
@@ -588,7 +588,7 @@
|
|||||||
L.push("");
|
L.push("");
|
||||||
L.push(`Interactive route map, full methods, and code to reproduce every number: [Threshing Route Atlas](LINK)`);
|
L.push(`Interactive route map, full methods, and code to reproduce every number: [Threshing Route Atlas](LINK)`);
|
||||||
L.push("");
|
L.push("");
|
||||||
L.push(`*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.*`);
|
L.push(`*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 game's author has said no single roll is worse than 1 in 20 and that the Black is not luck, but no route guarantees a bond.*`);
|
||||||
return L.join("\n");
|
return L.join("\n");
|
||||||
}
|
}
|
||||||
$("#cp-reddit").addEventListener("click", () => copyText(redditPost(), "Reddit post"));
|
$("#cp-reddit").addEventListener("click", () => copyText(redditPost(), "Reddit post"));
|
||||||
|
|||||||
+40
-96
@@ -1,4 +1,4 @@
|
|||||||
/* dragons.js — original dragon silhouettes for the valley map.
|
/* 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,
|
* 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
|
* 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. */
|
* 200 x 160 box; flip with scale(-1, 1). Works in the browser (window.DragonArt) and in Node. */
|
||||||
@@ -124,112 +124,56 @@
|
|||||||
|
|
||||||
/* ---------- poses ---------- */
|
/* ---------- poses ---------- */
|
||||||
|
|
||||||
const POSES = {
|
/* Six silhouettes traced from the project's pose reference sheet (all facing right, in the 200 x 160 box;
|
||||||
// seated and watchful, one wing raised, tail curled round the feet
|
* flying and diving poses centred, the others standing on the bottom edge), each with the sheet's interior lines
|
||||||
sitting() {
|
* (wing ribs, folds, the rock's edges) drawn over the colour, for depth; gaps the sheet leaves open (between the
|
||||||
const d = [];
|
* perched dragon's legs and the rock, under the sleeping one's wing) are holes. Names keep the old
|
||||||
d.push(...wing({ shoulder: [88, 74], wrist: [62, 18], tip: [24, 30], fingers: [[14, 66], [30, 98], [56, 116]], root: [76, 112], bow: 0.3 }));
|
* pose keys: coiled is the diving dragon, resting the sleeping one, sitting the one perched on a rock. */
|
||||||
d.push(ell(92, 104, 26, 36, -0.25));
|
const TRACED = {
|
||||||
d.push(tube([[90, 80], [96, 58], [110, 42], [116, 34]], 13, 7));
|
"flying": {
|
||||||
const t = tail([[76, 132], [56, 150], [110, 158], [168, 150]], 9);
|
"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",
|
||||||
d.push(...t.d);
|
"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"
|
||||||
d.push(...leg([84, 120], [70, 136], [86, 152], 12, 1));
|
|
||||||
d.push(...leg([102, 104], [110, 124], [114, 150], 7, 1));
|
|
||||||
const h = head({ at: [114, 34], ang: -0.05, size: 1.05 });
|
|
||||||
d.push(...h.d);
|
|
||||||
d.push(...spines(bez([[86, 84], [84, 62], [100, 44], [110, 36]], 10), 4, -1, 2));
|
|
||||||
d.push(...spines(t.pts.slice(0, 26), (u) => 4 * (1 - u), 1, 3));
|
|
||||||
return { d, eye: h.eye, eyeR: h.eyeR };
|
|
||||||
},
|
},
|
||||||
// low and stalking, head forward, wings folded
|
"prowling": {
|
||||||
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",
|
||||||
const d = [];
|
"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"
|
||||||
d.push(...wing({ shoulder: [92, 92], wrist: [70, 64], tip: [118, 52], fingers: [[136, 70], [130, 90]], root: [104, 100], bow: 0.25, bone: 3.4 }));
|
|
||||||
d.push(ell(96, 108, 38, 18, 0.05));
|
|
||||||
d.push(tube([[124, 104], [140, 98], [152, 92], [162, 94]], 11, 7));
|
|
||||||
const t = tail([[62, 108], [36, 106], [22, 128], [6, 120]], 11);
|
|
||||||
d.push(...t.d);
|
|
||||||
d.push(...leg([72, 112], [60, 128], [70, 146], 11));
|
|
||||||
d.push(...leg([84, 116], [94, 130], [92, 146], 8));
|
|
||||||
d.push(...leg([118, 112], [126, 128], [124, 146], 8));
|
|
||||||
d.push(...leg([128, 110], [140, 126], [146, 146], 7));
|
|
||||||
const h = head({ at: [160, 94], ang: 0.12, size: 1 });
|
|
||||||
d.push(...h.d);
|
|
||||||
d.push(...spines(bez([[66, 92], [90, 84], [130, 86], [156, 88]], 14), 3.6, -1, 2));
|
|
||||||
d.push(...spines(t.pts.slice(0, 26), (u) => 3.6 * (1 - u), -1, 3));
|
|
||||||
return { d, eye: h.eye, eyeR: h.eyeR };
|
|
||||||
},
|
},
|
||||||
// in flight, both wings spread
|
"roaring": {
|
||||||
flying() {
|
"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",
|
||||||
const d = [];
|
"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"
|
||||||
d.push(...wing({ shoulder: [96, 84], wrist: [70, 36], tip: [40, 6], fingers: [[30, 40], [44, 66], [70, 80]], root: [92, 94], bow: 0.32 }));
|
|
||||||
d.push(...wing({ shoulder: [110, 84], wrist: [140, 30], tip: [190, 14], fingers: [[178, 52], [160, 76], [134, 90]], root: [114, 96], bow: 0.32 }));
|
|
||||||
d.push(ell(104, 96, 30, 13, 0.2));
|
|
||||||
d.push(tube([[128, 92], [142, 86], [150, 76], [158, 72]], 9, 6));
|
|
||||||
const t = tail([[78, 92], [54, 98], [40, 120], [12, 116]], 8);
|
|
||||||
d.push(...t.d);
|
|
||||||
d.push(...leg([94, 102], [96, 116], [108, 124], 6));
|
|
||||||
d.push(...leg([116, 102], [122, 114], [132, 118], 5));
|
|
||||||
const h = head({ at: [156, 72], ang: -0.2, size: 0.9, open: 2 });
|
|
||||||
d.push(...h.d);
|
|
||||||
return { d, eye: h.eye, eyeR: h.eyeR };
|
|
||||||
},
|
},
|
||||||
// reared up and roaring, wings half open
|
"sitting": {
|
||||||
roaring() {
|
"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",
|
||||||
const d = [];
|
"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"
|
||||||
d.push(...wing({ shoulder: [94, 68], wrist: [52, 40], tip: [30, 2], fingers: [[16, 46], [34, 78], [66, 96]], root: [90, 98], bow: 0.3 }));
|
|
||||||
d.push(ell(98, 100, 22, 40, 0.2));
|
|
||||||
d.push(tube([[104, 70], [112, 50], [126, 34], [136, 24]], 13, 7));
|
|
||||||
const t = tail([[86, 136], [60, 156], [30, 150], [14, 132]], 10);
|
|
||||||
d.push(...t.d);
|
|
||||||
d.push(...leg([90, 124], [104, 138], [96, 154], 12));
|
|
||||||
d.push(...leg([108, 86], [124, 92], [132, 82], 6, 1));
|
|
||||||
d.push(...leg([102, 92], [116, 104], [126, 98], 6, 1));
|
|
||||||
const h = head({ at: [134, 24], ang: -0.55, size: 1.05, open: 7 });
|
|
||||||
d.push(...h.d);
|
|
||||||
d.push(...spines(bez([[94, 86], [100, 60], [116, 40], [130, 28]], 10), 4, -1, 2));
|
|
||||||
return { d, eye: h.eye, eyeR: h.eyeR };
|
|
||||||
},
|
},
|
||||||
// coiled, as if wrapped around something, head lifted
|
"resting": {
|
||||||
coiled() {
|
"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",
|
||||||
const d = [];
|
"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"
|
||||||
const t = tail([[100, 120], [30, 150], [20, 80], [80, 74]], 15);
|
|
||||||
d.push(...t.d);
|
|
||||||
d.push(tube([[100, 120], [150, 130], [170, 96], [140, 70]], 16, 12));
|
|
||||||
d.push(tube([[140, 70], [124, 52], [128, 34], [146, 26]], 12, 7));
|
|
||||||
d.push(...wing({ shoulder: [134, 76], wrist: [106, 36], tip: [72, 26], fingers: [[64, 52], [80, 70], [104, 82]], root: [124, 90], bow: 0.28, bone: 3.4 }));
|
|
||||||
d.push(...leg([150, 116], [164, 126], [170, 142], 8));
|
|
||||||
d.push(...leg([116, 124], [114, 138], [122, 150], 8));
|
|
||||||
const h = head({ at: [144, 26], ang: 0.1, size: 1 });
|
|
||||||
d.push(...h.d);
|
|
||||||
d.push(...spines(t.pts, (u) => 3.5 * (1 - u * 0.7), -1, 3));
|
|
||||||
return { d, eye: h.eye, eyeR: h.eyeR };
|
|
||||||
},
|
|
||||||
// lying down at rest, head up
|
|
||||||
resting() {
|
|
||||||
const d = [];
|
|
||||||
d.push(...wing({ shoulder: [90, 108], wrist: [66, 84], tip: [112, 70], fingers: [[134, 88], [124, 108]], root: [100, 118], bow: 0.25, bone: 3.2 }));
|
|
||||||
d.push(ell(92, 126, 42, 18, 0));
|
|
||||||
d.push(tube([[124, 120], [140, 112], [146, 92], [158, 82]], 12, 7));
|
|
||||||
const t = tail([[54, 130], [24, 140], [20, 152], [70, 152]], 11);
|
|
||||||
d.push(...t.d);
|
|
||||||
d.push(...leg([120, 132], [132, 142], [150, 146], 8));
|
|
||||||
d.push(...leg([70, 134], [82, 144], [96, 148], 10));
|
|
||||||
const h = head({ at: [156, 84], ang: 0.05, size: 1 });
|
|
||||||
d.push(...h.d);
|
|
||||||
d.push(...spines(bez([[60, 112], [90, 104], [130, 106], [152, 88]], 14), 3.4, -1, 2));
|
|
||||||
return { d, eye: h.eye, eyeR: h.eyeR };
|
|
||||||
},
|
},
|
||||||
|
"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 = {};
|
const cache = {};
|
||||||
/** SVG markup for one dragon: <g> with the silhouette in `fill` and a small eye in `eyeFill`. */
|
/** SVG markup for one dragon: <g> with the silhouette in `fill`, its interior lines in `ink` (lineOpacity; lines:
|
||||||
function svg(pose, { fill = "#2a2230", eyeFill = "#f6e6c4", flip = false } = {}) {
|
* 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]();
|
if (!cache[pose]) cache[pose] = POSES[pose]();
|
||||||
const p = cache[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 tf = flip ? ' transform="translate(200 0) scale(-1 1)"' : "";
|
||||||
// one path per part: parts wind in different directions, so a single combined path would punch holes
|
const edge = outline ? ` stroke="${outline}" stroke-opacity="${outlineOpacity}" stroke-width="${outlineWidth}" stroke-linejoin="round" vector-effect="non-scaling-stroke"` : "";
|
||||||
return `<g${tf}><g fill="${fill}">${p.d.map((d) => `<path d="${d}"/>`).join("")}</g><circle cx="${f(p.eye[0])}" cy="${f(p.eye[1])}" r="${p.eyeR}" fill="${eyeFill}"/></g>`;
|
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) ---------- */
|
/* ---------- cadets and the thorn bush (same building blocks, 100 x 140 box, feet near y = 132) ---------- */
|
||||||
|
|
||||||
|
|||||||
+122
-17
@@ -9,7 +9,9 @@
|
|||||||
* 3 click a choice point on the highlighted route: its other options branch off, each with the chance it gives.
|
* 3 click a choice point on the highlighted route: its other options branch off, each with the chance it gives.
|
||||||
* Picking one re-plans the route from there.
|
* Picking one re-plans the route from there.
|
||||||
* 4 "Why this route?" in the side panel: intervals, how often the choice stays best, low-bias numbers, risks.
|
* 4 "Why this route?" in the side panel: intervals, how often the choice stays best, low-bias numbers, risks.
|
||||||
* A toggle adds the community's actual traffic underneath. The URL keeps the selection (#valley/blue/meadow-Blue).
|
* "Show the paths of all riders" adds, underneath, the paths every source logged (one layer each: the sheet's form
|
||||||
|
* posts and bulk logs, runs reported here, the bot, Discord) and the deaths (deliberate and failed), each layer with
|
||||||
|
* its own switch; the counts come from data/stats.json `paths` (analysis/stats/site_stats.py). The URL keeps the selection (#valley/blue/meadow-Blue).
|
||||||
*/
|
*/
|
||||||
(function () {
|
(function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
@@ -39,15 +41,15 @@
|
|||||||
};
|
};
|
||||||
const RESCUE = { Orange: "tree-Greens", Brown: "tree-Greens" };
|
const RESCUE = { Orange: "tree-Greens", Brown: "tree-Greens" };
|
||||||
const SPOTS = [
|
const SPOTS = [
|
||||||
{ place: "treeRed", enc: "tree-Red", colour: "Red", pose: "prowling", flip: true, sc: 0.36 },
|
{ place: "treeRed", enc: "tree-Red", colour: "Red", pose: "roaring", flip: true, sc: 0.36 },
|
||||||
{ place: "greens", enc: "tree-Greens", colour: "Green", pose: "resting", sc: 0.3, dx: -16 },
|
{ place: "greens", enc: "tree-Greens", colour: "Green", pose: "prowling", sc: 0.3, dx: -16 },
|
||||||
{ place: "greens", enc: "tree-Greens", colour: "Green", pose: "sitting", flip: true, sc: 0.27, dx: 20, dy: -4, twin: true },
|
{ place: "greens", enc: "tree-Greens", colour: "Green", pose: "prowling", flip: true, sc: 0.27, dx: 20, dy: -4, twin: true },
|
||||||
{ place: "black", enc: "shadow-Black", colour: "Black", pose: "flying", flip: true, sc: 0.38 },
|
{ place: "black", enc: "shadow-Black", colour: "Black", pose: "resting", flip: true, sc: 0.38 },
|
||||||
{ place: "redwood", enc: "shadow-Blue", colour: "Blue", pose: "coiled", sc: 0.3 },
|
{ place: "redwood", enc: "shadow-Blue", colour: "Blue", pose: "coiled", sc: 0.3 },
|
||||||
{ place: "valleyRed", enc: "valley-Red", colour: "Red", pose: "roaring", sc: 0.36, dy: -12 },
|
{ place: "valleyRed", enc: "valley-Red", colour: "Red", pose: "roaring", sc: 0.36, dy: -12 },
|
||||||
{ place: "meadow:Orange", enc: "meadow-Orange", colour: "Orange", pose: "sitting", flip: true, sc: 0.3 },
|
{ place: "meadow:Orange", enc: "meadow-Orange", colour: "Orange", pose: "flying", flip: true, sc: 0.3 },
|
||||||
{ place: "meadow:Brown", enc: "meadow-Brown", colour: "Brown", pose: "resting", sc: 0.32 },
|
{ place: "meadow:Brown", enc: "meadow-Brown", colour: "Brown", pose: "sitting", sc: 0.32 },
|
||||||
{ place: "meadow:Blue", enc: "meadow-Blue", colour: "Blue", pose: "sitting", sc: 0.32 },
|
{ place: "meadow:Blue", enc: "meadow-Blue", colour: "Blue", pose: "coiled", sc: 0.32 },
|
||||||
];
|
];
|
||||||
const FIRST_POSE = { Red: "roaring", Brown: "sitting", Green: "prowling", Orange: "flying" };
|
const FIRST_POSE = { Red: "roaring", Brown: "sitting", Green: "prowling", Orange: "flying" };
|
||||||
Object.keys(L).filter((k) => k.startsWith("see:")).forEach((k) => {
|
Object.keys(L).filter((k) => k.startsWith("see:")).forEach((k) => {
|
||||||
@@ -85,7 +87,7 @@
|
|||||||
const st = {
|
const st = {
|
||||||
point: null, // a place picked before any dragon: show the best way from there to every dragon
|
point: null, // a place picked before any dragon: show the best way from there to every dragon
|
||||||
policy: null, runs: null, counts: {}, colour: null, focus: null, expanded: null, over: {},
|
policy: null, runs: null, counts: {}, colour: null, focus: null, expanded: null, over: {},
|
||||||
objective: "eventually", sample: "all", traffic: false, cache: new Map(), pendingHash: null, info: null,
|
objective: "eventually", sample: "all", traffic: false, layers: {}, paths: null, cache: new Map(), pendingHash: null, info: null,
|
||||||
};
|
};
|
||||||
const model = () => st.policy.samples[st.sample];
|
const model = () => st.policy.samples[st.sample];
|
||||||
function advisorFor(enc, colour = st.colour) {
|
function advisorFor(enc, colour = st.colour) {
|
||||||
@@ -342,8 +344,8 @@
|
|||||||
"aria-label": sp.first ? `${sp.colour} dragon, first sighting` : `${ENC_NAME[sp.enc]}. Show the routes to it.` }, g);
|
"aria-label": sp.first ? `${sp.colour} dragon, first sighting` : `${ENC_NAME[sp.enc]}. Show the routes to it.` }, g);
|
||||||
if (isTarget && routesOn) el("ellipse", { cx: 100, cy: 140, rx: 80, ry: 16, fill: INK[sp.colour], "fill-opacity": 0.25 }, gg);
|
if (isTarget && routesOn) el("ellipse", { cx: 100, cy: 140, rx: 80, ry: 16, fill: INK[sp.colour], "fill-opacity": 0.25 }, gg);
|
||||||
// a soft paper-coloured halo keeps dark dragons readable on the dark canopy
|
// a soft paper-coloured halo keeps dark dragons readable on the dark canopy
|
||||||
gg.innerHTML += `<g stroke="${PAPER.halo}" stroke-width="9" stroke-linejoin="round" opacity="0.55">${D.svg(sp.pose, { fill: PAPER.halo, eyeFill: PAPER.halo, flip: sp.flip })}</g>`;
|
gg.innerHTML += `<g stroke="${PAPER.halo}" stroke-width="9" stroke-linejoin="round" opacity="0.55">${D.svg(sp.pose, { fill: PAPER.halo, eyeFill: PAPER.halo, flip: sp.flip, lines: false })}</g>`;
|
||||||
gg.innerHTML += D.svg(sp.pose, { fill: INK[sp.colour], flip: sp.flip });
|
gg.innerHTML += D.svg(sp.pose, sp.colour === "Black" ? { dark: true, outline: "#3a2a44", flip: sp.flip } : { fill: INK[sp.colour], flip: sp.flip, lineOpacity: 0.5, outline: "#1b0811", outlineOpacity: 0.55, outlineWidth: 1.1 });
|
||||||
el("rect", { x: 0, y: 0, width: 200, height: 160, fill: "transparent" }, gg);
|
el("rect", { x: 0, y: 0, width: 200, height: 160, fill: "transparent" }, gg);
|
||||||
if (sp.twin) return;
|
if (sp.twin) return;
|
||||||
const tipHtml = () => {
|
const tipHtml = () => {
|
||||||
@@ -418,6 +420,22 @@
|
|||||||
hit.addEventListener("keydown", (e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); go(); } });
|
hit.addEventListener("keydown", (e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); go(); } });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// every other choice point (the bully fight's endings, the wounded cadet's, the forks, who you enter with) is a
|
||||||
|
// small dot you can click too; its name shows on hover, and in full once it is picked or its moment is open
|
||||||
|
if (!st.colour && st.policy) {
|
||||||
|
Object.keys(POINTS).forEach((id) => {
|
||||||
|
const P = L[id];
|
||||||
|
if (!P || P.kind === "dragon" || ids.has(id)) return;
|
||||||
|
const name = LANDMARK_NAME[id] || P.name || id;
|
||||||
|
const hit = el("g", { class: "ex-place ex-minor", tabindex: 0, role: "button", "aria-label": `${name}: show the best way from here to every dragon` }, g);
|
||||||
|
el("circle", { cx: P.x, cy: P.y, r: 10, fill: "transparent" }, hit);
|
||||||
|
el("circle", { cx: P.x, cy: P.y, r: 3.6, fill: PAPER.halo, stroke: PAPER.ink, "stroke-width": 1.6, "stroke-opacity": 0.85 }, hit);
|
||||||
|
el("title", {}, hit).textContent = `${name}${P.desc ? `: ${P.desc}` : ""} Click for the best way from here to every dragon.`;
|
||||||
|
const go = () => { st.point = id; st.info = null; writeHash(); render(); };
|
||||||
|
hit.addEventListener("click", go);
|
||||||
|
hit.addEventListener("keydown", (e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); go(); } });
|
||||||
|
});
|
||||||
|
}
|
||||||
const gt = el("text", { x: GATE.x, y: GATE.y + 14, "text-anchor": "middle", "font-size": 11, "letter-spacing": "0.16em", fill: PAPER.ink, "font-family": "var(--font-label)", "paint-order": "stroke", stroke: PAPER.halo, "stroke-width": 3 }, g);
|
const gt = el("text", { x: GATE.x, y: GATE.y + 14, "text-anchor": "middle", "font-size": 11, "letter-spacing": "0.16em", fill: PAPER.ink, "font-family": "var(--font-label)", "paint-order": "stroke", stroke: PAPER.halo, "stroke-width": 3 }, g);
|
||||||
gt.textContent = "ENTER THE VALLEY";
|
gt.textContent = "ENTER THE VALLEY";
|
||||||
if (!st.colour && st.policy) {
|
if (!st.colour && st.policy) {
|
||||||
@@ -432,8 +450,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// "Show the paths of all riders": one ink per source layer (data/stats.json paths.layers; measures.yaml path_layers),
|
||||||
|
// and one line style per way the runs ended
|
||||||
|
const LAYER_INK = { sheet: "#6b4a33", reported: "#7a4f8f", reddit: "#a8792a", bot: "#28588a", discord: "#5865f2" };
|
||||||
|
const KIND = {
|
||||||
|
lived: { dash: null, cap: "round", label: "survived" },
|
||||||
|
chose: { dash: "11 6", cap: "butt", label: "chose to die" },
|
||||||
|
failed: { dash: "0.1 6", cap: "round", label: "died (failed run)" },
|
||||||
|
};
|
||||||
|
const layerOn = (k) => st.layers[k] !== false; // every layer starts on
|
||||||
|
|
||||||
function drawTraffic(g) {
|
function drawTraffic(g) {
|
||||||
// how many logged runs went from each place to the next (precomputed in data/stats.json)
|
if (st.paths && st.paths.layers) return drawLayers(g, st.paths.layers);
|
||||||
|
// older stats.json: how many logged runs went from each place to the next (precomputed in data/stats.json)
|
||||||
if (!st.edges) return;
|
if (!st.edges) return;
|
||||||
const max = Math.max(1, ...st.edges.map((e) => e[2]));
|
const max = Math.max(1, ...st.edges.map((e) => e[2]));
|
||||||
st.edges.forEach(([a, b, n]) => {
|
st.edges.forEach(([a, b, n]) => {
|
||||||
@@ -442,6 +471,35 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Every source layer that is switched on, side by side in its own ink: solid for runs that survived, dashed for
|
||||||
|
* deliberate deaths, dotted for failed runs, and a mark where the deaths happened. */
|
||||||
|
function drawLayers(g, layers) {
|
||||||
|
const shown = layers.filter((l) => l.runs && layerOn(l.key) && l.lines);
|
||||||
|
const all = shown.flatMap((l) => Object.values(l.lines).flatMap((es) => es.map((e) => e[2])));
|
||||||
|
const max = Math.max(1, ...all);
|
||||||
|
shown.forEach((l, i) => {
|
||||||
|
const base = (i - (shown.length - 1) / 2) * 9, ink = LAYER_INK[l.key] || "#6b4a33";
|
||||||
|
["lived", "chose", "failed"].forEach((k, j) => {
|
||||||
|
const off = base + (j - 1) * 3, kd = KIND[k];
|
||||||
|
(l.lines[k] || []).forEach(([a, b, n]) => {
|
||||||
|
if (!L[a] || !L[b]) return;
|
||||||
|
const w = 1.2 + 14 * Math.sqrt(n / max);
|
||||||
|
el("path", { d: curve(L[a], L[b], 0.05, off), fill: "none", stroke: ink, "stroke-opacity": k === "lived" ? 0.36 : 0.6,
|
||||||
|
"stroke-width": k === "failed" ? Math.max(2.2, w) : w, "stroke-linecap": kd.cap, "stroke-dasharray": kd.dash }, g);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
// where the deaths happened: one mark per place, sized by the deaths there
|
||||||
|
const ends = {};
|
||||||
|
["chose", "failed"].forEach((k) => Object.entries((l.ends || {})[k] || {}).forEach(([p, n]) => (ends[p] = (ends[p] || 0) + n)));
|
||||||
|
const emax = Math.max(1, ...Object.values(ends));
|
||||||
|
Object.entries(ends).forEach(([p, n]) => {
|
||||||
|
if (!L[p]) return;
|
||||||
|
const r = 2.5 + 9 * Math.sqrt(n / emax), x = L[p].x + base, y = L[p].y;
|
||||||
|
el("path", { d: `M${x - r * 0.6},${y - r * 0.6}L${x + r * 0.6},${y + r * 0.6}M${x + r * 0.6},${y - r * 0.6}L${x - r * 0.6},${y + r * 0.6}`, stroke: ink, "stroke-width": 2, "stroke-opacity": 0.8 }, g);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function drawRoutes(gRoute, gLab, routes) {
|
function drawRoutes(gRoute, gLab, routes) {
|
||||||
const best = Math.max(1e-12, ...routes.map((r) => r.value.x));
|
const best = Math.max(1e-12, ...routes.map((r) => r.value.x));
|
||||||
const onRoute = new Set();
|
const onRoute = new Set();
|
||||||
@@ -632,9 +690,20 @@
|
|||||||
const hideTip = () => { const t = $("#ex-tip"); if (t) t.hidden = true; };
|
const hideTip = () => { const t = $("#ex-tip"); if (t) t.hidden = true; };
|
||||||
|
|
||||||
/* ---------- panel ---------- */
|
/* ---------- panel ---------- */
|
||||||
const mini = (c, pose = "sitting") => `<svg viewBox="0 0 200 160" aria-hidden="true">${D.svg(pose, { fill: `var(${DV[c]})`, eyeFill: "var(--bg)" })}</svg>`;
|
const mini = (c, pose = "sitting") => `<svg viewBox="0 0 200 160" aria-hidden="true">${D.svg(pose, { fill: `var(${DV[c]})`, eyeFill: "var(--bg)", dark: c === "Black" })}</svg>`;
|
||||||
const POSE_OF = { Red: "roaring", Orange: "flying", Brown: "resting", Green: "prowling", Blue: "coiled", Black: "flying" };
|
const POSE_OF = { Red: "roaring", Orange: "flying", Brown: "sitting", Green: "prowling", Blue: "coiled", Black: "resting" };
|
||||||
const trafficToggle = () => `<label class="ex-toggle"><input type="checkbox" id="ex-traffic"${st.traffic ? " checked" : ""}> Show where riders actually went</label>`;
|
const UNROUTED = { "reddit thread": "Reddit result pages", register: "the Dragon Register" };
|
||||||
|
function trafficToggle() {
|
||||||
|
const box = `<label class="ex-toggle"><input type="checkbox" id="ex-traffic"${st.traffic ? " checked" : ""}> Show the paths of all riders</label>`;
|
||||||
|
if (!st.traffic || !st.paths || !st.paths.layers || !st.paths.layers.some((l) => l.lines)) return box;
|
||||||
|
const rows = st.paths.layers.map((l) => `<label class="ex-layer${l.runs ? "" : " none"}"><input type="checkbox" data-layer="${esc(l.key)}"${l.runs && layerOn(l.key) ? " checked" : ""}${l.runs ? "" : " disabled"}>
|
||||||
|
<span class="sw" style="--sw: ${LAYER_INK[l.key] || "#6b4a33"}"></span><span>${esc(l.label)}</span><span class="n">${l.runs ? l.runs.toLocaleString() : "none yet"}</span></label>`).join("");
|
||||||
|
const key = Object.values(KIND).map((kd) => `<span class="ex-kind"><svg viewBox="0 0 34 8" aria-hidden="true"><path d="M3 4H31" stroke="currentColor" stroke-width="2.6" stroke-linecap="${kd.cap}"${kd.dash ? ` stroke-dasharray="${kd.dash === "11 6" ? "8 4" : "0.1 5"}"` : ""}/></svg>${kd.label}</span>`).join("");
|
||||||
|
const un = Object.entries(st.paths.unrouted || {}).filter(([, n]) => n).map(([s, n]) => `${n.toLocaleString()} from ${esc(UNROUTED[s] || s)}`);
|
||||||
|
return `${box}<div class="ex-layers" role="group" aria-label="Which riders' paths to show">${rows}
|
||||||
|
<div class="ex-kinds">${key}</div>
|
||||||
|
<p class="small muted">Each source in its own colour; line width is how many runs took each step, and ✕ marks where runs died.${un.length ? ` Not drawn (they record the dragon, not the route): ${un.join(", ")}.` : ""}</p></div>`;
|
||||||
|
}
|
||||||
function chooser() {
|
function chooser() {
|
||||||
return `<div class="ex-choose">${COLOURS.map((c) => `<button type="button" class="ex-dchip" data-c="${c}" aria-pressed="${st.colour === c}" style="--c: var(${DV[c]})">${mini(c, POSE_OF[c])}<span>${c}</span></button>`).join("")}</div>`;
|
return `<div class="ex-choose">${COLOURS.map((c) => `<button type="button" class="ex-dchip" data-c="${c}" aria-pressed="${st.colour === c}" style="--c: var(${DV[c]})">${mini(c, POSE_OF[c])}<span>${c}</span></button>`).join("")}</div>`;
|
||||||
}
|
}
|
||||||
@@ -684,6 +753,37 @@
|
|||||||
${trafficToggle()}`;
|
${trafficToggle()}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Inside the bonding encounter: the answers the bot gave, screen by screen, on its best logged way to bond this
|
||||||
|
* colour (data/tree.json, analysis/tree/build_tree.py), with what every other answer did. Only shown when the bot's
|
||||||
|
* way goes through the same encounter as the route; the community form does not record these answers. */
|
||||||
|
const TREE_SIDE = (enc) => (/^(valley|meadow)-/.test(enc) ? "valley" : "tree");
|
||||||
|
function encounterAnswers(enc) {
|
||||||
|
const t = st.tree;
|
||||||
|
if (!t) return '<p class="small muted ex-inside">Loading the answers inside the encounter…</p>';
|
||||||
|
const best = (t.best || {})[st.colour];
|
||||||
|
const picks = best && best.picks && best.picks.length ? best.picks : null;
|
||||||
|
const hourAt = picks ? picks.findIndex((p) => (t.screens[p.screen] || {}).stage === "THORN_WALK") : -1;
|
||||||
|
const side = hourAt >= 0 && /valley/i.test(picks[hourAt].text) ? "valley" : "tree";
|
||||||
|
const viaShadow = picks && picks.some((p) => /shadow/i.test(p.text) && !/descend/i.test(p.text));
|
||||||
|
const fits = picks && hourAt >= 0 && side === TREE_SIDE(enc) && (enc.startsWith("shadow-") ? viaShadow : !viaShadow || side === "valley");
|
||||||
|
if (!fits) return `<p class="small muted ex-inside">The bot hasn't bonded a ${st.colour} through ${esc(ENC_NAME[enc] || enc)} yet, so the answers inside this encounter aren't mapped. The community form records only how the encounter ended, not the answers given.</p>`;
|
||||||
|
const died = (o) => (o.to && o.to.DIED ? o.to.DIED.n : 0);
|
||||||
|
const rows = picks.slice(hourAt + 1).map((p, i) => {
|
||||||
|
const sc = t.screens[p.screen] || { options: {} };
|
||||||
|
const me = sc.options[p.option] || { n: p.n, to: {} };
|
||||||
|
const lived = me.n - died(me);
|
||||||
|
const others = Object.entries(sc.options).filter(([k]) => k !== p.option).map(([, o]) =>
|
||||||
|
`<li>${esc(o.text)} <small>${o.n ? `died ${died(o)} of ${o.n}` : "untested"}</small></li>`).join("");
|
||||||
|
return `<li><span class="n">${i + 1}</span><div><b>${esc(p.text)}</b>
|
||||||
|
<small>${me.n ? `got through ${lived} of ${me.n} times` : ""}${me.kind === "fixed" && me.n ? " · always the same so far" : me.kind === "dice" ? " · a roll" : ""}</small>
|
||||||
|
${others ? `<details><summary>Other answers here</summary><ul>${others}</ul></details>` : ""}</div></li>`;
|
||||||
|
}).join("");
|
||||||
|
const end = Object.keys((t.screens[picks[picks.length - 1].screen] || { options: {} }).options[picks[picks.length - 1].option]?.to || {}).find((k) => k.startsWith("BONDED"));
|
||||||
|
return `<div class="ex-inside"><span class="eyebrow">Inside the encounter: the answers that bonded</span>
|
||||||
|
<ol>${rows}</ol>
|
||||||
|
<p class="small muted">${end ? `Bonded a ${end.split(":")[1]}. ` : ""}From the bot's own runs (it logs every screen it sees), so the counts are small; untested answers may also work.</p></div>`;
|
||||||
|
}
|
||||||
|
|
||||||
function panelRoutes(routes) {
|
function panelRoutes(routes) {
|
||||||
const best = Math.max(1e-12, ...routes.map((r) => r.value.x));
|
const best = Math.max(1e-12, ...routes.map((r) => r.value.x));
|
||||||
const T = model().targets[st.colour], b = T[st.objective];
|
const T = model().targets[st.colour], b = T[st.objective];
|
||||||
@@ -703,7 +803,8 @@
|
|||||||
const open = st.expanded === s.var;
|
const open = st.expanded === s.var;
|
||||||
const opts = open ? `<div class="ex-opts">${Object.entries(s.options).sort((a, c) => c[1].pX - a[1].pX).map(([v, val]) =>
|
const opts = open ? `<div class="ex-opts">${Object.entries(s.options).sort((a, c) => c[1].pX - a[1].pX).map(([v, val]) =>
|
||||||
`<button type="button" class="ex-opt${v === s.taken ? " on" : ""}" data-var="${s.var}" data-v="${esc(v)}"><span>${esc(v)}${v === s.choice ? ' <em class="rec">best</em>' : ""}</span><b>${pct(val.pX)}</b></button>`).join("")}</div>` : "";
|
`<button type="button" class="ex-opt${v === s.taken ? " on" : ""}" data-var="${s.var}" data-v="${esc(v)}"><span>${esc(v)}${v === s.choice ? ' <em class="rec">best</em>' : ""}</span><b>${pct(val.pX)}</b></button>`).join("")}</div>` : "";
|
||||||
return `<li class="dec${open ? " open" : ""}"><button type="button" class="ex-step" data-var="${s.var}" aria-expanded="${open}"><span>${esc(s.label)}</span><b>${esc(String(s.taken))}</b><small>${s.userSet ? "your choice" : "best"} · ${s.var === "encounter" ? pct(s.options[s.taken].pX) : pct(s.options[s.taken].pX)}</small></button>${opts}</li>`;
|
const inside = open && s.var === "encounter" ? encounterAnswers(focus.enc) : "";
|
||||||
|
return `<li class="dec${open ? " open" : ""}"><button type="button" class="ex-step" data-var="${s.var}" aria-expanded="${open}"><span>${esc(s.label)}</span><b>${esc(String(s.taken))}</b><small>${s.userSet ? "your choice" : "best"} · ${s.var === "encounter" ? pct(s.options[s.taken].pX) : pct(s.options[s.taken].pX)}</small></button>${opts}${inside}</li>`;
|
||||||
}).join("");
|
}).join("");
|
||||||
const risks = focus.steps.filter((s) => s.risk && s.risk.p > 0.0005).map((s) => `${s.risk.label.toLowerCase()} ${pct(s.risk.p)}`);
|
const risks = focus.steps.filter((s) => s.risk && s.risk.p > 0.0005).map((s) => `${s.risk.label.toLowerCase()} ${pct(s.risk.p)}`);
|
||||||
const lb = st.policy.samples.lowBias.targets[st.colour].thisAttempt;
|
const lb = st.policy.samples.lowBias.targets[st.colour].thisAttempt;
|
||||||
@@ -735,6 +836,7 @@
|
|||||||
$$("[data-o]", p).forEach((b) => b.addEventListener("click", () => { st.objective = b.dataset.o; render(); }));
|
$$("[data-o]", p).forEach((b) => b.addEventListener("click", () => { st.objective = b.dataset.o; render(); }));
|
||||||
$$("[data-s]", p).forEach((b) => b.addEventListener("click", () => { st.sample = b.dataset.s; render(); }));
|
$$("[data-s]", p).forEach((b) => b.addEventListener("click", () => { st.sample = b.dataset.s; render(); }));
|
||||||
const tr = $("#ex-traffic", p); if (tr) tr.addEventListener("change", () => { st.traffic = tr.checked; render(); });
|
const tr = $("#ex-traffic", p); if (tr) tr.addEventListener("change", () => { st.traffic = tr.checked; render(); });
|
||||||
|
$$("[data-layer]", p).forEach((b) => b.addEventListener("change", () => { st.layers[b.dataset.layer] = b.checked; render(); }));
|
||||||
const cl = $("#ex-clear", p); if (cl) cl.addEventListener("click", () => select(null));
|
const cl = $("#ex-clear", p); if (cl) cl.addEventListener("click", () => select(null));
|
||||||
$$("[data-pt]", p).forEach((b) => b.addEventListener("click", () => { st.point = b.dataset.pt; writeHash(); render(); }));
|
$$("[data-pt]", p).forEach((b) => b.addEventListener("click", () => { st.point = b.dataset.pt; writeHash(); render(); }));
|
||||||
const cp = $("#ex-clear-point", p); if (cp) cp.addEventListener("click", () => { st.point = null; writeHash(); render(); });
|
const cp = $("#ex-clear-point", p); if (cp) cp.addEventListener("click", () => { st.point = null; writeHash(); render(); });
|
||||||
@@ -846,7 +948,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** The runs selected on the page (one preset of data/stats.json): how many reached each place, and each step. */
|
/** The runs selected on the page (one preset of data/stats.json): how many reached each place, and each step. */
|
||||||
function setStats(P) {
|
function setStats(P, paths) {
|
||||||
|
if (paths) st.paths = paths;
|
||||||
st.nRuns = P.analyse.n;
|
st.nRuns = P.analyse.n;
|
||||||
st.counts = P.valley.counts;
|
st.counts = P.valley.counts;
|
||||||
st.edges = P.valley.edges;
|
st.edges = P.valley.edges;
|
||||||
@@ -855,6 +958,8 @@
|
|||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
render();
|
render();
|
||||||
|
// the screen tree (the answers inside each encounter), for the "Bonding encounter" step
|
||||||
|
fetch("data/tree.json").then((r) => r.json()).then((t) => { st.tree = t; if (st.expanded === "encounter") render(); }).catch(() => { st.tree = { best: {}, screens: {} }; });
|
||||||
fetch("data/policy.json").then((r) => r.json()).then((p) => {
|
fetch("data/policy.json").then((r) => r.json()).then((p) => {
|
||||||
st.policy = p;
|
st.policy = p;
|
||||||
S.useGame(p.samples.all); // the game (and where each colour can be bonded) comes with the route model
|
S.useGame(p.samples.all); // the game (and where each colour can be bonded) comes with the route model
|
||||||
|
|||||||
+29
-11
@@ -338,6 +338,22 @@ footer { border-top-color: var(--line); }
|
|||||||
.ex-dchip[aria-pressed="true"] { background: color-mix(in srgb, var(--c) 22%, var(--raised)); box-shadow: 0 0 14px color-mix(in srgb, var(--c) 35%, transparent), inset 0 0 0 1px var(--c); }
|
.ex-dchip[aria-pressed="true"] { background: color-mix(in srgb, var(--c) 22%, var(--raised)); box-shadow: 0 0 14px color-mix(in srgb, var(--c) 35%, transparent), inset 0 0 0 1px var(--c); }
|
||||||
.ex-card { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--raised); }
|
.ex-card { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--raised); }
|
||||||
.ex-toggle { display: flex; gap: 8px; align-items: center; font-size: var(--step--1); color: var(--muted); }
|
.ex-toggle { display: flex; gap: 8px; align-items: center; font-size: var(--step--1); color: var(--muted); }
|
||||||
|
.ex-layers { display: grid; gap: 4px; margin: 4px 0 0 24px; }
|
||||||
|
.ex-layer { display: grid; grid-template-columns: auto 22px minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: var(--step--1); color: inherit; cursor: pointer; }
|
||||||
|
.ex-layer.none { color: var(--muted); cursor: default; }
|
||||||
|
.ex-layer .sw { height: 0; border-top: 4px solid var(--sw); border-radius: 2px; }
|
||||||
|
.ex-layer .n { color: var(--muted); font-variant-numeric: tabular-nums; }
|
||||||
|
.ex-kinds { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: var(--step--1); color: var(--muted); }
|
||||||
|
.ex-kind { display: inline-flex; align-items: center; gap: 6px; }
|
||||||
|
.ex-kind svg { width: 34px; height: 8px; }
|
||||||
|
.ex-inside { margin: 10px 0 4px; padding: 10px 12px; border-left: 2px solid var(--c, var(--accent)); background: color-mix(in srgb, var(--bg) 70%, transparent); border-radius: 0 8px 8px 0; }
|
||||||
|
.ex-inside ol { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 8px; }
|
||||||
|
.ex-inside ol > li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; align-items: start; }
|
||||||
|
.ex-inside .n { font-family: var(--font-display); color: var(--muted); text-align: right; }
|
||||||
|
.ex-inside b { display: block; font-weight: 600; }
|
||||||
|
.ex-inside small { color: var(--muted); }
|
||||||
|
.ex-inside details summary { cursor: pointer; font-size: var(--step--1); color: var(--muted); }
|
||||||
|
.ex-inside ul { margin: 4px 0 0 16px; padding: 0; font-size: var(--step--1); }
|
||||||
.ex-head { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
|
.ex-head { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
|
||||||
.ex-head svg { width: 64px; height: 52px; }
|
.ex-head svg { width: 64px; height: 52px; }
|
||||||
.ex-head h2 { color: var(--c); }
|
.ex-head h2 { color: var(--c); }
|
||||||
@@ -461,11 +477,12 @@ a { color: var(--accent); text-underline-offset: 2px; }
|
|||||||
</section>
|
</section>
|
||||||
<section aria-labelledby="h-journey">
|
<section aria-labelledby="h-journey">
|
||||||
<div class="section-head">
|
<div class="section-head">
|
||||||
<span class="eyebrow">Seven steps, two of them pure luck</span>
|
<span class="eyebrow">Seven steps, and the rolls remember what you did</span>
|
||||||
<h2 id="h-journey">How a run unfolds</h2>
|
<h2 id="h-journey">How a run unfolds</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="journey" id="journey"></div>
|
<div class="journey" id="journey"></div>
|
||||||
<p class="lore">In the books, first-years who survive to Threshing walk into a valley of unbonded dragons, and the dragons do the choosing. The <a href="https://dragonkind.com" target="_blank" rel="noopener">Dragonkind</a> site recreates that: every choice can end with you incinerated, and the author has said there is a 10% chance of that no matter what you pick.</p>
|
<div class="panel black-panel" id="black-evidence" hidden></div>
|
||||||
|
<p class="lore">In the books, first-years who survive to Threshing walk into a valley of unbonded dragons, and the dragons do the choosing. The <a href="https://dragonkind.com" target="_blank" rel="noopener">Dragonkind</a> site recreates that: every choice can end with you incinerated, and its author has said no single roll is worse than 1 in 20 and that the Black is not luck.</p>
|
||||||
<div class="cta"><button type="button" class="primary" data-go="valley">Walk the valley map</button><button type="button" data-go="deep">Dig into the statistics</button><button type="button" data-go="dragons">Meet the bonded dragons</button></div>
|
<div class="cta"><button type="button" class="primary" data-go="valley">Walk the valley map</button><button type="button" data-go="deep">Dig into the statistics</button><button type="button" data-go="dragons">Meet the bonded dragons</button></div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
@@ -608,7 +625,7 @@ a { color: var(--accent); text-underline-offset: 2px; }
|
|||||||
</section>
|
</section>
|
||||||
<section id="share" aria-labelledby="h-share">
|
<section id="share" aria-labelledby="h-share">
|
||||||
<div class="section-head"><span class="eyebrow">Open by design</span><h2 id="h-share">Share & reproduce</h2>
|
<div class="section-head"><span class="eyebrow">Open by design</span><h2 id="h-share">Share & reproduce</h2>
|
||||||
<p class="muted small">Everything on this page is computed from the community form export by the code in the <a href="https://github.com/ekcSchiano/threshing-atlas" target="_blank" rel="noopener">GitHub repository</a>, which updates the data every day. The rules for reading each answer are in <code>core/spec/form.yaml</code>, the game in <code>core/spec/game.yaml</code>, and what is measured in <code>analysis/stats/measures.yaml</code>.</p></div>
|
<p class="muted small">Everything on this page is computed from the community form export by the code in the <a href="{{repo}}" target="_blank" rel="noopener">repository</a>, which updates the data every day. The rules for reading each answer are in <code>core/spec/form.yaml</code>, the game in <code>core/spec/game.yaml</code>, and what is measured in <code>analysis/stats/measures.yaml</code>.</p></div>
|
||||||
<div class="grid2">
|
<div class="grid2">
|
||||||
<div class="panel"><h3>Copy the outputs</h3>
|
<div class="panel"><h3>Copy the outputs</h3>
|
||||||
<div class="btnrow"><button type="button" id="cp-reddit" class="primary">Copy Reddit post (Markdown)</button><a class="btnlike" href="data/runs_clean.csv" download>Download coded runs (CSV)</a><button type="button" id="cp-json">Copy all results (JSON)</button></div>
|
<div class="btnrow"><button type="button" id="cp-reddit" class="primary">Copy Reddit post (Markdown)</button><a class="btnlike" href="data/runs_clean.csv" download>Download coded runs (CSV)</a><button type="button" id="cp-json">Copy all results (JSON)</button></div>
|
||||||
@@ -691,22 +708,23 @@ adjusted OR = exp(βⱼ), 95% CI = exp(βⱼ ± 1.96·SEⱼ)</div>
|
|||||||
<div class="section-head"><span class="eyebrow">Every run helps</span><h2 id="h-report">Report a run</h2>
|
<div class="section-head"><span class="eyebrow">Every run helps</span><h2 id="h-report">Report a run</h2>
|
||||||
<p class="muted">Every run anyone logs ends up in the Atlas's open data, <a href="data/runs_clean.csv" download>runs_clean.csv</a>, which anyone can download and reuse. Deaths are as useful as bonds: the odds on this page are only as good as the runs behind them. Please report each run in one place only.</p></div>
|
<p class="muted">Every run anyone logs ends up in the Atlas's open data, <a href="data/runs_clean.csv" download>runs_clean.csv</a>, which anyone can download and reuse. Deaths are as useful as bonds: the odds on this page are only as good as the runs behind them. Please report each run in one place only.</p></div>
|
||||||
<div class="grid2">
|
<div class="grid2">
|
||||||
<div class="panel"><h3>Report it on the Atlas</h3>
|
<div class="panel"><h3>Use the community form</h3>
|
||||||
<p class="small">A short form with the game's own choices (a GitHub issue, so you need a free GitHub account). Reports show up in the data the next day with the source <b>reported</b>. Reports are public: please leave out your account name.</p>
|
<p class="small">The easiest way, no account needed. The r/fourthwing megathreads collect runs with u/ClumsyBadger's Google Form, and its answers go into a public spreadsheet. The Atlas reads that spreadsheet every day (source <b>reddit spreadsheet</b>), so a run logged there is counted here.</p>
|
||||||
<p><a class="btnlike primary" href="https://github.com/ekcSchiano/threshing-atlas/issues/new?template=report-a-run.yml" target="_blank" rel="noopener">Report a run</a></p>
|
|
||||||
</div>
|
|
||||||
<div class="panel"><h3>Or use the community form</h3>
|
|
||||||
<p class="small">The r/fourthwing megathreads collect runs with u/ClumsyBadger's Google Form, and its answers go into a public spreadsheet. The Atlas reads that spreadsheet every day (source <b>reddit spreadsheet</b>), so a run logged there is counted here too.</p>
|
|
||||||
<p class="btnrow"><a class="btnlike primary" href="https://forms.gle/DRpj9tG8gb5E4Hcu7" target="_blank" rel="noopener">Threshing Routes form</a>
|
<p class="btnrow"><a class="btnlike primary" href="https://forms.gle/DRpj9tG8gb5E4Hcu7" target="_blank" rel="noopener">Threshing Routes form</a>
|
||||||
<a class="btnlike" href="https://docs.google.com/spreadsheets/d/1gnw1AdRg1XT4JsOfRM6QTA0jSaS3n9ZF-rPWnYewzv0" target="_blank" rel="noopener">The responses spreadsheet</a>
|
<a class="btnlike" href="https://docs.google.com/spreadsheets/d/1gnw1AdRg1XT4JsOfRM6QTA0jSaS3n9ZF-rPWnYewzv0" target="_blank" rel="noopener">The responses spreadsheet</a>
|
||||||
<a class="btnlike" href="https://www.reddit.com/r/fourthwing/comments/1wz5cnj/" target="_blank" rel="noopener">The megathread</a></p>
|
<a class="btnlike" href="https://www.reddit.com/r/fourthwing/comments/1wz5cnj/" target="_blank" rel="noopener">The megathread</a></p>
|
||||||
<p class="small muted">The form is anonymous and can be filled in once per attempt. Its author asks for random runs too (just pick the top option each time): they show which choices matter without the bias of everyone copying the same "best" route.</p>
|
<p class="small muted">The form is anonymous and can be filled in once per attempt. Its author asks for random runs too (just pick the top option each time): they show which choices matter without the bias of everyone copying the same "best" route.</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="panel"><h3>Or report it on the Atlas</h3>
|
||||||
|
<p class="small">A short form with the game's own choices: an issue on the Atlas's repository at {{host}}, so you need an account there. Reports show up in the data the next day with the source <b>reported</b>. Everyone who can see the repository can read reports: please leave out your account name.</p>
|
||||||
|
<p><a class="btnlike" href="{{report}}" target="_blank" rel="noopener">Report a run on {{host}}</a></p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel"><h3>Where the Atlas's runs come from</h3>
|
<div class="panel"><h3>Where the Atlas's runs come from</h3>
|
||||||
<table class="small"><thead><tr><th scope="col">Source</th><th scope="col">What it is</th></tr></thead><tbody>
|
<table class="small"><thead><tr><th scope="col">Source</th><th scope="col">What it is</th></tr></thead><tbody>
|
||||||
<tr><td>reddit spreadsheet</td><td>The community form and spreadsheet linked from the r/fourthwing megathreads.</td></tr>
|
<tr><td>reddit spreadsheet</td><td>The community form and spreadsheet linked from the r/fourthwing megathreads.</td></tr>
|
||||||
<tr><td>reported</td><td>Runs reported here, with "Report a run".</td></tr>
|
<tr><td>reported</td><td>Runs reported here, with "Report a run".</td></tr>
|
||||||
|
<tr><td>register</td><td>The Unofficial Dragon Register: which dragon each rider bonded (no route).</td></tr>
|
||||||
<tr><td>reddit thread</td><td>Dragonkind result pages posted in the megathreads (the dragon is known, the route is not).</td></tr>
|
<tr><td>reddit thread</td><td>Dragonkind result pages posted in the megathreads (the dragon is known, the route is not).</td></tr>
|
||||||
<tr><td>bot</td><td>Runs logged by the DragonKind bot.</td></tr>
|
<tr><td>bot</td><td>Runs logged by the DragonKind bot.</td></tr>
|
||||||
<tr><td>reddit pdf</td><td>The community route PDF: a map of the choices, used to check the game's routes (it holds no runs).</td></tr>
|
<tr><td>reddit pdf</td><td>The community route PDF: a map of the choices, used to check the game's routes (it holds no runs).</td></tr>
|
||||||
@@ -717,8 +735,8 @@ adjusted OR = exp(βⱼ), 95% CI = exp(βⱼ ± 1.96·SEⱼ)</div>
|
|||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
<footer><div class="wrap"><p><b>Data:</b> the community <a href="https://docs.google.com/spreadsheets/d/1gnw1AdRg1XT4JsOfRM6QTA0jSaS3n9ZF-rPWnYewzv0" target="_blank" rel="noopener">"Threshing Routes" responses</a> compiled by <a href="https://www.reddit.com/user/ClumsyBadger/" target="_blank" rel="noopener">u/ClumsyBadger</a>, with percentages in the <a href="https://drive.google.com/file/d/17o72ehHsSPW4UdsKF-sXTxMLEuinWeEg/view" target="_blank" rel="noopener">route PDF</a> by <a href="https://www.reddit.com/user/ClumsyBadger/" target="_blank" rel="noopener">u/ClumsyBadger</a>, <a href="https://www.reddit.com/user/Old_Regular3018/" target="_blank" rel="noopener">u/Old_Regular3018</a> and <a href="https://www.reddit.com/user/Smart_Trifle_2099/" target="_blank" rel="noopener">u/Smart_Trifle_2099</a>; the <a href="https://docs.google.com/spreadsheets/d/1KMiE9sec0l597Pzue1OhGYf07NF4howtQ_lPeqx7jXQ" target="_blank" rel="noopener">Unofficial Dragon Register</a>; and the r/fourthwing bonding megathreads (<a href="https://www.reddit.com/r/fourthwing/comments/1wvwfp9/" target="_blank" rel="noopener">Part 3</a>, <a href="https://www.reddit.com/r/fourthwing/comments/1wz5cnj/" target="_blank" rel="noopener">Part 4</a>). Code and data: <a href="https://github.com/ekcSchiano/threshing-atlas" target="_blank" rel="noopener">github.com/ekcSchiano/threshing-atlas</a> (MIT, data CC BY 4.0).</p>
|
<footer><div class="wrap"><p><b>Data:</b> the community <a href="https://docs.google.com/spreadsheets/d/1gnw1AdRg1XT4JsOfRM6QTA0jSaS3n9ZF-rPWnYewzv0" target="_blank" rel="noopener">"Threshing Routes" responses</a> compiled by <a href="https://www.reddit.com/user/ClumsyBadger/" target="_blank" rel="noopener">u/ClumsyBadger</a>, with percentages in the <a href="https://drive.google.com/file/d/17o72ehHsSPW4UdsKF-sXTxMLEuinWeEg/view" target="_blank" rel="noopener">route PDF</a> by <a href="https://www.reddit.com/user/ClumsyBadger/" target="_blank" rel="noopener">u/ClumsyBadger</a>, <a href="https://www.reddit.com/user/Old_Regular3018/" target="_blank" rel="noopener">u/Old_Regular3018</a> and <a href="https://www.reddit.com/user/Smart_Trifle_2099/" target="_blank" rel="noopener">u/Smart_Trifle_2099</a>; the <a href="https://docs.google.com/spreadsheets/d/1KMiE9sec0l597Pzue1OhGYf07NF4howtQ_lPeqx7jXQ" target="_blank" rel="noopener">Unofficial Dragon Register</a>; and the r/fourthwing bonding megathreads (<a href="https://www.reddit.com/r/fourthwing/comments/1wvwfp9/" target="_blank" rel="noopener">Part 3</a>, <a href="https://www.reddit.com/r/fourthwing/comments/1wz5cnj/" target="_blank" rel="noopener">Part 4</a>). Code and data: <a href="{{repo}}" target="_blank" rel="noopener">{{repo_label}}</a> (MIT, data CC BY 4.0).</p>
|
||||||
<p><b>Unofficial fan analysis,</b> not affiliated with <a href="https://dragonkind.com" target="_blank" rel="noopener">Dragonkind</a> or its authors. A 10% "chaos" chance of incineration on any choice has been described by the author, so <b>no route guarantees a bond</b>.</p></div></footer>
|
<p><b>Unofficial fan analysis,</b> not affiliated with <a href="https://dragonkind.com" target="_blank" rel="noopener">Dragonkind</a> or its authors. The author has said no single roll is worse than 1 in 20 and that the Black is not luck, but <b>no route guarantees a bond</b>.</p></div></footer>
|
||||||
<div id="tip" hidden></div>
|
<div id="tip" hidden></div>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
|
||||||
<script src="solver.js"></script>
|
<script src="solver.js"></script>
|
||||||
|
|||||||
@@ -197,7 +197,7 @@
|
|||||||
} catch (err) { opts.toast("That file could not be read. Export the register sheet as .xlsx or .csv."); console.error(err); }
|
} catch (err) { opts.toast("That file could not be read. Export the register sheet as .xlsx or .csv."); console.error(err); }
|
||||||
e.target.value = "";
|
e.target.value = "";
|
||||||
});
|
});
|
||||||
fetch("data/register.json").then((r) => r.json()).then((raw) => { st.bundled = raw; load(raw, `bundled snapshot (${raw.source_file}, exported ${raw.exported})`); })
|
fetch("data/register.json").then((r) => r.json()).then((raw) => { st.bundled = raw; load(raw, `bundled snapshot (${raw.source}, exported ${raw.exported})`); })
|
||||||
.catch((e) => ($("#reg-status").textContent = "The register data could not load."));
|
.catch((e) => ($("#reg-status").textContent = "The register data could not load."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+38
-11
@@ -148,27 +148,54 @@
|
|||||||
const getPolicy = () => policyP || (policyP = fetch("data/policy.json").then((r) => r.json()).catch(() => null));
|
const getPolicy = () => policyP || (policyP = fetch("data/policy.json").then((r) => r.json()).catch(() => null));
|
||||||
const ENC_OF = { Red: "valley-Red", Orange: "meadow-Orange", Brown: "meadow-Brown", Green: "tree-Greens", Blue: "meadow-Blue", Black: "shadow-Black" };
|
const ENC_OF = { Red: "valley-Red", Orange: "meadow-Orange", Brown: "meadow-Brown", Green: "tree-Greens", Blue: "meadow-Blue", Black: "shadow-Black" };
|
||||||
const ENC_LABEL = { "valley-Red": "the valley Red", "meadow-Orange": "the meadow Orange", "meadow-Brown": "the meadow Brown", "tree-Greens": "the two Greens", "meadow-Blue": "the meadow Blue", "shadow-Black": "the Black after the shadow" };
|
const ENC_LABEL = { "valley-Red": "the valley Red", "meadow-Orange": "the meadow Orange", "meadow-Brown": "the meadow Brown", "tree-Greens": "the two Greens", "meadow-Blue": "the meadow Blue", "shadow-Black": "the Black after the shadow" };
|
||||||
const POSE = { Red: "roaring", Orange: "flying", Brown: "resting", Green: "prowling", Blue: "coiled", Black: "flying" };
|
const POSE = { Red: "roaring", Orange: "flying", Brown: "sitting", Green: "prowling", Blue: "coiled", Black: "resting" };
|
||||||
|
|
||||||
|
let blackP = null;
|
||||||
|
const getBlack = () => blackP || (blackP = fetch("data/black.json").then((r) => r.json()).catch(() => null));
|
||||||
|
const frac = ([k, n]) => `${k.toLocaleString()} of ${n.toLocaleString()}`;
|
||||||
|
// The shadow and the Black: what analysis/black/evidence.py found (data/black.json; the full write-up is BLACK.md).
|
||||||
|
function renderBlack(b) {
|
||||||
|
const t2 = $("#truth-history"), box = $("#black-evidence");
|
||||||
|
if (!b) { if (t2) t2.innerHTML = '<h3>Your first attempt is different</h3><p class="small muted">The shadow evidence could not be loaded.</p>'; return; }
|
||||||
|
const ff = b.form_first, fl = b.form_later, sr = b.same_route, as = b.after_shadow, gaze = as.answers["held its gaze"];
|
||||||
|
if (t2) t2.innerHTML = `<h3>Your first attempt is different</h3><p class="small">Among riders who helped their squadmate and climbed the tree, the shadow came in <b>${frac(ff)}</b> first attempts (${pct(ff[0] / ff[1], 1)}) and <b>${frac(fl)}</b> later ones. On the very same routes, first attempts saw it about ${Math.round(sr.first_shadows / Math.max(sr.expected, 1) * 10) / 10}× as often as chance would give. The shadow is not a dice roll you can repeat.</p>`;
|
||||||
|
if (!box) return;
|
||||||
|
const br = b.best_route;
|
||||||
|
box.hidden = false;
|
||||||
|
box.innerHTML = `<h3>The Black is not dice</h3>
|
||||||
|
<p class="small">The game's author has said the Black is not luck, and the runs agree. The shadow at the tree needs three things: you <b>investigated and helped</b> your squadmate, you <b>climbed the tree</b>, and it is (almost always) your <b>first attempt</b>. ${b.shadow_routes.runs} shadow runs came from ${b.shadow_routes.routes} different routes, so no single route is the trick; only ${b.shadow_routes.off_gate} were logged off that path.</p>
|
||||||
|
<ul class="small">
|
||||||
|
<li>Best-logged route (${esc(br.route.join(" → "))}): shadow in <b>${frac(br.first)}</b> first attempts, <b>${frac(br.later)}</b> later ones.</li>
|
||||||
|
<li>After the shadow, ${as.reached_black} riders reached the Black and <b>${as.bonded_black}</b> bonded it; ${as.died_at_blue} were burned by the Blue first.</li>
|
||||||
|
${gaze ? `<li>At the Black, riders who held its gaze bonded in <b>${frac(gaze)}</b> logged answers.</li>` : ""}
|
||||||
|
<li>The bot has made ${b.bot.attempts.toLocaleString()} attempts on ${b.bot.accounts} accounts, ${b.bot.gated_tree} on the gated path, and seen the shadow ${b.bot.shadows} times: none of them was a first attempt${b.bot.earliest_attempt ? ` (its earliest was attempt ${b.bot.earliest_attempt})` : ""}, which fits.</li>
|
||||||
|
</ul>
|
||||||
|
<p class="small muted">Method and every table: <code>analysis/reports/BLACK.md</code>; the numbers: <a href="data/black.json">data/black.json</a>.</p>`;
|
||||||
|
}
|
||||||
|
|
||||||
function renderColourOdds(policy) {
|
function renderColourOdds(policy) {
|
||||||
if (!policy) { $("#odds-colours").innerHTML = '<p class="small muted">The route model could not be loaded.</p>'; return; }
|
if (!policy) { $("#odds-colours").innerHTML = '<p class="small muted">The route model could not be loaded.</p>'; return; }
|
||||||
const lb = policy.samples.lowBias, all = policy.samples.all;
|
const lb = policy.samples.lowBias, all = policy.samples.all;
|
||||||
const cols = ["Red", "Green", "Orange", "Brown", "Blue", "Black"]
|
const cols = ["Red", "Green", "Orange", "Brown", "Blue", "Black"]
|
||||||
.map((c) => ({ c, p: lb.targets[c].eventually.pX.mean, pAll: all.targets[c].eventually.pX.mean, lo: lb.targets[c].eventually.pX.lo, hi: lb.targets[c].eventually.pX.hi }))
|
.map((c) => {
|
||||||
|
// the Black only comes after the shadow, and the shadow (almost) only on a first attempt: show that attempt
|
||||||
|
const first = c === "Black" && lb.targets[c].firstAttempt;
|
||||||
|
const src = first ? lb.targets[c].firstAttempt.thisAttempt : lb.targets[c].eventually;
|
||||||
|
const srcAll = first && all.targets[c].firstAttempt ? all.targets[c].firstAttempt.thisAttempt : all.targets[c].eventually;
|
||||||
|
return { c, first: !!first, p: src.pX.mean, pAll: srcAll.pX.mean, lo: src.pX.lo, hi: src.pX.hi };
|
||||||
|
})
|
||||||
.sort((a, b) => b.p - a.p);
|
.sort((a, b) => b.p - a.p);
|
||||||
const enc = (c) => { const e = (all.model.tables.encounter || {})[ENC_OF[c]] || { outcomes: {} }; const n = Object.values(e.outcomes).reduce((a, b) => a + b, 0); return { k: e.outcomes[c] || 0, n }; };
|
const enc = (c) => { const e = (all.model.tables.encounter || {})[ENC_OF[c]] || { outcomes: {} }; const n = Object.values(e.outcomes).reduce((a, b) => a + b, 0); return { k: e.outcomes[c] || 0, n }; };
|
||||||
const art = (c) => window.DragonArt ? `<svg class="odd-art" viewBox="0 0 200 160" aria-hidden="true">${window.DragonArt.svg(POSE[c], { fill: `var(${DV[c]})`, eyeFill: "var(--bg)" })}</svg>` : "";
|
const art = (c) => window.DragonArt ? `<svg class="odd-art" viewBox="0 0 200 160" aria-hidden="true">${window.DragonArt.svg(POSE[c], { fill: `var(${DV[c]})`, eyeFill: "var(--bg)", dark: c === "Black" })}</svg>` : "";
|
||||||
$("#odds-colours").innerHTML = cols.map(({ c, p, pAll, lo, hi }) => {
|
$("#odds-colours").innerHTML = cols.map(({ c, first, p, pAll, lo, hi }) => {
|
||||||
const e = enc(c);
|
const e = enc(c);
|
||||||
return `<a class="odd odd-colour" href="#valley/${c.toLowerCase()}" style="--c: var(${DV[c]})">${art(c)}
|
return `<a class="odd odd-colour" href="#valley/${c.toLowerCase()}" style="--c: var(${DV[c]})">${art(c)}
|
||||||
<span class="big">${p >= 0.5 ? pct(p) : `1 in ${oneIn(p)}`}</span><span class="what">${p >= 0.5 ? "of runs" : "runs"} end bonded to ${/^[AEIOU]/.test(c) ? "an" : "a"} ${c}, on the best route</span>
|
<span class="big">${p >= 0.5 ? pct(p) : `1 in ${oneIn(p)}`}</span><span class="what">${p >= 0.5 ? "of runs" : "runs"} end bonded to ${/^[AEIOU]/.test(c) ? "an" : "a"} ${c}, on the best route${first ? ", on your first attempt" : ""}</span>
|
||||||
${dots(Math.round(p * 1000), 1000, cssVar(DV[c]))}
|
${dots(Math.round(p * 1000), 1000, cssVar(DV[c]))}
|
||||||
<span class="how"><b>${pct(p, p < 0.1 ? 1 : 0)}</b> per attempt (95% ${pct(lo, 1)}–${pct(hi, 1)}), from riders who logged every run${Math.abs(pAll - p) / p > 0.25 ? `; all form posts suggest ${pct(pAll, 1)}` : ""}. At ${ENC_LABEL[ENC_OF[c]]}, <b>${e.k} of ${e.n}</b> genuine attempts bonded.</span>
|
<span class="how"><b>${pct(p, p < 0.1 ? 1 : 0)}</b> ${first ? "on a first attempt" : "per attempt"} (95% ${pct(lo, 1)}–${pct(hi, 1)}), from riders who logged every run${first ? "; later attempts almost never see the shadow" : ""}${Math.abs(pAll - p) / p > 0.25 ? `; all form posts suggest ${pct(pAll, 1)}` : ""}. At ${ENC_LABEL[ENC_OF[c]]}, <b>${e.k} of ${e.n}</b> genuine attempts bonded.</span>
|
||||||
<span class="go">See the route →</span></a>`;
|
<span class="go">See the route →</span></a>`;
|
||||||
}).join("");
|
}).join("");
|
||||||
const meadowAlpha = all.model.alphas.meadow, shadowAlpha = all.model.alphas.shadow;
|
getBlack().then(renderBlack);
|
||||||
const t2 = $("#truth-history");
|
|
||||||
if (t2) t2.innerHTML = `<h3>Earlier choices barely change who waits</h3><p class="small">${meadowAlpha >= 10000 ? "Which dragon waits in the meadow shows no link to anything you chose before." : "Which dragon waits in the meadow depends only a little on earlier choices."} ${shadowAlpha >= 500 ? "The shadow at the tree depends on them only weakly." : "The shadow at the tree shows some dependence on earlier choices, but the evidence is thin."} The model lets every roll depend on your history, and measured how much it does. Choices the form doesn't record (what you answered inside an encounter) might still matter.</p>`;
|
|
||||||
const t3 = $("#truth-burn");
|
const t3 = $("#truth-burn");
|
||||||
if (t3) {
|
if (t3) {
|
||||||
const rates = cols.map(({ c }) => ({ c, ...enc(c) })).filter((x) => x.n >= 20).map((x) => ({ ...x, p: x.k / x.n })).sort((a, b) => a.p - b.p);
|
const rates = cols.map(({ c }) => ({ c, ...enc(c) })).filter((x) => x.n >= 20).map((x) => ({ ...x, p: x.k / x.n })).sort((a, b) => a.p - b.p);
|
||||||
@@ -207,7 +234,7 @@
|
|||||||
{ t: "The scream", d: "Help the squadmate fighting two cadets, walk away, or ignore it and find a wounded cadet.", v: helpK ? `${helpK.n} logged runs died in the fight.` : "" },
|
{ t: "The scream", d: "Help the squadmate fighting two cadets, walk away, or ignore it and find a wounded cadet.", v: helpK ? `${helpK.n} logged runs died in the fight.` : "" },
|
||||||
{ t: "Fork in the road", d: "After the fight: west, deeper into the forest, or east.", v: "Only the bully path has a fork." },
|
{ t: "Fork in the road", d: "After the fight: west, deeper into the forest, or east.", v: "Only the bully path has a fork." },
|
||||||
{ t: "Tree or valley", d: "Climb the tallest tree, or walk to the valley centre.", v: "The tree holds a Red, two Greens and the rare shadow. The valley holds a Red, then the meadow's Orange, Brown and sometimes a Blue." },
|
{ t: "Tree or valley", d: "Climb the tallest tree, or walk to the valley centre.", v: "The tree holds a Red, two Greens and the rare shadow. The valley holds a Red, then the meadow's Orange, Brown and sometimes a Blue." },
|
||||||
{ t: "The bonding", d: "Who is waiting is partly luck. Then every answer is a test.", v: greens.green_encounters ? `At the two Greens, ${pct((greens.rescued_orange + greens.rescued_brown) / greens.green_encounters)} were rescued by an Orange or Brown.` : "", roll: true },
|
{ t: "The bonding", d: "Who is waiting depends on what you did before: the shadow comes only to first-attempt riders who helped and climbed. Then every answer is a test.", v: greens.green_encounters ? `At the two Greens, ${pct((greens.rescued_orange + greens.rescued_brown) / greens.green_encounters)} were rescued by an Orange or Brown.` : "", roll: true },
|
||||||
];
|
];
|
||||||
$("#journey").innerHTML = stops.map((s, i) => `<div class="stop${s.roll ? " roll" : ""}"><span class="n">${["I", "II", "III", "IV", "V", "VI", "VII"][i]}</span><span class="t">${esc(s.t)}</span><span class="d">${esc(s.d)}</span>${s.v ? `<span class="verdict">${esc(s.v)}</span>` : ""}</div>`).join("");
|
$("#journey").innerHTML = stops.map((s, i) => `<div class="stop${s.roll ? " roll" : ""}"><span class="n">${["I", "II", "III", "IV", "V", "VI", "VII"][i]}</span><span class="t">${esc(s.t)}</span><span class="d">${esc(s.d)}</span>${s.v ? `<span class="verdict">${esc(s.v)}</span>` : ""}</div>`).join("");
|
||||||
|
|
||||||
@@ -233,7 +260,7 @@
|
|||||||
window.AtlasUI = {
|
window.AtlasUI = {
|
||||||
render(state) {
|
render(state) {
|
||||||
renderOverview(state);
|
renderOverview(state);
|
||||||
if (window.ValleyExplorer) window.ValleyExplorer.setStats(state.P);
|
if (window.ValleyExplorer) window.ValleyExplorer.setStats(state.P, state.stats && state.stats.paths);
|
||||||
},
|
},
|
||||||
showTab,
|
showTab,
|
||||||
};
|
};
|
||||||
|
|||||||
+5
-2
@@ -16,7 +16,10 @@ for (const f of fs.readdirSync(path.join(root, "site/atlas"))) copy(`site/atlas/
|
|||||||
// local serving, give it its own doctype, charset and viewport.
|
// local serving, give it its own doctype, charset and viewport.
|
||||||
{
|
{
|
||||||
const p = path.join(out, "index.html");
|
const p = path.join(out, "index.html");
|
||||||
const html = fs.readFileSync(p, "utf8");
|
// links from forge.yaml (data/public/links.json, written by `python -m collection build`)
|
||||||
|
const links = JSON.parse(fs.readFileSync(path.join(root, "data/public/links.json"), "utf8"));
|
||||||
|
const html = fs.readFileSync(p, "utf8").replace(/\{\{(\w+)\}\}/g, (m, k) => (k in links ? links[k] : m));
|
||||||
|
fs.writeFileSync(p, html);
|
||||||
if (!/^\s*<!doctype/i.test(html))
|
if (!/^\s*<!doctype/i.test(html))
|
||||||
fs.writeFileSync(p, `<!doctype html>\n<meta charset="utf-8">\n<meta name="viewport" content="width=device-width, initial-scale=1">\n${html}`);
|
fs.writeFileSync(p, `<!doctype html>\n<meta charset="utf-8">\n<meta name="viewport" content="width=device-width, initial-scale=1">\n${html}`);
|
||||||
}
|
}
|
||||||
@@ -24,7 +27,7 @@ for (const f of fs.readdirSync(path.join(root, "site/atlas"))) copy(`site/atlas/
|
|||||||
copy("core/graph.js", "graph.js");
|
copy("core/graph.js", "graph.js");
|
||||||
copy("core/solver.js", "solver.js");
|
copy("core/solver.js", "solver.js");
|
||||||
// The numbers the page shows (all computed in Python) and the published data
|
// The numbers the page shows (all computed in Python) and the published data
|
||||||
for (const f of ["stats.json", "register.json", "graph.json", "policy.json"]) copy(`data/public/${f}`, `data/${f}`);
|
for (const f of ["stats.json", "register.json", "graph.json", "policy.json", "black.json", "tree.json", "experiments.json"]) copy(`data/public/${f}`, `data/${f}`);
|
||||||
copy("data/public/runs_clean.csv", "data/runs_clean.csv");
|
copy("data/public/runs_clean.csv", "data/runs_clean.csv");
|
||||||
for (const f of ["croissant.json", "dictionary.yaml"]) copy(`data/${f}`, `data/${f}`);
|
for (const f of ["croissant.json", "dictionary.yaml"]) copy(`data/${f}`, `data/${f}`);
|
||||||
// Source files shown in the page's "view the code" panel
|
// Source files shown in the page's "view the code" panel
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"""The collection pipeline: extract's raw store, every transform, the coders, validation and the generated files."""
|
"""The collection pipeline: extract's raw store, every transform, the coders, validation and the generated files."""
|
||||||
import csv
|
import csv
|
||||||
import json
|
import json
|
||||||
|
import re
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
@@ -100,15 +101,42 @@ class Bot(unittest.TestCase):
|
|||||||
self.assertEqual(py, {k: v for k, v in j.items() if k not in ("outcome", "outcome_color")})
|
self.assertEqual(py, {k: v for k, v in j.items() if k not in ("outcome", "outcome_color")})
|
||||||
|
|
||||||
def test_every_bot_choice_is_mapped(self):
|
def test_every_bot_choice_is_mapped(self):
|
||||||
"""Every choice the bot has seen maps onto a column, except answers inside a bonding encounter."""
|
"""Every route choice the bot has seen before the hour maps onto a column (answers inside the bonding
|
||||||
|
encounters are not route choices), unless bot.yaml lists it as not coded."""
|
||||||
import re
|
import re
|
||||||
cw = [re.compile(rx) for rx, _, _ in read_yaml("collection/specs/bot.yaml")["crosswalk"]]
|
spec = read_yaml("collection/specs/bot.yaml")
|
||||||
|
cw = [re.compile(rx) for rx, _, _ in spec["crosswalk"]] + [re.compile(rx) for rx in spec.get("not_coded", [])]
|
||||||
scenes = json.loads((ROOT / "data/bot/scenes.json").read_text(encoding="utf-8"))
|
scenes = json.loads((ROOT / "data/bot/scenes.json").read_text(encoding="utf-8"))
|
||||||
|
route = {"ENTER_THRESHING", "FIRST_SIGHTING", "SCREAM_AND_CADETS"}
|
||||||
unmapped = [f"{s['label']}: {o['text']}" for s in scenes.values()
|
unmapped = [f"{s['label']}: {o['text']}" for s in scenes.values()
|
||||||
if len(s["options"]) > 1 and "two Greens in the clearing" not in s["label"]
|
if len(s["options"]) > 1 and s["stage"] in route and "two Greens in the clearing" not in s["label"]
|
||||||
for o in s["options"] if not any(rx.search(bot.normalize(o["text"])) for rx in cw)]
|
for o in s["options"] if not any(rx.search(bot.normalize(o["text"])) for rx in cw)]
|
||||||
self.assertEqual(unmapped, [])
|
self.assertEqual(unmapped, [])
|
||||||
|
|
||||||
|
def test_runs_with_steps_and_accounts(self):
|
||||||
|
"""The bot's newer run records (one folder per account) become trajectories without account names or
|
||||||
|
prose; the top-level files mirror the first account and are skipped."""
|
||||||
|
run = {"runId": "run-1", "attempt": 3, "accountAttempt": 3, "accountId": "someone-example-com",
|
||||||
|
"accountRole": "research", "startedAt": "2026-11-09T22:02:14.430Z", "targetDragon": "black",
|
||||||
|
"decisionMode": "atlas_policy", "policyId": "atlas:x", "outcome": "BURNED", "intentionalBurn": True,
|
||||||
|
"burn": {"reason": "TREE_NO_SHADOW_AUTO_BURN"}, "dragonColor": None,
|
||||||
|
"steps": [{"nodeId": "a68f681076c6", "stage": "ENTER_THRESHING", "choiceText": "Find the tallest tree and climb for a better view",
|
||||||
|
"offered": [{"text": "Find the tallest tree and climb for a better view"}, {"text": "Continue toward the center of the valley"}],
|
||||||
|
"observed": {"shadow": False, "dragons": ["Green"]}, "propensity": 0.5, "toKey": "TERMINAL:BURNED",
|
||||||
|
"label": "x" * 300, "prose": "game text"}]}
|
||||||
|
line = json.dumps(run) + "\n"
|
||||||
|
files = {"data/runs.jsonl": line, "data/accounts/someone-example-com/runs.jsonl": line,
|
||||||
|
"logs/accounts/someone-example-com/encounters.jsonl": ""}
|
||||||
|
accts = bot._account_files(files)
|
||||||
|
self.assertEqual(list(accts), ["someone-example-com"])
|
||||||
|
t = bot.trajectory_from_run(run, "abc123")
|
||||||
|
self.assertEqual(t["steps"][0]["seen"], {"dragons": ["green"], "shadow": False})
|
||||||
|
self.assertEqual((t["steps"][0]["to"], t["meta"]["accountKey"], t["outcome"]["reason"]), ("BURNED", "abc123", "TREE_NO_SHADOW_AUTO_BURN"))
|
||||||
|
text = json.dumps(t)
|
||||||
|
self.assertNotIn("someone", text)
|
||||||
|
self.assertNotIn("game text", text)
|
||||||
|
bot.check_public(t, {"prose", "accountId"}, 200)
|
||||||
|
|
||||||
def test_graph_js_crosswalk_is_generated(self):
|
def test_graph_js_crosswalk_is_generated(self):
|
||||||
self.assertEqual(codegen.graph_js(), (ROOT / codegen.GRAPH_JS).read_text(encoding="utf-8"))
|
self.assertEqual(codegen.graph_js(), (ROOT / codegen.GRAPH_JS).read_text(encoding="utf-8"))
|
||||||
|
|
||||||
@@ -120,6 +148,7 @@ class Handoff(unittest.TestCase):
|
|||||||
z = TMP / "ken.zip"
|
z = TMP / "ken.zip"
|
||||||
with zipfile.ZipFile(z, "w") as f: # files under a top folder, as a zipped repo would have them
|
with zipfile.ZipFile(z, "w") as f: # files under a top folder, as a zipped repo would have them
|
||||||
for rel in spec["files"]:
|
for rel in spec["files"]:
|
||||||
|
if "*" not in rel:
|
||||||
f.write(FX / rel, f"DragonKind-main/{rel}")
|
f.write(FX / rel, f"DragonKind-main/{rel}")
|
||||||
self.assertEqual(extract.pack_local(spec, z), extract.pack_local(spec, FX))
|
self.assertEqual(extract.pack_local(spec, z), extract.pack_local(spec, FX))
|
||||||
empty = TMP / "empty.zip"
|
empty = TMP / "empty.zip"
|
||||||
@@ -128,17 +157,81 @@ class Handoff(unittest.TestCase):
|
|||||||
with self.assertRaises(RuntimeError):
|
with self.assertRaises(RuntimeError):
|
||||||
extract.pack_local(spec, empty)
|
extract.pack_local(spec, empty)
|
||||||
|
|
||||||
|
def test_overridden_picks_are_not_played(self):
|
||||||
|
from collection.etl import runs
|
||||||
|
steps = [{"scene": "a", "to": "BURNED", "optionText": "west"}, {"scene": "a", "to": "b", "optionText": "centre"},
|
||||||
|
{"scene": "b", "to": "BURNED", "optionText": "last"}]
|
||||||
|
self.assertEqual([s["optionText"] for s in runs.played(steps)], ["centre", "last"])
|
||||||
|
self.assertEqual(runs.played(steps[1:]), steps[1:]) # a last step that ends the run is kept
|
||||||
|
|
||||||
|
def test_register_rows_are_outcome_only_and_flagged(self):
|
||||||
|
import csv
|
||||||
|
with open(ROOT / "data/public/runs_clean.csv", encoding="utf-8", newline="") as f:
|
||||||
|
reg = [r for r in csv.DictReader(f) if r["source"] == "register"]
|
||||||
|
self.assertTrue(reg)
|
||||||
|
for r in reg:
|
||||||
|
self.assertEqual((r["outcome"], r["company"], r["scream"]), ("Bonded", "Unknown", "Unknown"))
|
||||||
|
self.assertIn("outcome only", r["data_flags"])
|
||||||
|
|
||||||
def test_bot_kit(self):
|
def test_bot_kit(self):
|
||||||
import zipfile
|
import zipfile
|
||||||
from collection.etl import handoff
|
from collection.etl import handoff
|
||||||
zpath = handoff.export_bot_kit(str(TMP / "exports"))
|
zpath = handoff.export_bot_kit(str(TMP / "exports"))
|
||||||
with zipfile.ZipFile(zpath) as z:
|
with zipfile.ZipFile(zpath) as z:
|
||||||
self.assertEqual(sorted(z.namelist()), ["README.txt", "graph.js", "policy.json", "solver.js"])
|
self.assertEqual(sorted(z.namelist()), ["README.txt", "experiments.json", "graph.js", "policy.json", "solver.js", "tree.json"])
|
||||||
self.assertEqual(z.read("solver.js"), (ROOT / "core/solver.js").read_bytes())
|
self.assertEqual(z.read("solver.js"), (ROOT / "core/solver.js").read_bytes())
|
||||||
self.assertEqual(json.loads(z.read("policy.json"))["id"],
|
self.assertEqual(json.loads(z.read("policy.json"))["id"],
|
||||||
json.loads((ROOT / "data/public/policy.json").read_text(encoding="utf-8"))["id"])
|
json.loads((ROOT / "data/public/policy.json").read_text(encoding="utf-8"))["id"])
|
||||||
|
|
||||||
|
|
||||||
|
class Forge(unittest.TestCase):
|
||||||
|
GITEA = {"kind": "gitea", "url": "https://git.example.net/", "repo": "me/threshing-atlas", "branch": "main"}
|
||||||
|
GITHUB = {"kind": "github", "url": "https://github.com", "repo": "me/threshing-atlas", "branch": "main"}
|
||||||
|
|
||||||
|
def test_links(self):
|
||||||
|
from collection.etl import forge
|
||||||
|
self.assertEqual(forge.file_url("data/x.csv", self.GITEA), "https://git.example.net/me/threshing-atlas/raw/branch/main/data/x.csv")
|
||||||
|
self.assertEqual(forge.file_url("data/x.csv", self.GITHUB), "https://raw.githubusercontent.com/me/threshing-atlas/main/data/x.csv")
|
||||||
|
self.assertIn("template=.github/ISSUE_TEMPLATE/report-a-run.yml", forge.new_issue_url(".github/ISSUE_TEMPLATE/report-a-run.yml", self.GITEA))
|
||||||
|
self.assertTrue(forge.new_issue_url(".github/ISSUE_TEMPLATE/report-a-run.yml", self.GITHUB).endswith("template=report-a-run.yml"))
|
||||||
|
self.assertEqual(forge.api_base(self.GITEA), "https://git.example.net/api/v1/repos/me/threshing-atlas")
|
||||||
|
|
||||||
|
def test_gitea_calls(self):
|
||||||
|
from collection.etl import forge
|
||||||
|
calls = []
|
||||||
|
|
||||||
|
def fake(method, url, body=None, tok=None, f=None):
|
||||||
|
calls.append((method, url, body, tok))
|
||||||
|
if url.endswith("/pulls"):
|
||||||
|
return {"number": 7}
|
||||||
|
if "/issues?" in url:
|
||||||
|
page = int(url.rsplit("page=", 1)[1])
|
||||||
|
return [{"number": 50 * (page - 1) + i, "body": "", "labels": [], "state": "open"} for i in range(50 if page == 1 else 3)]
|
||||||
|
return None
|
||||||
|
old = forge._call
|
||||||
|
forge._call = fake
|
||||||
|
try:
|
||||||
|
issues = forge.list_issues("run report", {"ATLAS_BOT_TOKEN": "t"}, self.GITEA)
|
||||||
|
self.assertEqual(len(issues), 53)
|
||||||
|
self.assertIsNone(issues[0]["state_reason"])
|
||||||
|
self.assertIn("type=issues", calls[0][1])
|
||||||
|
self.assertEqual(forge.open_pr("data/x", "T", "B", True, {"ATLAS_BOT_TOKEN": "t"}, self.GITEA), 7)
|
||||||
|
merge = calls[-1]
|
||||||
|
self.assertTrue(merge[1].endswith("/pulls/7/merge") and merge[2]["merge_when_checks_succeed"])
|
||||||
|
self.assertEqual(merge[3], "t")
|
||||||
|
finally:
|
||||||
|
forge._call = old
|
||||||
|
|
||||||
|
def test_page_links_follow_forge_yaml(self):
|
||||||
|
from collection.etl import codegen, forge
|
||||||
|
links = codegen.links()
|
||||||
|
self.assertEqual(links["repo"], forge.repo_url())
|
||||||
|
self.assertTrue(links["report"].startswith(forge.repo_url()))
|
||||||
|
page = (ROOT / "site/atlas/index.html").read_text(encoding="utf-8")
|
||||||
|
for key in set(re.findall(r"\{\{(\w+)\}\}", page)):
|
||||||
|
self.assertIn(key, links)
|
||||||
|
|
||||||
|
|
||||||
class Sheets(unittest.TestCase):
|
class Sheets(unittest.TestCase):
|
||||||
def test_privacy_rules(self):
|
def test_privacy_rules(self):
|
||||||
p = TMP / "sheet.csv"
|
p = TMP / "sheet.csv"
|
||||||
@@ -166,6 +259,45 @@ class Reddit(unittest.TestCase):
|
|||||||
self.assertNotIn("someone", json.dumps(out))
|
self.assertNotIn("someone", json.dumps(out))
|
||||||
|
|
||||||
|
|
||||||
|
class RedditComments(unittest.TestCase):
|
||||||
|
"""Runs the threshing-reddit scraper delivers (data/public/reddit_comments.json), with hand corrections."""
|
||||||
|
|
||||||
|
def source(self, public, manual):
|
||||||
|
spec = read_yaml("collection/pipeline.yaml")["sources"]["reddit_comments"]
|
||||||
|
return {**spec, "load": str(public), "manual": str(manual)}
|
||||||
|
|
||||||
|
def test_coded_with_hand_corrections(self):
|
||||||
|
public = TMP / "reddit_comments.json"
|
||||||
|
public.write_text(json.dumps({"runs": [
|
||||||
|
{"id": "c1", "thread": "abc", "posted": "2026-11-17", "result": None,
|
||||||
|
"answers": {"company": "Alone", "direction": "East (toward the roar)", "outcome": "Bonded",
|
||||||
|
"outcome_color": "Green", "branch": "Tree: climbed down slowly to the two Greens"}},
|
||||||
|
{"id": "c2-1", "thread": "abc", "posted": "2026-11-17", "result": None,
|
||||||
|
"answers": {"company": "Alone", "outcome": "Bonded", "outcome_color": "Red"}},
|
||||||
|
{"id": "c3", "thread": "abc", "posted": None, "result": None,
|
||||||
|
"answers": {"company": "Alone", "outcome": "Incinerated at a bonding encounter", "outcome_color": "Red"}}]}),
|
||||||
|
encoding="utf-8")
|
||||||
|
manual = TMP / "reddit_comments_manual.yaml"
|
||||||
|
manual.write_text("reject: [c2]\nfix: {c1: {outcome_color: Blue, direction: null}}\n"
|
||||||
|
"add: [{id: c9, thread: abc, posted: '2026-11-16', "
|
||||||
|
"answers: {company: Two squadmates, direction: West (toward the scent), outcome: Died before the hour}}]\n",
|
||||||
|
encoding="utf-8")
|
||||||
|
rows = runs.reddit_comments("reddit_comments", self.source(public, manual))
|
||||||
|
self.assertEqual([r["run_id"] for r in rows], ["comment-c1", "comment-c3", "comment-c9"])
|
||||||
|
c1, c3, c9 = rows
|
||||||
|
self.assertEqual((c1["source"], c1["outcome_color"], c1["direction"], c1["hour"], c1["enc_Blue"]),
|
||||||
|
("reddit comment", "Blue", "Unknown", "Tree", "Bonded!"))
|
||||||
|
self.assertEqual(c1["data_flags"], "read from a Reddit comment")
|
||||||
|
self.assertEqual(c3["data_flags"], "read from a Reddit comment automatically, not checked by hand")
|
||||||
|
self.assertEqual((c9["company"], c9["direction"], c9["hour"]), ("2 Squadmates", "West", "DIED before the hour"))
|
||||||
|
self.assertEqual(validate.problems(rows, runs.DICT), [])
|
||||||
|
|
||||||
|
def test_delivered_not_extracted(self):
|
||||||
|
spec = read_yaml("collection/pipeline.yaml")["sources"]["reddit_comments"]
|
||||||
|
with self.assertRaises(extract.Skip):
|
||||||
|
extract.EXTRACTORS[spec["extract"]["kind"]](spec["extract"], {})
|
||||||
|
|
||||||
|
|
||||||
class Reports(unittest.TestCase):
|
class Reports(unittest.TestCase):
|
||||||
def issue(self, number, answers, **kw):
|
def issue(self, number, answers, **kw):
|
||||||
form = report_form.spec()
|
form = report_form.spec()
|
||||||
|
|||||||
@@ -110,3 +110,145 @@ test("solverHistory turns form variables into a history keyed by the game's step
|
|||||||
assert.strictEqual(l.leave, "Leave them");
|
assert.strictEqual(l.leave, "Leave them");
|
||||||
assert.strictEqual(l.red, "Let it pass (two Greens)");
|
assert.strictEqual(l.red, "Let it pass (two Greens)");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("Thompson sampling: one posterior draw per seed, with the chance of each pick", () => {
|
||||||
|
const S = require("../../core/solver.js");
|
||||||
|
const P = require("../../data/public/policy.json");
|
||||||
|
const best = S.advisor(P.samples.all, "Blue", "eventually").next({});
|
||||||
|
assert.strictEqual(best.propensity, 1);
|
||||||
|
const a = S.advisor(P.samples.all, "Blue", "eventually", { sampling: "thompson", seed: 3, draws: 8 });
|
||||||
|
const b = S.advisor(P.samples.all, "Blue", "eventually", { sampling: "thompson", seed: 3, draws: 8 });
|
||||||
|
const ra = a.next({}), rb = b.next({});
|
||||||
|
assert.strictEqual(ra.choice, rb.choice); // same seed, same draw
|
||||||
|
assert.ok(ra.propensity >= 0 && ra.propensity <= 1);
|
||||||
|
const picks = new Set();
|
||||||
|
for (let s = 1; s <= 12; s++) picks.add(S.advisor(P.samples.all, "Blue", "eventually", { sampling: "thompson", seed: s, draws: 1 }).next({}).choice);
|
||||||
|
assert.ok(picks.size > 1, "different seeds explore different options");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("a first attempt has its own odds, exactly as the Python model publishes them", () => {
|
||||||
|
for (const smp of Object.values(published.samples)) {
|
||||||
|
for (const [X, t] of Object.entries(smp.targets)) {
|
||||||
|
for (const obj of ["thisAttempt", "eventually"]) {
|
||||||
|
const adv = S.advisor(smp, X, obj, { attempt: 1 });
|
||||||
|
assert.deepStrictEqual(adv.given, { attempt: "First attempt" });
|
||||||
|
assert.ok(Math.abs(adv.value.x - t.firstAttempt[obj].pX.point) < 1e-12, `${X} ${obj}`);
|
||||||
|
assert.strictEqual(adv.next({}).choice, t.firstAttempt[obj].tree.choice);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const all = published.samples.all;
|
||||||
|
const later = S.advisor(all, "Black", "thisAttempt", { attempt: 7 }), dflt = S.advisor(all, "Black", "thisAttempt");
|
||||||
|
assert.strictEqual(later.value.x, dflt.value.x); // no attempt given: a later attempt
|
||||||
|
assert.ok(S.advisor(all, "Black", "thisAttempt", { attempt: 1 }).value.x > 5 * later.value.x);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("fix holds decisions to an experiment arm and solves the rest around it", () => {
|
||||||
|
const all = published.samples.all;
|
||||||
|
const fix = { direction: "East", scream: "Investigate the scream", clearing: "Help your squadmate", hour: "Tree" };
|
||||||
|
const adv = S.advisor(all, "Black", "eventually", { attempt: 1, fix });
|
||||||
|
assert.strictEqual(adv.step({ company: "Alone" }).choice, "East");
|
||||||
|
assert.deepStrictEqual(Object.keys(adv.step({ company: "Alone" }).options), ["East"]);
|
||||||
|
assert.ok(adv.value.x <= S.advisor(all, "Black", "eventually", { attempt: 1 }).value.x + 1e-12);
|
||||||
|
assert.throws(() => S.advisor(all, "Black", "eventually", { fix: { direction: "North" } }), /no option/);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("mapping: uniform sampling picks among the options on the screen, with its propensity", () => {
|
||||||
|
const all = published.samples.all;
|
||||||
|
const screen = ["Enter the valley alone", "Enter the valley with one of your squadmates", "Enter the valley with two of your squadmates"];
|
||||||
|
const picks = new Set();
|
||||||
|
for (let seed = 1; seed <= 30; seed++) {
|
||||||
|
const rec = S.recommendOption(S.advisor(all, "Blue", "eventually", { sampling: "uniform", seed }), {}, screen);
|
||||||
|
assert.ok(Math.abs(rec.propensity - 1 / 3) < 1e-12);
|
||||||
|
assert.match(S.norm(screen[rec.index]), new RegExp(all.model.game.bot_text.company[rec.choice]));
|
||||||
|
picks.add(rec.choice);
|
||||||
|
}
|
||||||
|
assert.strictEqual(picks.size, 3);
|
||||||
|
const a = S.advisor(all, "Blue", "eventually", { sampling: "uniform", seed: 4 });
|
||||||
|
assert.strictEqual(S.recommendOption(a, {}, screen).index, S.recommendOption(a, {}, screen).index); // same seed, same pick
|
||||||
|
});
|
||||||
|
|
||||||
|
test("the experiment plan: what each attempt of each account is for", () => {
|
||||||
|
const plan = JSON.parse(fs.readFileSync(path.join(ROOT, "data/public/experiments.json"), "utf8"));
|
||||||
|
const all = published.samples.all;
|
||||||
|
// attempt 1: every new account plays the same exact path (the replication)
|
||||||
|
for (let acc = 0; acc < 30; acc++) {
|
||||||
|
const a = S.assign(plan, { accountSeq: acc, attempt: 1 });
|
||||||
|
assert.strictEqual(a.experimentId, "fresh-replicate");
|
||||||
|
assert.strictEqual(a.target, "Black");
|
||||||
|
assert.strictEqual(a.fix.direction, "West");
|
||||||
|
assert.deepStrictEqual(a, S.assign(plan, { accountSeq: acc, attempt: 1 })); // the same every time
|
||||||
|
}
|
||||||
|
const a1 = S.assign(plan, { accountSeq: 0, attempt: 1 });
|
||||||
|
const adv = S.advisor(all, a1.target, a1.objective, { attempt: 1, fix: a1.fix });
|
||||||
|
let h = {};
|
||||||
|
for (let i = 0; i < 20; i++) {
|
||||||
|
const s = adv.step(h);
|
||||||
|
if (s.kind === "decision") { if (s.var === "encounter") break; if (a1.fix[s.var]) assert.strictEqual(s.choice, a1.fix[s.var]); h[s.var] = s.choice; }
|
||||||
|
else if (s.kind === "chance") h[s.var] = s.var === "shadow" ? "no" : Object.keys(s.probs).find((k) => k !== "die");
|
||||||
|
else break;
|
||||||
|
}
|
||||||
|
assert.strictEqual(h.hour, "Tree");
|
||||||
|
// the ablation waits for the replication, then gives every arm the same number of accounts
|
||||||
|
const stage2 = { ...plan, experiments: plan.experiments.map((e) => (e.id === "fresh-replicate" ? { ...e, status: "complete" } : e.id === "fresh-ablate" ? { ...e, status: "running" } : e)) };
|
||||||
|
const count = {};
|
||||||
|
for (let acc = 0; acc < 12 * 5; acc++) { const a = S.assign(stage2, { accountSeq: acc, attempt: 1 }); assert.strictEqual(a.experimentId, "fresh-ablate"); count[a.arm] = (count[a.arm] || 0) + 1; }
|
||||||
|
assert.deepStrictEqual(Object.values(count), Array(12).fill(5));
|
||||||
|
// with squadmates, staying and the direction are one screen
|
||||||
|
const squad = stage2.experiments.find((e) => e.id === "fresh-ablate").arms.find((a) => a.id === "with two squadmates");
|
||||||
|
const rec = S.recommendOption(S.advisor(all, "Black", "eventually", { attempt: 1, fix: squad.fix }), { company: "2 Squadmates" },
|
||||||
|
["Go east with your squad", "Leave your squadmates", "Convince them to head west instead"]);
|
||||||
|
assert.strictEqual(rec.index, 2);
|
||||||
|
assert.deepStrictEqual(rec.also, { direction: "West" });
|
||||||
|
// attempt 2: an account that saw the shadow tries the same path again; half of the others do too
|
||||||
|
const who = (attempt, facts) => Array.from({ length: 40 }, (_, acc) => (S.assign(plan, { accountSeq: acc, attempt, facts }) || {}).experimentId);
|
||||||
|
assert.ok(who(2, { sawShadowBefore: true }).every((id) => id === "shadow-again"));
|
||||||
|
assert.strictEqual(who(2, { sawShadowBefore: false }).filter((id) => id === "second-attempt-same-path").length, 20);
|
||||||
|
// later: two accounts in ten are the long-lived ones, the rest share the research experiments
|
||||||
|
const later = who(6, { sawShadowBefore: false });
|
||||||
|
assert.strictEqual(later.filter((id) => id === "veteran-repeat").length, 4);
|
||||||
|
assert.strictEqual(later.filter((id) => id === "veteran-variety").length, 4);
|
||||||
|
assert.deepStrictEqual([...new Set(later)].sort(), ["mapping", "meadow-blue-route", "sentinel", "veteran-repeat", "veteran-variety"]);
|
||||||
|
// variety: a different combination on every attempt, both gates kept, every one playable
|
||||||
|
const combos = new Set();
|
||||||
|
for (let t = 3; t < 3 + 60; t++) {
|
||||||
|
const a = S.assign(plan, { accountSeq: 11, attempt: t, facts: { sawShadowBefore: false } });
|
||||||
|
assert.strictEqual(a.experimentId, "veteran-variety");
|
||||||
|
assert.strictEqual(a.fix.clearing, "Help your squadmate");
|
||||||
|
combos.add(a.arm);
|
||||||
|
if (t < 8) S.advisor(all, a.target, a.objective, { attempt: t, fix: a.fix });
|
||||||
|
}
|
||||||
|
assert.strictEqual(combos.size, 60);
|
||||||
|
// an experiment that is not running is not assigned; its share goes to the others
|
||||||
|
const done = { ...plan, experiments: plan.experiments.map((e) => (e.id === "meadow-blue-route" ? { ...e, status: "complete" } : e)) };
|
||||||
|
assert.notStrictEqual(S.assign(done, { accountSeq: 5, attempt: 5 }).experimentId, "meadow-blue-route");
|
||||||
|
assert.strictEqual(S.assign({ ...plan, experiments: [] }, { accountSeq: 1, attempt: 5 }), null);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("screenPick: least-tried fills gaps, Thompson avoids what has killed", () => {
|
||||||
|
const tree = { screens: { s1: { options: {
|
||||||
|
a: { text: "Hold its gaze", n: 40, to: { next: { n: 38 }, DIED: { n: 2 } } },
|
||||||
|
b: { text: "Lower your eyes", n: 40, to: { DIED: { n: 40 } } },
|
||||||
|
c: { text: "Step back", n: 0, to: {} } } } } };
|
||||||
|
const screen = ["Lower your eyes", "Hold its gaze", "Step back", "An option the tree has never seen"];
|
||||||
|
const lt = S.screenPick(tree, "s1", screen, { mode: "least-tried", seed: 1 });
|
||||||
|
assert.ok([2, 3].includes(lt.index) && lt.n === 0);
|
||||||
|
assert.deepStrictEqual(lt, S.screenPick(tree, "s1", screen, { mode: "least-tried", seed: 1 })); // same seed, same pick
|
||||||
|
const picks = {};
|
||||||
|
for (let seed = 1; seed <= 300; seed++) { const p = S.screenPick(tree, "s1", screen, { mode: "thompson", seed }); picks[p.index] = (picks[p.index] || 0) + 1; }
|
||||||
|
assert.ok(!picks[0] || picks[0] < 3, "an option that died 40 times in 40 is almost never drawn");
|
||||||
|
assert.ok(picks[1] > 200 && picks[2] >= 5 && picks[3] >= 5, JSON.stringify(picks)); // mostly the good one; the untested ones still get tried
|
||||||
|
assert.strictEqual(S.screenPick(tree, "unknown-screen", ["x", "y"], { seed: 2 }).n, 0);
|
||||||
|
assert.strictEqual(S.screenPick(tree, "s1", []), null);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("picks the bot logged and then overrode are not part of the run", () => {
|
||||||
|
const G = require("../../core/graph.js");
|
||||||
|
const steps = [
|
||||||
|
{ scene: "a68f681076c6", optionText: "Head west toward the scent", to: "BURNED" },
|
||||||
|
{ scene: "a68f681076c6", optionText: "Head toward the center of the forest", to: "bc4ee4754b9c" },
|
||||||
|
{ scene: "bc4ee4754b9c", optionText: "Lower your eyes in respect", to: "84780dab01e3", tint: "red" }];
|
||||||
|
assert.strictEqual(G.playedSteps(steps).length, 2);
|
||||||
|
assert.strictEqual(G.trajectoryVariables({ steps, outcome: {} }).vars.direction, "Center");
|
||||||
|
assert.strictEqual(G.playedSteps([{ scene: "x", optionText: "only" }]).length, 1); // a run in progress
|
||||||
|
});
|
||||||
|
|||||||
@@ -43,13 +43,4 @@ test("Beta credible interval", () => {
|
|||||||
assert.ok(p.lo >= 0 && p.hi < 0.5 && p.mean === 0.1);
|
assert.ok(p.lo >= 0 && p.hi < 0.5 && p.mean === 0.1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("every choice the bot has seen maps onto a form variable, except answers inside a bonding encounter", () => {
|
// every route choice the bot has seen maps onto a column: tests/collection/test_collection.py (Bot)
|
||||||
const scenes = require("../../data/bot/scenes.json");
|
|
||||||
const unmapped = [];
|
|
||||||
for (const s of Object.values(scenes)) {
|
|
||||||
if (s.options.length < 2) continue; // nothing to choose
|
|
||||||
if (/two Greens in the clearing/.test(s.label)) continue; // answers at the Greens' encounter: not modelled yet
|
|
||||||
for (const o of s.options) if (!G.CROSSWALK.some(([re]) => re.test(G.norm(o.text)))) unmapped.push(`${s.label}: ${o.text}`);
|
|
||||||
}
|
|
||||||
assert.deepStrictEqual(unmapped, []);
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -0,0 +1,139 @@
|
|||||||
|
"""Reporting-bias correction (core/atlas/bias.py)."""
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from atlas import bias, model
|
||||||
|
|
||||||
|
CFG = {"rolls": {"meadow": "Blue"}, "min_runs": 30, "min_complete_rare": 5,
|
||||||
|
"groups": [{"name": "bot", "when": {"source": "bot"}, "complete": True},
|
||||||
|
{"name": "form", "when": {"source": "reddit spreadsheet"}}]}
|
||||||
|
|
||||||
|
|
||||||
|
def meadow_run(source, colour):
|
||||||
|
r = {"source": source, "entry": "Form", "goal": "Any (for fun)", "company": "Alone", "direction": "Center",
|
||||||
|
"first_sighting": "Red", "sighting_action": None, "left_squadmates": None, "scream": "Ignore the scream",
|
||||||
|
"resolution": "Tourniquet", "post_path": "(no fork)", "hour": "Valley", "branch": "Passed the Red: meadow",
|
||||||
|
"outcome": "Incinerated", "outcome_color": colour, "malek_intent": "No", "rare_reported": None,
|
||||||
|
"saw_blue_meadow": colour == "Blue"}
|
||||||
|
for c in model.COLOURS:
|
||||||
|
r["enc_" + c] = "Incinerated" if c == colour else None
|
||||||
|
return r
|
||||||
|
|
||||||
|
|
||||||
|
class Bias(unittest.TestCase):
|
||||||
|
def runs(self, bot_blue, bot_n, form_blue, form_n):
|
||||||
|
return ([meadow_run("bot", "Blue")] * bot_blue + [meadow_run("bot", "Orange")] * (bot_n - bot_blue) +
|
||||||
|
[meadow_run("reddit spreadsheet", "Blue")] * form_blue + [meadow_run("reddit spreadsheet", "Orange")] * (form_n - form_blue))
|
||||||
|
|
||||||
|
def test_over_reporting_is_estimated_and_corrected(self):
|
||||||
|
runs = self.runs(10, 100, 100, 300) # 10% when everything is logged, 33% in the form
|
||||||
|
prep = [model.prepare_run(r) for r in runs]
|
||||||
|
est, names = bias.estimate(runs, prep, CFG, set())
|
||||||
|
rho = est["form"]["meadow"]["rho"]
|
||||||
|
self.assertAlmostEqual(rho, 4.4, delta=0.5)
|
||||||
|
self.assertLess(est["form"]["meadow"]["lo"], rho)
|
||||||
|
self.assertGreater(est["form"]["meadow"]["hi"], rho)
|
||||||
|
T = model.count_tables(prep, bias.weights(names, prep, est, CFG["rolls"]))
|
||||||
|
c = T["meadow"]["0:"]
|
||||||
|
# corrected: the form's Blue sightings count 1/rho each, so the pooled rate is close to what the bot sees
|
||||||
|
self.assertAlmostEqual(c["Blue"] / (c["Blue"] + c["Orange"]), 0.10, delta=0.02)
|
||||||
|
|
||||||
|
def test_unestimable_bias_leaves_the_group_out(self):
|
||||||
|
runs = self.runs(0, 200, 60, 300) # complete logging never saw it
|
||||||
|
prep = [model.prepare_run(r) for r in runs]
|
||||||
|
est, names = bias.estimate(runs, prep, CFG, set())
|
||||||
|
self.assertTrue(est["form"]["meadow"]["exclude"])
|
||||||
|
T = model.count_tables(prep, bias.weights(names, prep, est, CFG["rolls"]))
|
||||||
|
self.assertEqual(T["meadow"]["0:"], {"Orange": 200})
|
||||||
|
# a roll seen only one way: routes cannot be told apart, so it is pooled fully
|
||||||
|
self.assertEqual(model.fit_alpha(T, "meadow")["alpha"], max(model.ALPHA_GRID))
|
||||||
|
|
||||||
|
|
||||||
|
def test_unestimable_bias_can_borrow_another_rolls_estimate(self):
|
||||||
|
# the shadow was never seen in complete logs, the meadow Blue was: the form's shadow reports count 1/rho(meadow)
|
||||||
|
cfg = {**CFG, "rolls": {"shadow": "yes", "meadow": "Blue"}, "borrow": {"shadow": "meadow"}}
|
||||||
|
runs = self.runs(10, 100, 100, 300) + [tree_run("bot", False)] * 100 + \
|
||||||
|
[tree_run("reddit spreadsheet", True)] * 8 + [tree_run("reddit spreadsheet", False)] * 92
|
||||||
|
prep = [model.prepare_run(r) for r in runs]
|
||||||
|
est, names = bias.estimate(runs, prep, cfg, set())
|
||||||
|
e = est["form"]["shadow"]
|
||||||
|
self.assertAlmostEqual(e["rho"], est["form"]["meadow"]["rho"])
|
||||||
|
self.assertIn("assumed", e["used"])
|
||||||
|
self.assertFalse(e.get("exclude"))
|
||||||
|
T = model.count_tables(prep, bias.weights(names, prep, est, cfg["rolls"]))
|
||||||
|
self.assertAlmostEqual(T["shadow"]["1:First attempt"]["yes"], 8 / e["rho"], places=3)
|
||||||
|
# without `borrow`, the group is left out of the roll
|
||||||
|
est2, _ = bias.estimate(runs, prep, {**cfg, "borrow": {}}, set())
|
||||||
|
self.assertTrue(est2["form"]["shadow"]["exclude"])
|
||||||
|
|
||||||
|
|
||||||
|
def tree_run(source, shadow, attempt_group="First attempt"):
|
||||||
|
r = meadow_run(source, "Orange")
|
||||||
|
r.update(scream="Investigate & help", resolution="Squadmate's revenge", post_path="Forest", hour="Tree",
|
||||||
|
branch="Shadow (rare)" if shadow else "Descend slowly: two Greens", outcome_color="Black" if shadow else "Green",
|
||||||
|
enc_Orange=None, enc_Black="Incinerated" if shadow else None, enc_Green=None if shadow else "Incinerated",
|
||||||
|
saw_blue_meadow=None, attempt_group=attempt_group, combat_first=None, combat_second=None)
|
||||||
|
return r
|
||||||
|
|
||||||
|
|
||||||
|
class FirstAttempt(unittest.TestCase):
|
||||||
|
"""game.yaml `givens`: first and later attempts are different shadow rolls (`distinct`), not pooled."""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
runs = [tree_run("bot", True)] * 9 + [tree_run("bot", False)] * 91 + [tree_run("bot", False, "Later attempt")] * 900 + \
|
||||||
|
[tree_run("bot", True, "Later attempt")] * 1
|
||||||
|
self.T = model.count_tables([model.prepare_run(r) for r in runs])
|
||||||
|
|
||||||
|
def test_each_attempt_kind_keeps_its_own_rate(self):
|
||||||
|
p = model.Params(self.T, "mean", alphas={"shadow": 100000})
|
||||||
|
gated = {"scream": "Investigate the scream", "clearing": "Help your squadmate"}
|
||||||
|
later = float(p.chance("shadow", gated)["yes"][0])
|
||||||
|
first = float(p.having(attempt="First attempt").chance("shadow", gated)["yes"][0])
|
||||||
|
self.assertAlmostEqual(first, 0.09, delta=0.01) # not dragged to the pooled 1%
|
||||||
|
self.assertAlmostEqual(later, 0.001, delta=0.001)
|
||||||
|
self.assertEqual(p.given, {"attempt": "Later attempt"}) # the default: a later attempt
|
||||||
|
|
||||||
|
def test_policy_reports_the_first_attempt_separately(self):
|
||||||
|
from atlas import solver
|
||||||
|
runs = [tree_run("bot", True)] * 9 + [tree_run("bot", False)] * 91 + [tree_run("bot", False, "Later attempt")] * 900
|
||||||
|
pol = solver.build_policy([dict(r, enc_Black="Bonded!", outcome="Bonded") if r["branch"] == "Shadow (rare)" else r for r in runs],
|
||||||
|
draws=6, colours=["Black"], min_support=1)
|
||||||
|
t = pol["targets"]["Black"]
|
||||||
|
f = t["firstAttempt"]
|
||||||
|
self.assertEqual(f["given"], {"attempt": "First attempt"})
|
||||||
|
self.assertGreater(f["thisAttempt"]["pX"]["point"], 20 * t["thisAttempt"]["pX"]["point"])
|
||||||
|
self.assertLessEqual(f["thisAttempt"]["pX"]["lo"], f["thisAttempt"]["pX"]["hi"])
|
||||||
|
self.assertIn("pEventually", f["eventually"])
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
||||||
|
|
||||||
|
|
||||||
|
class Gate(unittest.TestCase):
|
||||||
|
def test_closed_gate_fixes_the_roll_and_is_not_counted(self):
|
||||||
|
spec = model.CHANCE["shadow"]
|
||||||
|
self.assertTrue(spec.get("requires"))
|
||||||
|
state = {"scream": "Keep walking"}
|
||||||
|
self.assertFalse(model.gate_open("shadow", state))
|
||||||
|
p = model.Params({"shadow": {"0:": {"yes": 5, "no": 5}}}, "mean").chance("shadow", state)
|
||||||
|
self.assertEqual((float(p["yes"][0]), float(p["no"][0])), (0.0, 1.0))
|
||||||
|
# a tree run that ignored the scream says nothing about the shadow
|
||||||
|
run = meadow_run("bot", "Orange")
|
||||||
|
run.update(hour="Tree", branch="Descend slowly: two Greens", scream="Ignore the scream")
|
||||||
|
self.assertIsNone(model.OBSERVE["shadow"](model.prepare_run(run)))
|
||||||
|
run.update(scream="Investigate & help", resolution="Killed the bullies yourself", post_path="Forest",
|
||||||
|
combat_first="Assess the situation", combat_second="Engage the smaller cadet")
|
||||||
|
self.assertEqual(model.OBSERVE["shadow"](model.prepare_run(run)), "no")
|
||||||
|
|
||||||
|
|
||||||
|
class PossibleBonds(unittest.TestCase):
|
||||||
|
def test_impossible_bond_is_not_counted(self):
|
||||||
|
good = meadow_run("reddit spreadsheet", "Orange")
|
||||||
|
good.update(hour="Tree", branch="Shadow (rare)", outcome="Bonded", outcome_color="Black", enc_Black="Bonded!",
|
||||||
|
enc_Orange=None, goal="Black", scream="Investigate & help", resolution="Killed the bullies yourself",
|
||||||
|
post_path="Forest", combat_first="Assess the situation", combat_second="Engage the smaller cadet")
|
||||||
|
bad = dict(good, enc_Black=None, enc_Blue="Incinerated", outcome_color="Green", goal="Any (for fun)")
|
||||||
|
T = model.count_tables([model.prepare_run(good), model.prepare_run(bad)])
|
||||||
|
self.assertEqual(T["encounter"]["shadow-Black"]["outcomes"], {"Black": 1})
|
||||||
|
self.assertEqual(T["encounter"]["shadow-Blue"]["outcomes"], {}) # a Green at the Blue: not counted
|
||||||
|
self.assertTrue(model.can_bond("tree-Greens", "Brown"))
|
||||||
@@ -34,6 +34,7 @@ NEW = {
|
|||||||
"hour": "After walking an hour, what did you do?",
|
"hour": "After walking an hour, what did you do?",
|
||||||
"goal_v2": "Why are you doing this run?",
|
"goal_v2": "Why are you doing this run?",
|
||||||
"malek": "Would you seek Malek?",
|
"malek": "Would you seek Malek?",
|
||||||
|
"squad": "What squad were you assigned?",
|
||||||
**{f"enc_{c}": f"Did you attempt to bond? [{c}]" for c in coding.COLORS},
|
**{f"enc_{c}": f"Did you attempt to bond? [{c}]" for c in coding.COLORS},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,6 +63,10 @@ class Columns(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
class Rows(unittest.TestCase):
|
class Rows(unittest.TestCase):
|
||||||
|
def test_squad_ignores_case(self):
|
||||||
|
for typed, coded in (("second", "Second"), (" THIRD ", "Third"), ("Don't know", "Don't know"), (None, "Unknown")):
|
||||||
|
self.assertEqual(code(NEW, company="Alone", squad=typed)["squad"], coded)
|
||||||
|
|
||||||
def test_form_submission_vs_bulk_import(self):
|
def test_form_submission_vs_bulk_import(self):
|
||||||
self.assertEqual(code(OLD, timestamp="2026-10-03 14:02:11")["source"], "Form")
|
self.assertEqual(code(OLD, timestamp="2026-10-03 14:02:11")["source"], "Form")
|
||||||
r = code(OLD, timestamp="Data Import")
|
r = code(OLD, timestamp="Data Import")
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
"""The experiment plan (planner/experiments.yaml -> data/public/experiments.json)."""
|
||||||
|
import copy
|
||||||
|
import sys
|
||||||
|
import unittest
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parents[2]
|
||||||
|
sys.path.insert(0, str(ROOT / "planner"))
|
||||||
|
import build_experiments as B # noqa: E402
|
||||||
|
from atlas import model # noqa: E402
|
||||||
|
|
||||||
|
D = B.design()
|
||||||
|
GATED_TREE = {"attempt": "First attempt", "scream": "Investigate the scream", "clearing": "Help your squadmate"}
|
||||||
|
|
||||||
|
|
||||||
|
class Plan(unittest.TestCase):
|
||||||
|
def test_design_is_valid(self):
|
||||||
|
plan = B.build(D, log=[])
|
||||||
|
by = {e["id"]: e for e in plan["experiments"]}
|
||||||
|
# the Black attempt is one exact path, and it keeps the shadow's gate open
|
||||||
|
(arm,) = by["fresh-replicate"]["arms"]
|
||||||
|
self.assertEqual(arm["fix"], D["routes"]["best-reported"])
|
||||||
|
self.assertTrue(model.gate_open("shadow", arm["fix"]))
|
||||||
|
self.assertEqual(len(by["meadow-blue-route"]["arms"]), 6)
|
||||||
|
for e in plan["experiments"]:
|
||||||
|
for a in e["arms"]:
|
||||||
|
B.check_options(e["id"], a["fix"])
|
||||||
|
B.check_options(e["id"], {k: v[0] for k, v in (a.get("cycle") or {}).items()})
|
||||||
|
self.assertEqual(plan["record"], D["record"])
|
||||||
|
self.assertEqual(len(plan["scripts"]["shadow"]), 12)
|
||||||
|
|
||||||
|
def test_ablation_changes_one_thing_at_a_time_and_waits_for_the_replication(self):
|
||||||
|
plan = B.build(D, log=[])
|
||||||
|
by = {e["id"]: e for e in plan["experiments"]}
|
||||||
|
base = D["routes"]["best-reported"]
|
||||||
|
self.assertEqual(by["fresh-ablate"]["status"], "waiting")
|
||||||
|
for a in by["fresh-ablate"]["arms"]:
|
||||||
|
changed = {k for k in a["fix"] if a["fix"][k] != base.get(k)}
|
||||||
|
self.assertEqual(changed, set(a["change"]), a["id"])
|
||||||
|
self.assertLessEqual(len(changed - {"leave"}), 1, a["id"]) # leaving goes with the company
|
||||||
|
self.assertTrue(model.gate_open("shadow", a["fix"]))
|
||||||
|
# once the replication has its planned count, the ablation starts
|
||||||
|
e0 = next(e for e in D["experiments"] if e["id"] == "fresh-replicate")
|
||||||
|
log = [(e0["id"], "all", {**GATED_TREE, "shadow": i < 9}) for i in range(e0["planned_per_arm"])]
|
||||||
|
by = {e["id"]: e for e in B.build(D, log=log)["experiments"]}
|
||||||
|
self.assertEqual(by["fresh-replicate"]["status"], "complete")
|
||||||
|
self.assertEqual(by["fresh-replicate"]["progress"]["rare"], 9)
|
||||||
|
self.assertEqual(by["fresh-ablate"]["status"], "running")
|
||||||
|
|
||||||
|
def test_an_unknown_option_route_or_fact_is_refused(self):
|
||||||
|
for edit in (lambda d: d["routes"]["best-reported"].update(direction="North"),
|
||||||
|
lambda d: d["experiments"][0].update(route="nowhere"),
|
||||||
|
lambda d: d["experiments"][1]["arms"][0]["change"].update(company="Three"),
|
||||||
|
lambda d: d["experiments"][2].update(when={"luck": True}),
|
||||||
|
lambda d: d["experiments"][1].update(starts_after="nothing")):
|
||||||
|
d = copy.deepcopy(D)
|
||||||
|
edit(d)
|
||||||
|
with self.assertRaises(ValueError):
|
||||||
|
B.build(d, log=[])
|
||||||
|
|
||||||
|
def test_progress(self):
|
||||||
|
e0 = D["experiments"][0]
|
||||||
|
none = {**GATED_TREE, "shadow": False}
|
||||||
|
e = B.build(D, log=[(e0["id"], "all", {**GATED_TREE, "shadow": True})] * 3 + [(e0["id"], "all", none)] * 7)["experiments"][0]
|
||||||
|
self.assertEqual((e["status"], e["progress"]["observed"], e["progress"]["rare"]), ("running", 10, 3))
|
||||||
|
self.assertAlmostEqual(e["arms"][0]["progress"]["estimate"]["rate"], 3.5 / 11)
|
||||||
|
# a run whose shadow was not observed (died before the tree) is a run, not an observation
|
||||||
|
e = B.build(D, log=[(e0["id"], "all", {"attempt": "First attempt"})])["experiments"][0]
|
||||||
|
self.assertEqual((e["progress"]["runs"], e["progress"]["observed"]), (1, 0))
|
||||||
|
# a cycled experiment logs the combination it played; they all count toward its one arm
|
||||||
|
v = B.build(D, log=[("veteran-variety", "company=Alone / direction=East", none)] * 4)
|
||||||
|
v = next(e for e in v["experiments"] if e["id"] == "veteran-variety")
|
||||||
|
self.assertEqual((v["arms"][0]["progress"]["observed"], v["progress"]["unknownArms"]), (4, []))
|
||||||
|
# stop_early pauses an experiment for a person to look at
|
||||||
|
d = copy.deepcopy(D)
|
||||||
|
d["experiments"][0]["stop_early"] = {"after": 5, "rare_at_most": 0}
|
||||||
|
self.assertEqual(B.build(d, log=[(e0["id"], "all", none)] * 5)["experiments"][0]["status"], "paused")
|
||||||
|
|
||||||
|
def test_the_plan_id_follows_its_content(self):
|
||||||
|
a, b = B.build(D, log=[]), B.build(D, log=[])
|
||||||
|
self.assertEqual(a["id"], b["id"])
|
||||||
|
c = B.build(D, log=[(D["experiments"][0]["id"], "x", None)])
|
||||||
|
self.assertNotEqual(a["id"], c["id"])
|
||||||
|
|
||||||
|
def test_published_plan_is_up_to_date(self):
|
||||||
|
self.assertEqual(B.main(["--check"]), 0)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
||||||
@@ -47,7 +47,7 @@ class GameSpec(unittest.TestCase):
|
|||||||
|
|
||||||
def test_chance_contexts_are_earlier_steps(self):
|
def test_chance_contexts_are_earlier_steps(self):
|
||||||
known = {"company", "left", "direction", "fs", "react", "scream", "clearing", "fight", "dagger", "cadet", "post",
|
known = {"company", "left", "direction", "fs", "react", "scream", "clearing", "fight", "dagger", "cadet", "post",
|
||||||
"hour", "shadow", "descend", "red", "valley", "meadow"}
|
"hour", "shadow", "descend", "red", "valley", "meadow"} | set(G.get("givens") or {})
|
||||||
for k, c in G["chance"].items():
|
for k, c in G["chance"].items():
|
||||||
self.assertTrue(set(c["context"]) <= known, k)
|
self.assertTrue(set(c["context"]) <= known, k)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
"""The screen tree (analysis/tree/build_tree.py) on a small game whose answers are known."""
|
||||||
|
import sys
|
||||||
|
import unittest
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parents[2]
|
||||||
|
sys.path.insert(0, str(ROOT / "analysis/tree"))
|
||||||
|
import build_tree as B # noqa: E402
|
||||||
|
|
||||||
|
SCENES = {"start": {"label": "Start", "stage": "S", "options": [{"id": "a", "text": "Left"}, {"id": "b", "text": "Right"}, {"id": "c", "text": "Never tried"}]},
|
||||||
|
"meadow": {"label": "Meadow", "stage": "M", "options": [{"id": "x", "text": "Approach"}]},
|
||||||
|
"blue": {"label": "Blue", "stage": "B", "options": [{"id": "g", "text": "Hold its gaze"}, {"id": "l", "text": "Lower eyes"}]}}
|
||||||
|
|
||||||
|
|
||||||
|
def step(scene, option, to=None, stage="S"):
|
||||||
|
return {"scene": scene, "option": option, "optionText": option, "to": to, "stage": stage}
|
||||||
|
|
||||||
|
|
||||||
|
def run(i, steps, kind, colour=None):
|
||||||
|
return {"id": f"r{i}", "steps": steps, "outcome": {"type": kind, "colour": colour}}
|
||||||
|
|
||||||
|
|
||||||
|
def world():
|
||||||
|
T = []
|
||||||
|
for i in range(100): # Left: the meadow; a Blue waits there 1 time in 10; holding its gaze bonds 8 times in 10
|
||||||
|
s = [step("start", "a", "meadow")]
|
||||||
|
if i % 10 == 0:
|
||||||
|
s += [step("meadow", "x", "blue"), step("blue", "g", "BURNED" if i in (0, 50) else "BONDED:blue")]
|
||||||
|
T.append(run(i, s, "BURNED" if i in (0, 50) else "BONDED", None if i in (0, 50) else "blue"))
|
||||||
|
else:
|
||||||
|
s += [step("meadow", "x", "BURNED", stage="INTENTIONAL_BURN")]
|
||||||
|
T.append(run(i, s, "BURNED"))
|
||||||
|
T.append(run(200, [step("start", "b", "BURNED")], "BURNED")) # Right: died, once
|
||||||
|
T.append(run(201, [step("start", "b", "BURNED"), step("start", "a", "meadow")], "ABORTED")) # overridden pick, then aborted
|
||||||
|
T.append(run(202, [step("blue", "l", "BONDED:blue")], "BONDED", "blue")) # one lucky run with lowered eyes
|
||||||
|
return T
|
||||||
|
|
||||||
|
|
||||||
|
class Tree(unittest.TestCase):
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
cls.t = B.build(world(), SCENES)
|
||||||
|
|
||||||
|
def test_counts_kinds_and_overridden_picks(self):
|
||||||
|
S = self.t["screens"]
|
||||||
|
a = S["start"]["options"]["a"]
|
||||||
|
self.assertEqual((a["n"], a["kind"], list(a["to"])), (101, "fixed", ["meadow"])) # 100 runs + the aborted one
|
||||||
|
self.assertLess(a["missed"], 0.01)
|
||||||
|
self.assertEqual(S["start"]["options"]["b"]["n"], 1) # the overridden pick is not counted
|
||||||
|
self.assertEqual(self.t["builtFrom"]["overridden"], 1)
|
||||||
|
self.assertEqual(S["start"]["options"]["c"]["kind"], "untested")
|
||||||
|
x = S["meadow"]["options"]["x"]
|
||||||
|
self.assertEqual(x["kind"], "dice")
|
||||||
|
self.assertAlmostEqual(x["to"]["blue"]["p"], 0.1)
|
||||||
|
self.assertEqual(x["deliberate"], 90) # deliberate burns are real results
|
||||||
|
self.assertTrue(x["to"]["blue"]["lo"] < 0.1 < x["to"]["blue"]["hi"])
|
||||||
|
g = S["blue"]["options"]["g"]
|
||||||
|
self.assertEqual((g["to"]["BONDED:Blue"]["n"], g["to"]["DIED"]["n"]), (8, 2))
|
||||||
|
|
||||||
|
def test_best_known_chance_is_chosen_cautiously(self):
|
||||||
|
best = self.t["best"]["Blue"]
|
||||||
|
# one lucky run with lowered eyes is 100% as observed, but holding its gaze (8 of 10) is the cautious pick
|
||||||
|
self.assertEqual([k["option"] for k in best["picks"]], ["a", "x", "g"])
|
||||||
|
self.assertAlmostEqual(best["p"], 0.1 * 0.8)
|
||||||
|
self.assertLess(best["pCautious"], best["p"])
|
||||||
|
self.assertAlmostEqual(best["ends"]["BONDED:Blue"], 0.08)
|
||||||
|
self.assertAlmostEqual(best["ends"]["DIED"], 0.92)
|
||||||
|
self.assertEqual(self.t["best"]["Black"]["p"], 0.0)
|
||||||
|
|
||||||
|
def test_outcomes_of_any_picks(self):
|
||||||
|
self.assertEqual(B.outcomes(self.t, {"start": "b"}), {"DIED": 1.0})
|
||||||
|
self.assertEqual(B.outcomes(self.t, {"start": "c"}), {"not mapped": 1.0})
|
||||||
|
ends = B.outcomes(self.t, {"start": "a", "blue": "l"})
|
||||||
|
self.assertAlmostEqual(ends["BONDED:Blue"], 0.1)
|
||||||
|
|
||||||
|
def test_coverage_lists_the_gaps(self):
|
||||||
|
c = self.t["coverage"]
|
||||||
|
self.assertEqual((c["screens"], c["options"], c["tested"]), (3, 6, 5))
|
||||||
|
self.assertEqual([u["option"] for u in c["untested"]], ["c"])
|
||||||
|
self.assertEqual(c["endings"], ["BONDED:Blue", "DIED"])
|
||||||
|
|
||||||
|
def test_published_tree_is_up_to_date(self):
|
||||||
|
self.assertEqual(B.main(["--check"]), 0)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
||||||
Vendored
+1
-1
@@ -22,7 +22,7 @@ def world(n=4000, seed=7):
|
|||||||
run = {"company": "Alone", "direction": ["East", "West", "Center"][i % 3], "first_sighting": ["Red", "Brown"][i % 2],
|
run = {"company": "Alone", "direction": ["East", "West", "Center"][i % 3], "first_sighting": ["Red", "Brown"][i % 2],
|
||||||
"scream": "Investigate & help", "resolution": ["Killed the bullies yourself", "Squadmate's revenge"][i % 2],
|
"scream": "Investigate & help", "resolution": ["Killed the bullies yourself", "Squadmate's revenge"][i % 2],
|
||||||
"post_path": "Forest", "goal": "Any (for fun)", "malek_intent": "No", "left_squadmates": False,
|
"post_path": "Forest", "goal": "Any (for fun)", "malek_intent": "No", "left_squadmates": False,
|
||||||
"sighting_action": "Unknown", "combat_first": "(not recorded)", "combat_second": "(not recorded)", "rare_reported": "No",
|
"sighting_action": "Unknown", "attempt_group": "Later attempt", "combat_first": "(not recorded)", "combat_second": "(not recorded)", "rare_reported": "No",
|
||||||
**{f"enc_{c}": None for c in ("Red", "Green", "Orange", "Brown", "Blue", "Black")}}
|
**{f"enc_{c}": None for c in ("Red", "Green", "Orange", "Brown", "Blue", "Black")}}
|
||||||
run["hour"] = "Tree" if r() < 0.5 else "Valley"
|
run["hour"] = "Tree" if r() < 0.5 else "Valley"
|
||||||
if run["hour"] == "Tree":
|
if run["hour"] == "Tree":
|
||||||
|
|||||||
Reference in New Issue
Block a user