Datasets:
Upload 7 files
Browse files- LICENSE-CODE +6 -0
- PLAN.md +81 -0
- README.md +104 -0
- generate.py +45 -0
- manifest.json +13 -0
- validate.py +42 -0
- validation_report.json +34 -0
LICENSE-CODE
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
Copyright (c) 2026 Sapiens Gameplay Synthetic contributors
|
| 3 |
+
|
| 4 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
| 5 |
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
| 6 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
PLAN.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Gameplay dataset implementation and publishing plan
|
| 2 |
+
|
| 3 |
+
## Goal
|
| 4 |
+
Publish a small, reproducible and honestly documented synthetic gameplay dataset on the user's Hugging Face account, then optionally develop a separate, consent-based real-game dataset. Publishing a dataset is distinct from contributing a PR to huggingface/datasets.
|
| 5 |
+
|
| 6 |
+
## Current deliverable
|
| 7 |
+
Prepared: 12,000 synthetic encounter rows; 300 sessions; 3 chapter labels; train/validation/test CSVs; generator; validator; manifest with SHA-256 hashes; dataset card; publication instructions. Local validation passed. No gameplay instrumentation has been added, and the existing game is unchanged. Hugging Face publication is pending account sign-in and confirmation of the destination shown in the account UI.
|
| 8 |
+
|
| 9 |
+
## Phase 1 — Scope and schema (completed)
|
| 10 |
+
- Unit: one obstacle encounter. Label: collision.
|
| 11 |
+
- Required states: hit count before/after, death on second contact, distance reset after death.
|
| 12 |
+
- Use abstract obstacles so no third-party artwork or books are needed.
|
| 13 |
+
- Record provenance and simulator version on every row.
|
| 14 |
+
- Keep predicted outcomes separate from input features.
|
| 15 |
+
Acceptance: all columns and exact semantics described in README.md; every row marked synthetic.
|
| 16 |
+
|
| 17 |
+
## Phase 2 — Reproducible generation (completed)
|
| 18 |
+
- Fixed seed 20261116, 300 artificial sessions, 40 encounters each.
|
| 19 |
+
- Uniformly sample abstract obstacle, lane and action; sample action timing validity at 75%.
|
| 20 |
+
- Preserve hit count across encounters until death; reset hits and distance on respawn.
|
| 21 |
+
- Add chapter labels for schema development only; chapter-specific mechanics are not modelled.
|
| 22 |
+
- Store the generator alongside records; hash output files.
|
| 23 |
+
Acceptance: repeated generation produces identical CSV bytes on the same supported environment; no real identities or third-party material.
|
| 24 |
+
|
| 25 |
+
## Phase 3 — Quality checks (completed locally)
|
| 26 |
+
- Enforce column order, known values and unique event IDs.
|
| 27 |
+
- Verify 12,000 rows and 300 sessions.
|
| 28 |
+
- Verify session-disjoint 80/10/10 splits.
|
| 29 |
+
- Validate state continuity within each session and explicit collision cases.
|
| 30 |
+
- Check death only after two collisions and respawn distance zero.
|
| 31 |
+
- Validate file checksums and exact regeneration.
|
| 32 |
+
- Review distributions; report observed counts without treating them as real player behaviour.
|
| 33 |
+
Acceptance: `python validate.py` succeeds. Hugging Face dataset loading/viewer checks remain a separate publication gate.
|
| 34 |
+
|
| 35 |
+
## Phase 4 — Publish on Hugging Face (pending sign-in)
|
| 36 |
+
1. Sign into the intended Hugging Face account through secure browser authentication.
|
| 37 |
+
2. Inspect the available account/organisation namespace. Use the user's personal namespace unless an organisation is explicitly requested.
|
| 38 |
+
3. Create `sapiens-gameplay-synthetic` as a dataset repository, initially private while checking upload and viewer. If it already exists, inspect its files/history and propose a versioned update instead of replacing unrelated files.
|
| 39 |
+
4. Upload this folder's contents, preserving `data/`. Do not upload the ZIP itself as the only data file. Use the README front matter to identify the three splits.
|
| 40 |
+
5. Confirm the dataset card, counts and preview. Load from the Hub using `datasets.load_dataset` and confirm counts/types; record the actual commit SHA.
|
| 41 |
+
6. Publish publicly once the dataset card, license and preview have been verified, consistent with the request to publish. Keep the upload commit for rollback.
|
| 42 |
+
7. Return the actual repository URL and verified release status. Never claim a placeholder namespace is live.
|
| 43 |
+
Acceptance: live dataset page, visible card, readable splits and recorded revision. Pending authentication is not a completed publication.
|
| 44 |
+
|
| 45 |
+
## Phase 5 — Useful baseline (next iteration; not yet implemented)
|
| 46 |
+
- Report a training-majority-class baseline and a simple decision tree, using only pre-outcome features.
|
| 47 |
+
- Fit encoders on training data only; tune on validation; evaluate the held-out test once.
|
| 48 |
+
- Report precision, recall, F1, confusion matrix and class counts, not accuracy alone.
|
| 49 |
+
- Add a rule-based reference and explain that the target is deterministic.
|
| 50 |
+
- Never report synthetic scores as real-game AI capability. Do not use post-outcome columns as model inputs.
|
| 51 |
+
Acceptance: runnable evaluation script with fixed seed and recorded dependency versions.
|
| 52 |
+
|
| 53 |
+
## Phase 6 — Real game data pilot (future, separate work)
|
| 54 |
+
1. Choose browser or Roblox as the first instrumented platform; do not mix implementations silently.
|
| 55 |
+
2. Add opt-in local export before any network collection. Collect events, not raw key streams.
|
| 56 |
+
3. Suggested events: encounter, collision, death, respawn, quest choice and chapter completion. Add game revision, platform and schema version.
|
| 57 |
+
4. Use fresh random session IDs; exclude account IDs, names, chat, IP addresses and exact wall-clock times. For any real player pilot, determine appropriate consent and retention controls before collecting or sharing.
|
| 58 |
+
5. Verify callbacks fire once per obstacle; paused time is excluded; repeat death callbacks are deduplicated; death occurs on the second distinct hit; distance resets correctly. Test multiple chapter setups.
|
| 59 |
+
6. Start with author-controlled test sessions. Measure missing/duplicate events, invalid transitions and coverage. Human pilot data must not be public by default.
|
| 60 |
+
7. Split by player where stable, appropriately permitted grouping exists, otherwise by session and explicitly document residual cross-session leakage. Keep synthetic and real records separately labelled.
|
| 61 |
+
Acceptance: instrumentation tests, approved collection scope, reviewed export, provenance and privacy checks. No automatic collection is enabled by this package.
|
| 62 |
+
|
| 63 |
+
## Phase 7 — Community maintenance
|
| 64 |
+
- Ask contributors for reproducible bug reports, tests and clearly labelled synthetic scenarios.
|
| 65 |
+
- Reject unverified scraped material or unlabeled fabricated player records.
|
| 66 |
+
- Use patch releases for documentation corrections, minor releases for compatible additions, major releases for changed schema or label semantics.
|
| 67 |
+
- Preserve released revisions; document changed distributions and labels in a changelog.
|
| 68 |
+
- Review issues and contributions manually; a dataset release does not imply upstream Hugging Face endorsement.
|
| 69 |
+
|
| 70 |
+
## Suggested delivery sequence
|
| 71 |
+
Session 1: prepare and validate synthetic pilot (done).
|
| 72 |
+
Session 2: authenticate, upload, verify Hub viewer and loading, publish.
|
| 73 |
+
Session 3: add baseline and inspect failure cases.
|
| 74 |
+
Later: scope and implement consent-based instrumentation as a separate game PR.
|
| 75 |
+
These are work stages, not promises about elapsed time.
|
| 76 |
+
|
| 77 |
+
## Sources
|
| 78 |
+
- Hugging Face dataset cards: https://huggingface.co/docs/hub/datasets-cards
|
| 79 |
+
- Uploading datasets: https://huggingface.co/docs/hub/datasets-adding
|
| 80 |
+
- Python upload API: https://huggingface.co/docs/huggingface_hub/guides/upload
|
| 81 |
+
- Inspected game revision: https://github.com/ReethikaValluru/Game-Development/tree/3cb3217fa637ce5ff67e31ba0fcce568e08501fe
|
README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pretty_name: Sapiens Gameplay Synthetic Encounters
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
license: cc0-1.0
|
| 6 |
+
size_categories:
|
| 7 |
+
- 10K<n<100K
|
| 8 |
+
tags:
|
| 9 |
+
- synthetic
|
| 10 |
+
- gaming
|
| 11 |
+
- simulation
|
| 12 |
+
- tabular
|
| 13 |
+
configs:
|
| 14 |
+
- config_name: default
|
| 15 |
+
data_files:
|
| 16 |
+
- split: train
|
| 17 |
+
path: data/train.csv
|
| 18 |
+
- split: validation
|
| 19 |
+
path: data/validation.csv
|
| 20 |
+
- split: test
|
| 21 |
+
path: data/test.csv
|
| 22 |
+
---
|
| 23 |
+
# Sapiens Gameplay Synthetic Encounters — v0.1.0
|
| 24 |
+
|
| 25 |
+
**Entirely synthetic. No real players, recorded gameplay, engine execution, or book extracts.**
|
| 26 |
+
|
| 27 |
+
This educational dataset contains 12,000 obstacle encounters generated by an independent Python toy simulator. It illustrates collision classification, session-aware splitting and two-hit death/respawn state transitions inspired by the Sapiens game project. It is not an official Roblox, Hugging Face, or book-author dataset.
|
| 28 |
+
|
| 29 |
+
## Purpose and limits
|
| 30 |
+
Use for learning CSV ingestion, data validation, exploratory analysis and simple collision-classification pipelines. Do not use the data to estimate real player skill, chapter difficulty, retention, fairness, learning outcomes or game-engine performance. Training a model here mainly teaches it to reproduce simple deterministic rules. High accuracy is not evidence of real-world usefulness.
|
| 31 |
+
|
| 32 |
+
The three chapter labels are categorical context only: all chapters use identical synthetic mechanics. Obstacles are abstract classes, not verified chapter-specific game objects. Lane positions are sampled independently per encounter; actions have a sampled timing-valid flag rather than a physical jump trajectory. No lane transitions, collision geometry, cooldowns, network delay, supplies, quests, victory condition, animation, audio or elapsed respawn delay are simulated. Sessions continue for 40 encounters regardless of death; each death starts a new run within the same synthetic session.
|
| 33 |
+
|
| 34 |
+
## Collection and provenance
|
| 35 |
+
An AI assistant authored the generator, documentation and validation code for this project. Records are produced by seeded pseudorandom sampling, not by a language model inventing individual rows or by logging people. Seed: 20261116. Version: 0.1.0.
|
| 36 |
+
|
| 37 |
+
Reference for intended two-hit behavior: https://github.com/ReethikaValluru/Game-Development/tree/3cb3217fa637ce5ff67e31ba0fcce568e08501fe . The source game was inspected, but its engine was not run to produce these records. No source code or assets from the game are redistributed in this package.
|
| 38 |
+
|
| 39 |
+
300 sessions × 40 encounters. Each chapter has 100 sessions. Obstacles, lanes and actions are sampled uniformly; timing validity has probability 0.75. Forward distance increments are uniformly sampled from 8–25 metres per encounter. These are arbitrary simulation parameters, not measured distributions.
|
| 40 |
+
|
| 41 |
+
## Label definition
|
| 42 |
+
A different lane is safe. In the same lane, a low barrier requires a timing-valid jump, an overhead branch requires a timing-valid slide, and a solid block always collides. A first collision raises the hit counter to 1. A second collision sets `died` and `respawned` true and resets distance to 0; the next encounter starts with 0 hits. These labels are simulator outputs, not human annotations.
|
| 43 |
+
|
| 44 |
+
## Splits
|
| 45 |
+
| Split | Sessions | Encounters |
|
| 46 |
+
|---|---:|---:|
|
| 47 |
+
| train | 240 | 9,600 |
|
| 48 |
+
| validation | 30 | 1,200 |
|
| 49 |
+
| test | 30 | 1,200 |
|
| 50 |
+
|
| 51 |
+
Sessions are shuffled once with the recorded seed and assigned 80/10/10. No session appears in more than one split. Splits are not stratified by chapter and do not test new simulator mechanics or unseen policies.
|
| 52 |
+
|
| 53 |
+
## Data dictionary
|
| 54 |
+
| Column | Type | Meaning |
|
| 55 |
+
|---|---|---|
|
| 56 |
+
| event_id | string | Unique synthetic encounter ID |
|
| 57 |
+
| session_id | string | Artificial grouping ID, not a user ID |
|
| 58 |
+
| encounter_index | integer | 0–39 within session |
|
| 59 |
+
| chapter | string | cognitive, agricultural, scientific |
|
| 60 |
+
| obstacle_type | string | solid_block, low_barrier, overhead_branch |
|
| 61 |
+
| obstacle_lane | integer | -1 left, 0 centre, 1 right |
|
| 62 |
+
| player_lane | integer | Player lane at encounter |
|
| 63 |
+
| action | string | run, jump, slide |
|
| 64 |
+
| timing_valid | boolean | Sampled action-timing validity |
|
| 65 |
+
| hits_before | integer | 0 or 1 before encounter |
|
| 66 |
+
| collision | boolean | Target: whether contact occurs |
|
| 67 |
+
| hits_after | integer | 0–2 immediately after encounter, before reset |
|
| 68 |
+
| died | boolean | Second hit reached |
|
| 69 |
+
| respawned | boolean | Immediate abstract respawn indicator |
|
| 70 |
+
| distance_before_m | float | Position at encounter before outcome |
|
| 71 |
+
| distance_after_m | float | Same position, or 0 after death |
|
| 72 |
+
| source | string | Always synthetic |
|
| 73 |
+
| simulator_version | string | Always 0.1.0 |
|
| 74 |
+
|
| 75 |
+
CSV booleans are `True` and `False`. Missing values are not expected.
|
| 76 |
+
|
| 77 |
+
## Load locally
|
| 78 |
+
```python
|
| 79 |
+
from datasets import load_dataset
|
| 80 |
+
rows = load_dataset('csv', data_files={
|
| 81 |
+
'train': 'data/train.csv',
|
| 82 |
+
'validation': 'data/validation.csv',
|
| 83 |
+
'test': 'data/test.csv',
|
| 84 |
+
})
|
| 85 |
+
print(rows)
|
| 86 |
+
```
|
| 87 |
+
After publishing, replace the local CSV call with `load_dataset('YOUR_NAMESPACE/sapiens-gameplay-synthetic')`. This is a placeholder, not a live repository URL.
|
| 88 |
+
|
| 89 |
+
## Reproduce and validate
|
| 90 |
+
Python 3.10+; generation and validation use only the standard library:
|
| 91 |
+
```sh
|
| 92 |
+
python generate.py
|
| 93 |
+
python validate.py
|
| 94 |
+
```
|
| 95 |
+
`manifest.json` records hashes and provenance; `validation_report.json` records actual checks and counts. The validator checks unique IDs, schema, split isolation, temporal continuity, collision examples, two-hit death, zero-distance respawn and exact deterministic regeneration. Checks do not establish parity with the real game.
|
| 96 |
+
|
| 97 |
+
## Avoid target leakage
|
| 98 |
+
For predicting `collision`, use only `obstacle_type`, `obstacle_lane`, `player_lane`, `action` and `timing_valid`. Never include `hits_after`, `died`, `respawned` or `distance_after_m`: they expose the outcome. IDs, chapter and provenance fields should not be predictive features. `timing_valid` is known in this toy simulator; a real pre-action predictor would need a different feature definition. Use the provided session split, not random rows.
|
| 99 |
+
|
| 100 |
+
## Privacy and licensing
|
| 101 |
+
No personal data, timestamps, network addresses, player names, copyrighted book passages, images or audio are included. Newly generated tabular records are offered under CC0 1.0: https://creativecommons.org/publicdomain/zero/1.0/ . Scripts are under the MIT license in LICENSE-CODE. These licenses do not cover the referenced game, third-party brands, books or assets.
|
| 102 |
+
|
| 103 |
+
## Maintenance
|
| 104 |
+
Version 0.1.0 is a synthetic pilot. Keep future real telemetry in a separate dataset/configuration with documented permission, minimisation and provenance. Do not overwrite this release with real-player records. See PLAN.md for milestones and release checks.
|
generate.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Reproducible event-level toy simulator; NOT exported game telemetry."""
|
| 2 |
+
import csv, hashlib, json, random
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
ROOT=Path(__file__).resolve().parent
|
| 5 |
+
SEED=20261116
|
| 6 |
+
FIELDS='event_id session_id encounter_index chapter obstacle_type obstacle_lane player_lane action timing_valid hits_before collision hits_after died respawned distance_before_m distance_after_m source simulator_version'.split()
|
| 7 |
+
|
| 8 |
+
def outcome(obstacle, obstacle_lane, player_lane, action, timing, hits):
|
| 9 |
+
safe=obstacle_lane!=player_lane or (timing and ((obstacle=='low_barrier' and action=='jump') or (obstacle=='overhead_branch' and action=='slide')))
|
| 10 |
+
collision=not safe
|
| 11 |
+
after=hits+int(collision)
|
| 12 |
+
return collision, after, after==2
|
| 13 |
+
|
| 14 |
+
def generate():
|
| 15 |
+
rng=random.Random(SEED)
|
| 16 |
+
sessions=list(range(300)); rng.shuffle(sessions)
|
| 17 |
+
split_map={s:('train' if i<240 else 'validation' if i<270 else 'test') for i,s in enumerate(sessions)}
|
| 18 |
+
rows={s:[] for s in ('train','validation','test')}
|
| 19 |
+
for session in range(300):
|
| 20 |
+
hits=0;distance=0.0
|
| 21 |
+
for event in range(40):
|
| 22 |
+
obstacle=rng.choice(['solid_block','low_barrier','overhead_branch'])
|
| 23 |
+
ol=rng.choice([-1,0,1]);pl=rng.choice([-1,0,1])
|
| 24 |
+
action=rng.choice(['run','jump','slide']);timing=rng.random()<0.75
|
| 25 |
+
distance=round(distance+rng.uniform(8,25),2)
|
| 26 |
+
collision,after,dead=outcome(obstacle,ol,pl,action,timing,hits)
|
| 27 |
+
row=dict(zip(FIELDS,[f'syn-{session:04d}-{event:03d}',f'syn-{session:04d}',event,
|
| 28 |
+
['cognitive','agricultural','scientific'][session%3],obstacle,ol,pl,action,timing,hits,
|
| 29 |
+
collision,after,dead,dead,distance,0.0 if dead else distance,'synthetic','0.1.0']))
|
| 30 |
+
rows[split_map[session]].append(row)
|
| 31 |
+
hits=0 if dead else after
|
| 32 |
+
if dead:distance=0.0
|
| 33 |
+
return rows
|
| 34 |
+
|
| 35 |
+
def main():
|
| 36 |
+
(ROOT/'data').mkdir(exist_ok=True)
|
| 37 |
+
for split,rows in generate().items():
|
| 38 |
+
with (ROOT/'data'/f'{split}.csv').open('w',newline='') as f:
|
| 39 |
+
writer=csv.DictWriter(f,fieldnames=FIELDS);writer.writeheader();writer.writerows(rows)
|
| 40 |
+
manifest={'version':'0.1.0','seed':SEED,'sessions':300,'encounters_per_session':40,
|
| 41 |
+
'provenance':'Independent simplified synthetic event simulator; no real player data; not an engine replay.',
|
| 42 |
+
'reference_game_commit':'3cb3217fa637ce5ff67e31ba0fcce568e08501fe',
|
| 43 |
+
'files':{p.name:hashlib.sha256(p.read_bytes()).hexdigest() for p in sorted((ROOT/'data').glob('*.csv'))}}
|
| 44 |
+
(ROOT/'manifest.json').write_text(json.dumps(manifest,indent=2)+'\n')
|
| 45 |
+
if __name__=='__main__':main()
|
manifest.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"version": "0.1.0",
|
| 3 |
+
"seed": 20261116,
|
| 4 |
+
"sessions": 300,
|
| 5 |
+
"encounters_per_session": 40,
|
| 6 |
+
"provenance": "Independent simplified synthetic event simulator; no real player data; not an engine replay.",
|
| 7 |
+
"reference_game_commit": "3cb3217fa637ce5ff67e31ba0fcce568e08501fe",
|
| 8 |
+
"files": {
|
| 9 |
+
"test.csv": "8c8a736b68ad21dd36a4ea245b30014bc200797b5c4323d86eb8bda58e078da3",
|
| 10 |
+
"train.csv": "a95406db518b8ffd53d52c43a2bae5182626c0c94e61ba8b6f1a5dd6711f21c7",
|
| 11 |
+
"validation.csv": "1d384b19285edf748c5e376c74f82dc3fa0ac56ec30e2f6f0001641df07c28d6"
|
| 12 |
+
}
|
| 13 |
+
}
|
validate.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Check schema, temporal invariants, split isolation, and deterministic generation."""
|
| 2 |
+
import csv,hashlib,json
|
| 3 |
+
from itertools import product
|
| 4 |
+
from generate import ROOT,FIELDS,generate,outcome
|
| 5 |
+
|
| 6 |
+
def main():
|
| 7 |
+
manifest=json.loads((ROOT/'manifest.json').read_text())
|
| 8 |
+
expected=generate();seen=set();ids=set();report={}
|
| 9 |
+
for split in ('train','validation','test'):
|
| 10 |
+
p=ROOT/'data'/f'{split}.csv'
|
| 11 |
+
assert hashlib.sha256(p.read_bytes()).hexdigest()==manifest['files'][p.name]
|
| 12 |
+
with p.open() as f:
|
| 13 |
+
reader=csv.DictReader(f);assert reader.fieldnames==FIELDS;rows=list(reader)
|
| 14 |
+
assert rows==[{k:str(v) for k,v in r.items()} for r in expected[split]]
|
| 15 |
+
sessions={r['session_id'] for r in rows};assert not seen & sessions;seen|=sessions
|
| 16 |
+
previous={};collisions=deaths=0
|
| 17 |
+
for r in rows:
|
| 18 |
+
assert r['event_id'] not in ids;ids.add(r['event_id'])
|
| 19 |
+
assert r['source']=='synthetic'
|
| 20 |
+
before=int(r['hits_before']);after=int(r['hits_after']);hit=r['collision']=='True';dead=r['died']=='True'
|
| 21 |
+
assert before in (0,1) and after==before+int(hit)
|
| 22 |
+
assert dead==(after==2) and (r['respawned']=='True')==dead
|
| 23 |
+
assert float(r['distance_after_m'])==(0.0 if dead else float(r['distance_before_m']))
|
| 24 |
+
prior=previous.get(r['session_id'])
|
| 25 |
+
if prior:
|
| 26 |
+
assert int(r['encounter_index'])==int(prior['encounter_index'])+1
|
| 27 |
+
assert before==(0 if prior['died']=='True' else int(prior['hits_after']))
|
| 28 |
+
assert float(r['distance_before_m'])>float(prior['distance_after_m'])
|
| 29 |
+
else:assert before==0 and int(r['encounter_index'])==0
|
| 30 |
+
previous[r['session_id']]=r;collisions+=hit;deaths+=dead
|
| 31 |
+
report[split]={'rows':len(rows),'sessions':len(sessions),'collisions':collisions,'deaths':deaths}
|
| 32 |
+
# Explicit expected cases, independently stated.
|
| 33 |
+
assert outcome('solid_block',0,0,'jump',True,1)==(True,2,True)
|
| 34 |
+
assert outcome('low_barrier',0,0,'jump',True,0)==(False,0,False)
|
| 35 |
+
assert outcome('low_barrier',0,0,'jump',False,0)==(True,1,False)
|
| 36 |
+
assert outcome('overhead_branch',0,0,'slide',True,1)==(False,1,False)
|
| 37 |
+
assert outcome('solid_block',0,1,'run',False,1)==(False,1,False)
|
| 38 |
+
assert len(ids)==12000 and len(seen)==300
|
| 39 |
+
result={'status':'passed','checks':['schema','unique events','session-disjoint splits','state continuity','two-hit death','respawn distance zero','deterministic regeneration','SHA256 integrity','explicit collision cases'],'splits':report}
|
| 40 |
+
(ROOT/'validation_report.json').write_text(json.dumps(result,indent=2)+'\n')
|
| 41 |
+
print(json.dumps(result,indent=2))
|
| 42 |
+
if __name__=='__main__':main()
|
validation_report.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"status": "passed",
|
| 3 |
+
"checks": [
|
| 4 |
+
"schema",
|
| 5 |
+
"unique events",
|
| 6 |
+
"session-disjoint splits",
|
| 7 |
+
"state continuity",
|
| 8 |
+
"two-hit death",
|
| 9 |
+
"respawn distance zero",
|
| 10 |
+
"deterministic regeneration",
|
| 11 |
+
"SHA256 integrity",
|
| 12 |
+
"explicit collision cases"
|
| 13 |
+
],
|
| 14 |
+
"splits": {
|
| 15 |
+
"train": {
|
| 16 |
+
"rows": 9600,
|
| 17 |
+
"sessions": 240,
|
| 18 |
+
"collisions": 2626,
|
| 19 |
+
"deaths": 1257
|
| 20 |
+
},
|
| 21 |
+
"validation": {
|
| 22 |
+
"rows": 1200,
|
| 23 |
+
"sessions": 30,
|
| 24 |
+
"collisions": 341,
|
| 25 |
+
"deaths": 165
|
| 26 |
+
},
|
| 27 |
+
"test": {
|
| 28 |
+
"rows": 1200,
|
| 29 |
+
"sessions": 30,
|
| 30 |
+
"collisions": 347,
|
| 31 |
+
"deaths": 165
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
}
|