BhargavMN commited on
Commit ·
0acfbcd
1
Parent(s): 01da2ab
data set for fine tuning
Browse filesFiles changed (8)
136 unmodified lines137138139136 unmodified linesscripts/tag/test_pipeline.pyscripts/tag/validate_dataset.pyscripts/tag/validator.py136 unmodified lines137138139140141142143144145146147136 unmodified linesscripts/tag/test_pipeline.pyscripts/tag/validate_dataset.pyscripts/tag/validator.pyprompts/dataset_generation_context.mdscripts/common/batching.pyscripts/common/test_batching.pyscripts/scavenger_hunt/validator.pyscripts/scavenger_hunt/test_pipeline.pyscripts/scavenger_hunt/generator.pyscripts/common/cli.pyscripts/.batch_key_state.json
2788 unmodified lines278927902791279227932788 unmodified lines"estimated_total_time_minutes": 45,"quality_score": 4.8}}]2788 unmodified lines278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636872788 unmodified lines"estimated_total_time_minutes": 45,"quality_score": 4.8}},{"id": "TG-LOS-0023","input": {"game_type": "tag","location": {"city": "Lagos","country": "Nigeria","city_code": "LOS","landscape_tags": ["market_outdoor","dense_urban_grid","coastal_waterfront","food_market"],"urban_density": "hyper_dense","climate_zone": "tropical","area_type": "waterfront"},"players": {"count": 10,"team_count": 1,"age_group": "mixed_family","mobility": "standard"},"preferences": {"duration_minutes": 120,"difficulty": "easy","theme": "urban_exploration","allow_transport": false}},"output": {"game_title": "The Waterfront Market Chase","rules": {"objective": "Avoid being tagged by 'It' players by reaching designated safe zones.","tag_variant": "safe_zone_tag","it_count": 2,"round_count": 6,"round_time_minutes": 20,"tag_mechanic": "A tag is made by an open-hand touch on any part of the body, accompanied by a clear verbal call-out of 'Tag!'. Grabbing, pushing, or pulling clothing is strictly prohibited.","unfreeze_or_revival_rule": "Tagged players are out for the current round.","win_condition": "Be the last player untagged when the round time expires."},"arena": {"boundary_description": "The play area is contained within the bustling outdoor market, bordered by the grid thoroughfares on two sides and the coastal waterfront promenade on another. The food market stalls delineate an inner boundary.","boundary_landscape_tags_used": ["market_outdoor","dense_urban_grid","coastal_waterfront","food_market"],"arena_size_tier": "medium","out_of_bounds": ["Beyond the market boundaries","into active roadways of the dense urban grid","any entry into the coastal waterfront or its immediate banks"]},"safe_zones": [{"zone_id": "S01","description": "The raised platform near the large market entrance.","landscape_tags_used": ["market_outdoor"],"capacity_rule": "Max 3 players, 15-second limit.","safety_flags": ["watch for tripping hazards"]},{"zone_id": "S02","description": "The covered seating area within the food market.","landscape_tags_used": ["food_market"],"capacity_rule": "Max 3 players, 15-second limit.","safety_flags": ["ensure clear path to exit"]}],"movement_features": {"chokepoints": ["Narrow aisles between market stalls","congested pathways within the food market","pedestrian crossings at the edge of the dense urban grid"],"open_zones": ["The wide open area at the heart of the outdoor market","the extended coastal waterfront promenade"],"hazard_zones": ["Coastal water edges, which may have slippery surfaces due to spray","active vehicle roadways within the dense urban grid","crowded market aisles with potential for bumping and tripping hazards from goods"]},"safety_constraints": {"exclusion_zones": ["private_property","active_roadway","construction_sites","restricted_government_buildings","water_edge"],"physical_limits": ["no grabbing or pushing — tag is an open-hand touch only","no climbing","no jumping","no water entry","no entering buildings","no running across any roadway"],"collision_safety_note": "Players must be highly aware of other pedestrians and market stalls in this hyper-dense environment. Exercise caution for sudden stops, blind corners, and potential tripping hazards from goods on the ground in market aisles.","adult_supervision_required": true,"notes": "Tropical climate: Players must stay well-hydrated and seek shade frequently. Adult supervisors should ensure shade access is available within 10 minutes of any point in the arena. Be aware of slippery surfaces near the waterfront."},"scoring": {"method": "survival_time","winning_condition_detail": "The player who remains untagged for the longest cumulative time across all rounds wins the game."},"estimated_total_time_minutes": 120,"quality_score": 4.7}},{"id": "TG-BOM-0024","input": {"game_type": "tag","location": {"city": "Mumbai","country": "India","city_code": "BOM","landscape_tags": ["market_outdoor","religious_site_accessible","dense_urban_grid","coastal_waterfront","food_market"],"urban_density": "hyper_dense","climate_zone": "tropical","area_type": "city_center"},"players": {"count": 16,"team_count": 1,"age_group": "teens","mobility": "standard"},"preferences": {"duration_minutes": 60,"difficulty": "hard","theme": "urban_exploration","allow_transport": false}},"output": {"game_title": "Urban Grid Chain Chase","rules": {"objective": "Avoid being tagged by the 'It' chain; tagged players join the chain to make it longer.","tag_variant": "chain_tag","it_count": 2,"round_count": 4,"round_time_minutes": 15,"tag_mechanic": "A tag is made by an open-hand touch on any part of the body, accompanied by a clear verbal call-out of 'Tag!'. Grabbing, pushing, or pulling clothing is strictly prohibited.","unfreeze_or_revival_rule": "Tagged players immediately join the 'It' chain by holding hands with a player already in the chain. The chain must remain connected.","win_condition": "The last player(s) not part of the 'It' chain when the round time expires wins the round."},"arena": {"boundary_description": "The expansive play area encompasses a dynamic outdoor market, a publicly accessible religious site, and extends through parts of the dense urban grid, reaching towards the coastal waterfront promenade. The food market sections are within the boundaries.","boundary_landscape_tags_used": ["market_outdoor","religious_site_accessible","dense_urban_grid","coastal_waterfront","food_market"],"arena_size_tier": "wide","out_of_bounds": ["Beyond the designated market perimeter","crossing into active vehicle traffic lanes of the dense urban grid","entering private property","any entry into the coastal waterfront or its immediate banks","inside religious building interiors"]},"safe_zones": [{"zone_id": "S01","description": "The shaded courtyard of the accessible religious site.","landscape_tags_used": ["religious_site_accessible"],"capacity_rule": "Max 4 players, 10-second limit.","safety_flags": ["respect quiet zones"]},{"zone_id": "S02","description": "A designated open space within the outdoor food market.","landscape_tags_used": ["food_market","market_outdoor"],"capacity_rule": "Max 4 players, 10-second limit.","safety_flags": ["watch for uneven surfaces"]}],"movement_features": {"chokepoints": ["Narrow alleyways within the dense urban grid","congested paths between outdoor market stalls","archways leading into the religious site's courtyards"],"open_zones": ["the square area of the outdoor market","the open plaza near the religious site entrance","sections of the coastal waterfront promenade"],"hazard_zones": ["Coastal water edges, which can be slippery due to spray or algae","active roadways with vehicle traffic within the dense urban grid","crowded market areas with potential for collisions and uneven ground","steep steps or ramps within the religious site area"]},"safety_constraints": {"exclusion_zones": ["private_property","active_roadway","construction_sites","restricted_government_buildings","water_edge","religious_interiors"],"physical_limits": ["no grabbing or pushing — tag is an open-hand touch only","no climbing","no jumping","no water entry","no entering buildings","no running across any roadway"],"collision_safety_note": "Players must be extremely vigilant for other pedestrians, moving market carts, and uneven ground in the hyper-dense market and urban grid. Maintain awareness of blind corners in alleyways and avoid running near the steep drops at the waterfront edge.","adult_supervision_required": false,"notes": "Tropical climate: Players must stay well-hydrated and seek shade frequently. Require shade access to be available within 10 minutes of any point in the arena. Be aware of slippery surfaces near the waterfront and potential crowded conditions."},"scoring": {"method": "last_untagged_wins","winning_condition_detail": "The player who is the last one not part of the 'It' chain at the end of the final round wins the game."},"estimated_total_time_minutes": 60,"quality_score": 4.6}},{"id": "TG-BOM-0025","input": {"game_type": "tag","location": {"city": "Mumbai","country": "India","city_code": "BOM","landscape_tags": ["religious_site_accessible","dense_urban_grid","coastal_waterfront"],"urban_density": "hyper_dense","climate_zone": "tropical","area_type": "waterfront"},"players": {"count": 14,"team_count": 1,"age_group": "mixed_family","mobility": "standard"},"preferences": {"duration_minutes": 90,"difficulty": "medium","theme": "nature","allow_transport": false}},"output": {"game_title": "Waterfront Freeze Pursuit","rules": {"objective": "Avoid being tagged by 'It' players; unfreeze teammates to keep the game going.","tag_variant": "freeze_tag","it_count": 2,"round_count": 5,"round_time_minutes": 18,"tag_mechanic": "A tag is made by an open-hand touch on any part of the body, accompanied by a clear verbal call-out of 'Tag!'. Grabbing, pushing, or pulling clothing is strictly prohibited.","unfreeze_or_revival_rule": "Frozen players must stand still until unfrozen by a teammate's open-hand touch.","win_condition": "Be the last player unfrozen when the round time expires."},"arena": {"boundary_description": "The play area spans a section of the dense urban grid, including a publicly accessible religious site and extending along the coastal waterfront promenade.","boundary_landscape_tags_used": ["religious_site_accessible","dense_urban_grid","coastal_waterfront"],"arena_size_tier": "medium","out_of_bounds": ["Beyond the urban grid's pedestrian zones","into active vehicle roadways","any entry into the coastal waterfront or its immediate banks","inside religious building interiors"]},"safe_zones": [{"zone_id": "S01","description": "The shaded veranda within the accessible religious site.","landscape_tags_used": ["religious_site_accessible"],"capacity_rule": "Max 3 players, 10-second limit.","safety_flags": ["respect quiet zones"]},{"zone_id": "S02","description": "A designated seating area on the waterfront promenade.","landscape_tags_used": ["coastal_waterfront"],"capacity_rule": "Max 3 players, 10-second limit.","safety_flags": ["watch for slippery surfaces near water"]}],"movement_features": {"chokepoints": ["Narrow passages between buildings in the dense urban grid","archways leading into the religious site","gaps between vendors along the waterfront"],"open_zones": ["The open plaza area of the religious site","the wide sections of the coastal waterfront promenade"],"hazard_zones": ["Coastal water edges, which can be slippery due to spray or algae","active roadways with fast-moving traffic within the dense urban grid","uneven stone pathways and steps within the religious site"]},"safety_constraints": {"exclusion_zones": ["private_property","active_roadway","construction_sites","restricted_government_buildings","water_edge","religious_interiors"],"physical_limits": ["no grabbing or pushing — tag is an open-hand touch only","no climbing","no jumping","no water entry","no entering buildings","no running across any roadway"],"collision_safety_note": "Players must maintain constant awareness of other pedestrians and obstacles in the dense urban grid and along the waterfront. Be cautious of blind corners and sudden changes in elevation near the religious site, and slippery surfaces near the water's edge.","adult_supervision_required": true,"notes": "Tropical climate: Players must stay well-hydrated and seek shade frequently. Adult supervisors should ensure shade access is available within 10 minutes of any point in the arena. Be aware of slippery surfaces near the waterfront."},"scoring": {"method": "survival_time","winning_condition_detail": "The player who remains unfrozen for the longest cumulative time across all rounds wins the game."},"estimated_total_time_minutes": 90,"quality_score": 4.6}},{"id": "TG-IST-0026","input": {"game_type": "tag","location": {"city": "Istanbul","country": "Turkey","city_code": "IST","landscape_tags": ["plaza_or_square","historic_district","market_covered","hill_or_elevation"],"urban_density": "dense","climate_zone": "mediterranean","area_type": "city_center"},"players": {"count": 10,"team_count": 1,"age_group": "adults","mobility": "limited"},"preferences": {"duration_minutes": 120,"difficulty": "medium","theme": "urban_exploration","allow_transport": false}},"output": {"game_title": "Historic District Freeze Out","rules": {"objective": "Avoid being tagged by 'It' players and unfreeze your teammates.","tag_variant": "freeze_tag","it_count": 2,"round_count": 6,"round_time_minutes": 20,"tag_mechanic": "A tag is made by an open-hand touch on any part of the body, accompanied by a clear verbal call-out of 'Tag!'. Grabbing, pushing, or pulling clothing is strictly prohibited.","unfreeze_or_revival_rule": "Frozen players must stand still until unfrozen by a teammate's open-hand touch.","win_condition": "Be the last player unfrozen when the round time expires."},"arena": {"boundary_description": "The play area is defined by the pedestrian zones of a historic district, encompassing a grand plaza, a bustling covered market, and the base of a significant elevation.","boundary_landscape_tags_used": ["plaza_or_square","historic_district","market_covered","hill_or_elevation"],"arena_size_tier": "medium","out_of_bounds": ["Beyond the designated pedestrian pathways","into active vehicle roadways","inside private establishments within the covered market"]},"safe_zones": [{"zone_id": "S01","description": "the fountain area within the large plaza.","landscape_tags_used": ["plaza_or_square"],"capacity_rule": "Max 2 players, 10-second limit.","safety_flags": ["watch for uneven paving"]},{"zone_id": "S02","description": "A designated waiting area inside the covered market.","landscape_tags_used": ["market_covered"],"capacity_rule": "Max 2 players, 10-second limit.","safety_flags": ["mind your step on inclines"]}],"movement_features": {"chokepoints": ["Narrow alleys within the historic district","entrances and exits of the covered market","steep, winding passages leading up the hill or elevation"],"open_zones": ["The expansive open space of the plaza or square","the wide corridors within the covered market"],"hazard_zones": ["Steep inclines and declines with potential for slips","uneven cobblestone surfaces in the historic district","crowded passages within the covered market with low visibility"]},"safety_constraints": {"exclusion_zones": ["private_property","active_roadway","construction_sites","restricted_government_buildings"],"physical_limits": ["no grabbing or pushing — tag is an open-hand touch only","no climbing","no jumping","no water entry","no entering buildings","no running across any roadway"],"collision_safety_note": "Players must be aware of other pedestrians and market stalls. Exercise caution on uneven historic paving, especially on slopes, and navigate crowded covered market areas carefully, watching for blind corners and low-hanging objects.","adult_supervision_required": false,"notes": "Mediterranean climate: no special constraints regarding temperature; however, players should stay hydrated. Be mindful of uneven surfaces and potential slips on inclines and declines."},"scoring": {"method": "survival_time","winning_condition_detail": "The player who remains unfrozen for the longest cumulative time across all rounds wins the game."},"estimated_total_time_minutes": 120,"quality_score": 4.4}},{"id": "TG-CPT-0027","input": {"game_type": "tag","location": {"city": "Cape Town","country": "South Africa","city_code": "CPT","landscape_tags": ["historic_district","market_outdoor","hill_or_elevation","coastal_waterfront","garden_formal"],"urban_density": "mixed","climate_zone": "mediterranean","area_type": "mixed_residential"},"players": {"count": 5,"team_count": 2,"age_group": "mixed_family","mobility": "standard"},"preferences": {"duration_minutes": 90,"difficulty": "medium","theme": "social","allow_transport": true}},"output": {"game_title": "Coastal Garden Freeze","rules": {"objective": "As a team, avoid being tagged by the 'It' player and work together to unfreeze teammates.","tag_variant": "freeze_tag","it_count": 1,"round_count": 5,"round_time_minutes": 18,"tag_mechanic": "A tag is made by an open-hand touch on any part of the body, accompanied by a clear verbal call-out of 'Tag!'. Grabbing, pushing, or pulling clothing is strictly prohibited.","unfreeze_or_revival_rule": "Frozen players must stand still until unfrozen by a teammate's open-hand touch.","win_condition": "The team with the most unfrozen players at the end of the round or the last team with players remaining wins the round."},"arena": {"boundary_description": "The wide play area encompasses a historic district, a sprawling outdoor market, a formal garden, and extends to the coastal waterfront, including paths that traverse minor hills or elevations.","boundary_landscape_tags_used": ["historic_district","market_outdoor","hill_or_elevation","coastal_waterfront","garden_formal"],"arena_size_tier": "wide","out_of_bounds": ["Beyond the formal garden fences","into active vehicle roadways","into private residential areas","any entry into the coastal waterfront or its immediate banks"]},"safe_zones": [{"zone_id": "S01","description": "The gazebo structure within the formal garden.","landscape_tags_used": ["garden_formal"],"capacity_rule": "Max 2 players, 10-second limit.","safety_flags": ["watch for slippery steps"]},{"zone_id": "S02","description": "A designated shaded area within the outdoor market.","landscape_tags_used": ["market_outdoor"],"capacity_rule": "Max 2 players, 10-second limit.","safety_flags": ["clear path to exit"]}],"movement_features": {"chokepoints": ["Narrow pedestrian lanes in the historic district","paths winding through the market stalls","steep, winding paths on the hill or elevation","archways leading into the formal garden"],"open_zones": ["The wide open plaza within the historic district","the square of the outdoor market","the expansive lawns of the formal garden","the coastal waterfront promenade"],"hazard_zones": ["Coastal water edges, which can be slippery or have sudden drops","steep, uneven slopes and steps on the hills","crowded market pathways with potential for collisions and tripping hazards from goods"]},"safety_constraints": {"exclusion_zones": ["private_property","active_roadway","construction_sites","restricted_government_buildings","water_edge"],"physical_limits": ["no grabbing or pushing — tag is an open-hand touch only","no climbing","no jumping","no water entry","no entering buildings","no running across any roadway"],"collision_safety_note": "Players should be cautious of uneven ground and steep slopes, especially when running downhill. In crowded market areas, be mindful of other players and market structures. Watch for slippery surfaces near the waterfront.","adult_supervision_required": true,"notes": "Mediterranean climate: no special constraints regarding temperature; however, players should stay hydrated. Be mindful of uneven surfaces on hills and near the waterfront."},"scoring": {"method": "survival_time","winning_condition_detail": "The team with the highest cumulative unfrozen player time across all rounds wins the game."},"estimated_total_time_minutes": 90,"quality_score": 4.5}},{"id": "TG-CPT-0028","input": {"game_type": "tag","location": {"city": "Cape Town","country": "South Africa","city_code": "CPT","landscape_tags": ["hill_or_elevation","market_outdoor","coastal_waterfront"],"urban_density": "mixed","climate_zone": "mediterranean","area_type": "waterfront"},"players": {"count": 20,"team_count": 1,"age_group": "mixed_family","mobility": "limited"},"preferences": {"duration_minutes": 90,"difficulty": "hard","theme": "urban_exploration","allow_transport": false}},"output": {"game_title": "Waterfront Hilltop Freeze","rules": {"objective": "Avoid being tagged by the 'It' players; unfreeze teammates to stay in the game.","tag_variant": "freeze_tag","it_count": 3,"round_count": 5,"round_time_minutes": 18,"tag_mechanic": "A tag is made by an open-hand touch on any part of the body, accompanied by a clear verbal call-out of 'Tag!'. Grabbing, pushing, or pulling clothing is strictly prohibited.","unfreeze_or_revival_rule": "Frozen players must stand still until unfrozen by a teammate's open-hand touch.","win_condition": "Be the last player unfrozen when the round time expires."},"arena": {"boundary_description": "The wide play area encompasses a large outdoor market, paths traversing significant hills or elevations, and the extensive coastal waterfront promenade.","boundary_landscape_tags_used": ["hill_or_elevation","market_outdoor","coastal_waterfront"],"arena_size_tier": "wide","out_of_bounds": ["Beyond the market boundaries","into active vehicle roadways","private property","any entry into the coastal waterfront or its immediate banks"]},"safe_zones": [{"zone_id": "S01","description": "A sheltered alcove within the outdoor market.","landscape_tags_used": ["market_outdoor"],"capacity_rule": "Max 4 players, 10-second limit.","safety_flags": ["watch for uneven ground"]},{"zone_id": "S02","description": "The flat, paved lookout point on an elevated section.","landscape_tags_used": ["hill_or_elevation"],"capacity_rule": "Max 4 players, 10-second limit.","safety_flags": ["avoid slippery slopes"]}],"movement_features": {"chokepoints": ["Narrow staircases and winding paths on the hills or elevations","congested pathways between market stalls","pedestrian bridges crossing small inlets along the waterfront"],"open_zones": ["The expansive open area of the outdoor market square","the wide coastal waterfront promenade","flat plateau areas on the hills or elevations"],"hazard_zones": ["Coastal water edges, which can be slippery with sudden drops","steep, uneven slopes and steps with loose gravel","blind corners on winding paths","crowded market aisles with potential for collisions and hidden obstacles"]},"safety_constraints": {"exclusion_zones": ["private_property","active_roadway","construction_sites","restricted_government_buildings","water_edge"],"physical_limits": ["no grabbing or pushing — tag is an open-hand touch only","no climbing","no jumping","no water entry","no entering buildings","no running across any roadway"],"collision_safety_note": "Players with limited mobility should exercise extreme caution on steep and uneven terrain, watching for loose footing and blind corners. In crowded market areas, maintain awareness of others to avoid collisions. Be mindful of slippery surfaces and sudden drops near the waterfront.","adult_supervision_required": true,"notes": "Mediterranean climate: no special constraints regarding temperature; however, players should stay hydrated. Be highly aware of uneven surfaces, steep slopes, and slippery areas near the waterfront due to the 'limited' mobility group and 'hard' difficulty."},"scoring": {"method": "survival_time","winning_condition_detail": "The player who remains unfrozen for the longest cumulative time across all rounds wins the game."},"estimated_total_time_minutes": 90,"quality_score": 4.7}},{"id": "TG-BOG-0029","input": {"game_type": "tag","location": {"city": "Bogota","country": "Colombia","city_code": "BOG","landscape_tags": ["street_art_district","historic_district","plaza_or_square"],"urban_density": "dense","climate_zone": "temperate","area_type": "waterfront"},"players": {"count": 4,"team_count": 5,"age_group": "mixed_family","mobility": "standard"},"preferences": {"duration_minutes": 60,"difficulty": "hard","theme": "logic","allow_transport": false}},"output": {"game_title": "Historic Plaza Freeze","rules": {"objective": "Avoid being tagged by the 'It' players; unfreeze teammates to stay in the game.","tag_variant": "freeze_tag","it_count": 2,"round_count": 4,"round_time_minutes": 15,"tag_mechanic": "A tag is made by an open-hand touch on any part of the body, accompanied by a clear verbal call-out of 'Tag!'. Grabbing, pushing, or pulling clothing is strictly prohibited.","unfreeze_or_revival_rule": "Frozen players must stand still until unfrozen by a teammate's open-hand touch.","win_condition": "Be the last player unfrozen when the round time expires."},"arena": {"boundary_description": "The compact play area is defined by the pedestrian zones of a historic district, including a vibrant street art district and a the plaza or square.","boundary_landscape_tags_used": ["street_art_district","historic_district","plaza_or_square"],"arena_size_tier": "compact","out_of_bounds": ["Beyond the designated pedestrian paths","into active vehicle roadways","inside private buildings"]},"safe_zones": [{"zone_id": "S01","description": "The raised platform in the center of the plaza.","landscape_tags_used": ["plaza_or_square"],"capacity_rule": "Max 1 player, 10-second limit.","safety_flags": ["watch for uneven paving"]},{"zone_id": "S02","description": "A designated alcove within the historic district, adorned with street art.","landscape_tags_used": ["historic_district","street_art_district"],"capacity_rule": "Max 1 player, 10-second limit.","safety_flags": ["mind your step near obstacles"]}],"movement_features": {"chokepoints": ["Narrow passages and archways within the historic district","alleyways decorated with street art","entrances/exits to the plaza"],"open_zones": ["The wide open expanse of the plaza or square","broader pedestrian streets in the street art district"],"hazard_zones": ["Uneven cobblestone paths and unexpected steps within the historic district","blind corners in narrow alleys","crowded areas near popular street art installations"]},"safety_constraints": {"exclusion_zones": ["private_property","active_roadway","construction_sites","restricted_government_buildings"],"physical_limits": ["no grabbing or pushing — tag is an open-hand touch only","no climbing","no jumping","no water entry","no entering buildings","no running across any roadway"],"collision_safety_note": "Players must be aware of other pedestrians and obstacles in the dense historic district. Exercise caution on uneven paving and steps, and navigate narrow alleys carefully due to blind corners and potential crowded sections.","adult_supervision_required": true,"notes": "Temperate climate: no special constraints regarding temperature; however, players should stay hydrated. Be mindful of uneven surfaces and potential tripping hazards in the historic district."},"scoring": {"method": "survival_time","winning_condition_detail": "The player who remains unfrozen for the longest cumulative time across all rounds wins the game."},"estimated_total_time_minutes": 60,"quality_score": 4.4}}]
20 unmodified lines2122232425262728293069 unmodified lines1001011021031041051061071081091 unmodified line11111211311411511611711811912012141 unmodified lines16316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930020 unmodified lines--seed INT fix random seed for sampling (optional)--mock skip Gemini, use built-in stub (pipeline smoke-test)"""import os, re, json, time, random, logging, argparsefrom sampler import sample_input, build_promptfrom validator import validate_example, auto_fixlogging.basicConfig(level=logging.INFO, format="%(asctime)s %(message)s")log = logging.getLogger("cq")69 unmodified linestasks = []for i in range(n_tasks):tag = tags[i % len(tags)]tasks.append({"task_id": f"T{i+1:02d}","title": f"Zone Study {i+1}","description": f"Within the zone characterised by {tag.replace('_',' ')}, locate and document the most structurally distinct feature visible from a public pedestrian path.","landscape_tags_used": [tag],"task_type": types_cycle[i % len(types_cycle)],"difficulty_contribution": diffs[i],1 unmodified line"completion_proof": "photograph submitted via app","estimated_time_minutes": per_task,"hints": {"hint_1": "Scan the area from the nearest open space.","hint_2": f"Move toward where {tag.replace('_',' ')} activity is densest and compare individual instances.","hint_3": f"Walk the main pedestrian route through the {tag.replace('_',' ')} zone; at the midpoint, turn to face the most varied cluster and document the single feature that differs most from its neighbours in scale or colour.",},"safety_flags": [],})bonus = (41 unmodified linesreturn json.dumps(out)# ── single example loop ───────────────────────────────────────────────────────def generate_one(record: dict, backend, max_retries: int = 2):"""Try up to (max_retries+1) times.On retry the validation errors are appended to the prompt so the modelknows exactly what to fix.Returns (example_dict, None) on success, (None, [errors]) on failure."""prompt = build_prompt(record)last_errors = []for attempt in range(max_retries + 1):full_prompt = promptif attempt > 0 and last_errors:full_prompt += ("\n\nYOUR PREVIOUS ATTEMPT FAILED THESE VALIDATION CHECKS:\n"+ "\n".join(f" • {e}" for e in last_errors[:8])+ "\nPlease fix every item listed above. Return ONLY the corrected JSON.")try:raw = backend(full_prompt)output_json = extract_json(raw)# the model sometimes wraps the output inside {"output": {...}}if "output" in output_json and isinstance(output_json["output"], dict):output_json = output_json["output"]ex = {**record, "output": output_json}ex = auto_fix(ex) # repair arithmetic firstok, errors = validate_example(ex)if ok:return ex, Nonelast_errors = errorslog.warning(" attempt %d/%d — %d error(s): %s",attempt + 1, max_retries + 1,len(errors), errors[0])except Exception as exc:last_errors = [f"PARSE/API error: {exc}"]log.warning(" attempt %d/%d — %s", attempt + 1, max_retries + 1, exc)return None, last_errors# ── main ──────────────────────────────────────────────────────────────────────def main():ap = argparse.ArgumentParser(description="CityQuest-AI dataset generator")ap.add_argument("--n", type=int, default=10, help="examples to generate this run")ap.add_argument("--output", default=DEFAULT_OUTPUT, help="output JSON file (resumes if exists)")ap.add_argument("--sleep", type=float, default=8.0, help="seconds between Gemini calls")ap.add_argument("--seed", type=int, default=None, help="random seed for reproducibility")ap.add_argument("--mock", action="store_true", help="use stub backend (no API key needed)")args = ap.parse_args()if args.seed is not None:random.seed(args.seed)if not args.mock and not os.environ.get("GEMINI_API_KEY"):log.error("GEMINI_API_KEY is not set.")log.error(" Windows (PowerShell): $env:GEMINI_API_KEY = 'your-key'")log.error(" Mac/Linux: export GEMINI_API_KEY='your-key'")returnbackend = call_mock if args.mock else call_geminiout_dir = os.path.dirname(args.output)if out_dir:os.makedirs(out_dir, exist_ok=True)# ── resume ────────────────────────────────────────────────────────────────dataset = []if os.path.exists(args.output):try:dataset = json.load(open(args.output, encoding="utf-8"))log.info("Resuming — loaded %d existing examples from %s", len(dataset), args.output)except json.JSONDecodeError:log.warning("Existing output file unreadable; starting fresh.")errors_path = args.output.replace(".json", "_errors.jsonl")start_idx = len(dataset) + 1kept = skipped = 0quota_exhausted = False# ── generation loop ───────────────────────────────────────────────────────for i in range(start_idx, start_idx + args.n):record = sample_input(i)city = record["input"]["location"]["city"]diff = record["input"]["preferences"]["difficulty"]dur = record["input"]["preferences"]["duration_minutes"]age = record["input"]["players"]["age_group"]log.info("[%d/%d] %s | %-12s | %-6s | %3d min | %s",i - start_idx + 1, args.n,record["id"], city, diff, dur, age)ex, errors = generate_one(record, backend)if ex:dataset.append(ex)kept += 1# incremental save — safe to interrupt at any pointwith open(args.output, "w", encoding="utf-8") as f:json.dump(dataset, f, indent=1, ensure_ascii=False)log.info(" ✓ saved (dataset total: %d)", len(dataset))else:skipped += 1with open(errors_path, "a", encoding="utf-8") as f:f.write(json.dumps({"id": record["id"], "errors": errors}) + "\n")log.info(" ✗ skipped after retries — logged to %s", errors_path)if not args.mock and any("RESOURCE_EXHAUSTED" in e or "429" in e for e in errors):log.warning(" quota exhausted on this API key — stopping run early")quota_exhausted = Truebreakif not args.mock:time.sleep(args.sleep)# ── summary ───────────────────────────────────────────────────────────────log.info("")log.info("══ DONE ══════════════════════════════════")log.info(" Kept : %d", kept)log.info(" Skipped : %d", skipped)log.info(" Total : %d → %s", len(dataset), args.output)if skipped:log.info(" Failures: %s", errors_path)if quota_exhausted:raise SystemExit(2)if __name__ == "__main__":main()20 unmodified lines212223242526272829303132333469 unmodified lines1041051061071081091101111121131141151 unmodified line11711811912012112212312412512612741 unmodified lines16917017117217317417517617720 unmodified lines--seed INT fix random seed for sampling (optional)--mock skip Gemini, use built-in stub (pipeline smoke-test)"""import os, re, json, time, random, logging, argparse, sysfrom sampler import sample_input, build_promptfrom validator import validate_example, auto_fixHERE = os.path.dirname(os.path.abspath(__file__))sys.path.insert(0, os.path.join(HERE, "..", "common"))from cq_common import has_risk_indicatorslogging.basicConfig(level=logging.INFO, format="%(asctime)s %(message)s")log = logging.getLogger("cq")69 unmodified linestasks = []for i in range(n_tasks):tag = tags[i % len(tags)]description = f"Within the zone characterised by {tag.replace('_',' ')}, locate and document the most structurally distinct feature visible from a public pedestrian path."flags = ["uneven paving may be slippery when wet", "watch for cyclists sharing the path"] if has_risk_indicators(description) else []tasks.append({"task_id": f"T{i+1:02d}","title": f"Zone Study {i+1}","description": description,"landscape_tags_used": [tag],"task_type": types_cycle[i % len(types_cycle)],"difficulty_contribution": diffs[i],1 unmodified line"completion_proof": "photograph submitted via app","estimated_time_minutes": per_task,"hints": {"hint_1": "Scan the area from open space.","hint_2": f"Move toward the {tag.replace('_',' ')} zone and compare features.","hint_3": f"Within the {tag.replace('_',' ')} zone, find the feature that differs most from its neighbours in scale or colour.",},"safety_flags": flags,})bonus = (41 unmodified linesreturn json.dumps(out)from cli import run_cli # noqa: E402if __name__ == "__main__":run_cli("scavenger_hunt", sample_input, build_prompt, auto_fix,validate_example, DEFAULT_OUTPUT, call_mock)
144 unmodified lines1451461471481491501511521531541551561571581591601611621631642 unmodified lines167168169170171172144 unmodified lines═══ ABSOLUTE RULES ═══1. NO proper nouns anywhere — no city names, landmark names, street names, brand names.Tasks must work purely from the landscape_tags.✓ GOOD: "Find the tallest structure visible from the main open square and photograph its base."✗ BAD: "Find the Eiffel Tower."2. Each task's landscape_tags_used must be a strict subset of: {json.dumps(loc["landscape_tags"])}3. Use at least 3 different task_type values from:{json.dumps(TASK_TYPES)}4. Hints per task:hint_1 = 5–15 words, directional nudge onlyhint_2 = 15–30 words, describes the feature to look for (longer than hint_1)hint_3 = 30–50 words, near-explicit walkthrough (longer than hint_2)All three hints must be meaningfully distinct from each other.5. No task may require: climbing, jumping, entering water, entering any building(exception: social_interaction tasks may enter public-facing shops).2 unmodified lines7. {bonus_instruction}═══ OUTPUT SHAPE ═══{{"game_title": "string",144 unmodified lines1451461471481491501511521531541551561571581591601611621631641651661671681691701711722 unmodified lines175176177178179180181182183184185186187188189190144 unmodified lines═══ ABSOLUTE RULES ═══1. NO proper nouns anywhere — no city names, landmark names, street names, brand names.Tasks must work purely from the landscape_tags.ALSO BANNED everywhere (description, title, hints, completion_proof — these leakcity-specific knowledge the player shouldn't need): "central", "main", "largest","most famous", "the famous", "best-known", "best known", "downtown", and "iconic"(unless followed by the word "landmark", e.g. "iconic landmark" is fine).✓ GOOD: "Find the tallest structure visible from the open square and photograph its base."✗ BAD: "Find the Eiffel Tower." / "...the main square..." / "...the most famous fountain..."2. Each task's landscape_tags_used must be a strict subset of: {json.dumps(loc["landscape_tags"])}3. Use at least 3 different task_type values from:{json.dumps(TASK_TYPES)}4. Hints per task — HARD character limits (count characters, not words):hint_1 = a short directional nudge, AT MOST 50 characters total.hint_2 = describes the feature to look for, AT MOST 80 characters total, longer than hint_1.hint_3 = a near-explicit walkthrough, AT MOST 120 characters total, longer than hint_2.All three hints must be meaningfully distinct from each other.hint_3 must NOT use spoiler phrases that give away exact spatial position relative toanother object, e.g. avoid "just before", "next to", "to the left of", "to the right of","near the corner of", "across from", "adjacent to", "directly behind", "right after","just past". Describe the feature itself instead of its position relative to something else.5. No task may require: climbing, jumping, entering water, entering any building(exception: social_interaction tasks may enter public-facing shops).2 unmodified lines7. {bonus_instruction}8. social_interaction tasks: completion_proof must require a photo, receipt, or otherphysical/digital artifact — NEVER a verbal-only response (no "tell us", "ask them","verbal answer", etc.).9. If a task's landscape_tags_used or description touches water, elevation/slopes/stairs,alleys/narrow passages, crowded areas, or dark/low-light areas, that task's safety_flagsmust contain AT LEAST 2 specific hazard mentions (e.g. naming the slippery surface, theblind corner, the steep step, the low visibility) — not generic phrases like "be careful"or "stay safe".═══ OUTPUT SHAPE ═══{{"game_title": "string",
48 unmodified lines4950515253545556575859606162636465666768697071727374757677787980818283848586878889909162 unmodified lines15415515615715815948 unmodified lines"tasks": [{"task_id": "T01", "title": "Square Census","description": "Stand at the center of the largest open civic square and count the benches visible without moving.","landscape_tags_used": ["plaza_or_square"],"task_type": "observe_and_answer","difficulty_contribution": "easy", "points": 10,"completion_proof": "verbal answer", "estimated_time_minutes": 10,"hints": {"hint_1": "Find the biggest open space nearby.","hint_2": "Open civic squares have no buildings inside and multiple pedestrian entry points leading to a central area.","hint_3": "Walk to where the most pedestrian paths converge, stand at the geometric centre, rotate slowly, and count every fixed seating unit you can see without moving your feet.",},"safety_flags": [],},{"task_id": "T02", "title": "Vendor Colours","description": "At an open-air market, photograph three vendor stalls whose canopies are three different colours.","landscape_tags_used": ["market_outdoor"],"task_type": "find_and_photograph","difficulty_contribution": "easy", "points": 10,"completion_proof": "photo", "estimated_time_minutes": 12,"hints": {"hint_1": "Follow the sounds of commerce.","hint_2": "Open-air markets cluster along wide pedestrian streets; look for rows of temporary stalls with overhead canopies.","hint_3": "Enter the market from its main entrance, walk one full aisle from start to finish, and photograph the first red, the first blue, and the first white canopy you pass.",},"safety_flags": [],},{"task_id": "T03", "title": "Tallest Sighting","description": "Find a spot where the tallest structure in the area is fully visible. Photograph it with at least one other person in frame.","landscape_tags_used": ["iconic_landmark"],"task_type": "reach_and_verify","difficulty_contribution": "easy", "points": 10,"completion_proof": "photo", "estimated_time_minutes": 14,"hints": {"hint_1": "Look up from the most open ground you can find.","hint_2": "Tall structures are easiest to see from squares or wide streets with no overhead obstruction — position yourself so the full height is unblocked.","hint_3": "Return to the open square, face the direction where rooftops are at their lowest, and the tallest structure will dominate your skyline; frame it with a teammate visible in the foreground.",},"safety_flags": [],},62 unmodified linesok, errs = validate_example(bad)check("T6: time overrun caught", not ok and any("TIME" in e for e in errs))# ── 7: sampler variety ────────────────────────────────────────────────────────print("\n── Sampler tests ─────────────────────────────────────")samples = [sample_input(i, rng=random.Random(i)) for i in range(1, 21)]48 unmodified lines4950515253545556575859606162636465666768697071727374757677787980818283848586878889909162 unmodified lines15415515615715815916016116216316416516616716816917017117217317417517617717817918018118248 unmodified lines"tasks": [{"task_id": "T01", "title": "Square Census","description": "Within the plaza area, count the benches visible while standing in one spot without moving.","landscape_tags_used": ["plaza_or_square"],"task_type": "observe_and_answer","difficulty_contribution": "easy", "points": 10,"completion_proof": "photo of the bench count tally", "estimated_time_minutes": 10,"hints": {"hint_1": "Find an open paved square.","hint_2": "Open squares have multiple pedestrian paths converging toward open paving.","hint_3": "Stand where several pedestrian paths meet in the open paving, rotate slowly, and count every fixed seat in view.",},"safety_flags": [],},{"task_id": "T02", "title": "Vendor Colours","description": "At the open-air market area, photograph three stalls whose canopies show three different colours.","landscape_tags_used": ["market_outdoor"],"task_type": "find_and_photograph","difficulty_contribution": "easy", "points": 10,"completion_proof": "photo", "estimated_time_minutes": 12,"hints": {"hint_1": "Follow sounds of trade and stalls.","hint_2": "Open-air markets line pedestrian streets with rows of canopied stalls.","hint_3": "Walk one full row of stalls end to end and photograph the first red, blue, and white canopy seen.",},"safety_flags": [],},{"task_id": "T03", "title": "Tallest Sighting","description": "Find a spot where a tall structure is fully visible and photograph it with a teammate in frame.","landscape_tags_used": ["iconic_landmark"],"task_type": "reach_and_verify","difficulty_contribution": "easy", "points": 10,"completion_proof": "photo", "estimated_time_minutes": 14,"hints": {"hint_1": "Look up from open ground nearby.","hint_2": "Tall structures are visible from open areas with no overhead blockage.","hint_3": "Stand in open paving facing where rooftops are lowest, then photograph the tall structure with a teammate in view.",},"safety_flags": [],},62 unmodified linesok, errs = validate_example(bad)check("T6: time overrun caught", not ok and any("TIME" in e for e in errs))# ── audit-fix failing fixtures ─────────────────────────────────────────────────bad = copy.deepcopy(GOOD)bad["output"]["tasks"][0]["description"] = "Within the main plaza area, count the benches visible while standing in one spot without moving."ok, errs = validate_example(bad)check("T11: soft city-leakage word 'main' caught", not ok and any("LEAK" in e for e in errs), errs)bad = copy.deepcopy(GOOD)bad["output"]["tasks"][0]["task_type"] = "social_interaction"bad["output"]["tasks"][0]["completion_proof"] = "ask a vendor and tell us their answer"ok, errs = validate_example(bad)check("T12: verbal-only social_interaction proof caught", not ok and any("PROOF" in e for e in errs), errs)bad = copy.deepcopy(GOOD)bad["output"]["tasks"][0]["description"] = "Walk along the water's edge near the alley and count the boats moored there."bad["output"]["tasks"][0]["safety_flags"] = []ok, errs = validate_example(bad)check("T13: water/alley task with <2 safety_flags caught", not ok and any("SAFETY" in e for e in errs), errs)bad = copy.deepcopy(GOOD)bad["output"]["tasks"][0]["hints"]["hint_3"] = "Walk to the plaza entrance, and the bench cluster is just before the fountain, next to the lamppost on the left side path."ok, errs = validate_example(bad)check("T14: hint_3 spoiler/length violation caught", not ok and any("HINTSPOILER" in e or "HINTLEN" in e for e in errs), errs)# ── 7: sampler variety ────────────────────────────────────────────────────────print("\n── Sampler tests ─────────────────────────────────────")samples = [sample_input(i, rng=random.Random(i)) for i in range(1, 21)]
3 unmodified lines45678910111213141536 unmodified lines52535455565768 unmodified lines1261271281291301311321331341351361371381393 unmodified linesauto_fix() recomputes arithmetic fields in-place — never reject for math the model shouldn't be trusted with."""import osimport sysfrom Levenshtein import distance as levHERE = os.path.dirname(os.path.abspath(__file__))sys.path.insert(0, os.path.join(HERE, "..", "common"))from cq_common import VALID_TAGS, nouns_in as _nouns_inPOINTS = {"easy": 10, "medium": 20, "hard": 30}36 unmodified linesif found:errors.append(f"NOUN: {tid} {hk} contains {set(found)}")# tags used must be subset of input tagsused = set(t.get("landscape_tags_used",[]))extra = used - input_tags68 unmodified linesreturn len(errors) == 0, errorsdef auto_fix(ex: dict) -> dict:"""Recompute all arithmetic output fields in-place. Call before validate_example."""try:tasks = ex["output"]["tasks"]for t in tasks:d = t.get("difficulty_contribution")if d in POINTS:t["points"] = POINTS[d]base = sum(t["points"] for t in tasks)bonus_pts = (ex["output"].get("bonus_task") or {}).get("points") or 0ex["output"]["task_count"] = len(tasks)3 unmodified lines456789101112131415161718192036 unmodified lines5758596061626364656667686970717273747576777879808182838485868788899068 unmodified lines1591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482493 unmodified linesauto_fix() recomputes arithmetic fields in-place — never reject for math the model shouldn't be trusted with."""import osimport re as _reimport sysfrom Levenshtein import distance as levHERE = os.path.dirname(os.path.abspath(__file__))sys.path.insert(0, os.path.join(HERE, "..", "common"))from cq_common import (VALID_TAGS, nouns_in as _nouns_in, soft_leaks_in,is_verbal_only_proof, has_risk_indicators, specific_flag_count,HINT_LIMITS, hint_spoilers_in, fix_text_leaks,)POINTS = {"easy": 10, "medium": 20, "hard": 30}36 unmodified linesif found:errors.append(f"NOUN: {tid} {hk} contains {set(found)}")# soft city-leakage words (audit §1) — description + hintsleaks = soft_leaks_in(t.get("description",""))if leaks:errors.append(f"LEAK: {tid} description contains city-knowledge words {set(leaks)}")for hk in ("hint_1","hint_2","hint_3"):leaks = soft_leaks_in(t.get("hints",{}).get(hk,""))if leaks:errors.append(f"LEAK: {tid} {hk} contains city-knowledge words {set(leaks)}")# hint length limits + anti-spoiler check (audit §4)for hk, limit in HINT_LIMITS.items():h = t.get("hints",{}).get(hk,"")if len(h) > limit:errors.append(f"HINTLEN: {tid} {hk} is {len(h)} chars (max {limit})")spoilers = hint_spoilers_in(t.get("hints",{}).get("hint_3",""))if spoilers:errors.append(f"HINTSPOILER: {tid} hint_3 contains direction give-aways {spoilers}")# verifiable proof for social_interaction tasks (audit §2)if t.get("task_type") == "social_interaction" and is_verbal_only_proof(t.get("completion_proof","")):errors.append(f"PROOF: {tid} social_interaction completion_proof is verbal-only, needs photo/receipt")# safety flag specificity (audit §3)risky_text = " ".join([t.get("description",""), t.get("title","")])if has_risk_indicators(risky_text):if specific_flag_count(t.get("safety_flags")) < 2:errors.append(f"SAFETY: {tid} touches water/elevation/alley/crowd/dark but has <2 specific safety_flags")# tags used must be subset of input tagsused = set(t.get("landscape_tags_used",[]))extra = used - input_tags68 unmodified linesreturn len(errors) == 0, errors_LEAK_REPLACEMENTS = {"most famous": "most distinctive","the famous": "the notable","best-known": "most noticeable","best known": "most noticeable","central": "the","downtown": "this area","largest": "biggest","main": "the",}_SPOILER_PHRASES = ["just before", "next to", "to the left of", "to the right of","near the corner of", "across from", "adjacent to","directly behind", "right after", "just past",]def _strip_leaks(text: str) -> str:if not text:return textfor phrase, repl in _LEAK_REPLACEMENTS.items():text = _re.sub(r"\b" + _re.escape(phrase) + r"\b", repl, text, flags=_re.IGNORECASE)text = _re.sub(r"\biconic\b(?!\s+landmark)", "notable", text, flags=_re.IGNORECASE)text = _re.sub(r"\bthe the\b", "the", text, flags=_re.IGNORECASE)return _re.sub(r"\s{2,}", " ", text).strip()def _strip_spoilers(text: str) -> str:if not text:return textfor phrase in _SPOILER_PHRASES:text = _re.sub(_re.escape(phrase), "near", text, flags=_re.IGNORECASE)return _re.sub(r"\s{2,}", " ", text).strip()def _truncate(text: str, limit: int) -> str:if not text or len(text) <= limit:return textcut = text[:limit]if " " in cut:cut = cut[: cut.rfind(" ")]return cut.rstrip(" ,.;:")def auto_fix(ex: dict) -> dict:"""Recompute all arithmetic output fields in-place. Call before validate_example."""try:loc = ex["input"]["location"]ex["output"]["game_title"] = fix_text_leaks(ex["output"].get("game_title", ""), [loc.get("city"), loc.get("country")])tasks = ex["output"]["tasks"]for t in tasks:d = t.get("difficulty_contribution")if d in POINTS:t["points"] = POINTS[d]# strip soft city-leakage words from description (audit §1)t["description"] = _strip_leaks(t.get("description", ""))# clean + enforce hint limits / anti-spoiler (audit §4)hints = t.get("hints")if isinstance(hints, dict):for hk in ("hint_1", "hint_2", "hint_3"):if hk in hints and isinstance(hints[hk], str):hints[hk] = _strip_leaks(hints[hk])if "hint_3" in hints and isinstance(hints["hint_3"], str):hints["hint_3"] = _strip_spoilers(hints["hint_3"])for hk, limit in HINT_LIMITS.items():if hk in hints and isinstance(hints[hk], str):hints[hk] = _truncate(hints[hk], limit)# ensure ≥2 specific safety_flags for risky tasks (audit §3)risky_text = " ".join([t.get("description", ""), t.get("title", "")])if has_risk_indicators(risky_text):flags = t.get("safety_flags") or []if specific_flag_count(flags) < 2:extra = ["watch your footing — surfaces near here can be uneven or slippery","stay alert for blind corners and limited visibility around this spot",]for e in extra:if specific_flag_count(flags) >= 2:breakflags.append(e)t["safety_flags"] = flagsbase = sum(t["points"] for t in tasks)bonus_pts = (ex["output"].get("bonus_task") or {}).get("points") or 0ex["output"]["task_count"] = len(tasks)
.gitignore+8
app/data/hide_and_seek/dataset.json
app/data/scavenger_hunt/dataset.json
app/data/tag/dataset.json+894
scripts/scavenger_hunt/generator.py+15-138
scripts/scavenger_hunt/sampler.py+25-7
scripts/scavenger_hunt/test_pipeline.py+36-13
scripts/scavenger_hunt/validator.py+111-1