"""Judgments from outcome-hidden names, descriptions and tags; single reader."""
from pathlib import Path
import json,hashlib
import pandas as pd
R=Path(__file__).resolve().parent
raw=json.loads((R/'direction_pilot_blind.json').read_text())
major={2,3,4,5,6,7,8,9,10,14,16,17,18,20,22,23}
related={1,11,12,15,19,21}
notes={0:'Anthology versus one action game: no single previous core loop to compare.',
1:'Monster collecting and turn-based party play persist; exploration/run structure changes.',
2:'Tactical action to 4X; shared ENDLESS identity can remain.',3:'Brewing simulation to licensed FPS.',
4:'Factory management to lottery/card systems.',5:'Platforming to racing while retaining Sonic identity.',
6:'Bullet-hell shooter to Sokoban-like puzzle adventure.',7:'Mech action-platforming to turn-based squad strategy.',
8:'Versus fighting to PvE roguelite combat.',9:'Tower defense to fighting; store chronology warrants separate prior-release check.',
10:'Action platforming to side-scrolling shooter, explicitly the same fictional sequel.',
11:'Both descriptions/tag sets retain action and story; degree of loop change uncertain.',
12:'Combat racing remains the central advertised activity.',13:'Political simulation versus detective narrative; short pitches insufficient to compare actual core interaction.',
14:'Starfighter simulation to survival horror remake.',15:'Both tower defense; map expansion is a new mechanic within it.',
16:'Competitive medieval melee to cooperative zombie shooting.',17:'Platform fighting to multiplayer board game.',
18:'City management to action roguelite.',19:'Related side-scrolling action/RPG and beat-em-up structures.',
20:'Multiplayer political party game to single-player solitaire/puzzle.',21:'Both multiplayer shooters; survival/building/extraction changes within a related broad activity.',
22:'Survival horror to isometric action roguelike; Black Iron Prison identity remains.',
23:'Exploration/roleplay to romance/visual novel; recognizable fictional setting/tone may persist.'}
rows=[]
for i,r in enumerate(raw):
 rows.append(dict(appid=r['appid'],previous_appid=r['previous_appid'],developer=r['developer'],name=r['name'],previous_name=r['previous_name'],
                  judgment='major_activity_change' if i in major else ('related_variation' if i in related else 'unclear'),note=notes[i]))
p=R/'direction_labels.json';p.write_text(json.dumps(rows,indent=2,ensure_ascii=False))
(R/'direction_labels_frozen.json').write_text(json.dumps(dict(sha256=hashlib.sha256(p.read_bytes()).hexdigest(),outcomes_seen=False,scope='Single-reader pilot inside already selected low tag-overlap, prior1000+ population. Not general change-of-genre prevalence or causal transfer.'),indent=2))
print(pd.DataFrame(rows).judgment.value_counts().to_string())
