#!/usr/bin/env python3
"""Writes items.json: 20 settled claims, each with its reverse and an invented twin.

Every argument is built from the same two evidence templates, so within an item the
strong argument for the believed claim and the strong argument for its reverse differ
by one word (lower/higher). Only the conclusion's believability changes.
"""
import json

# who (after "people who"), gerund phrase, outcome, settled direction
BASE = [
 ("exercise regularly", "Exercising regularly", "blood pressure", "lower"),
 ("smoke", "Smoking", "rates of lung cancer", "higher"),
 ("wear seat belts", "Wearing a seat belt", "rates of death in car crashes", "lower"),
 ("sleep less than five hours a night", "Sleeping less than five hours a night", "scores on attention tests", "lower"),
 ("drink sugary drinks every day", "Drinking sugary drinks every day", "rates of tooth decay", "higher"),
 ("wash their hands often", "Washing hands often", "rates of stomach infections", "lower"),
 ("are vaccinated against measles", "Being vaccinated against measles", "rates of measles", "lower"),
 ("brush their teeth twice a day", "Brushing teeth twice a day", "rates of gum disease", "lower"),
 ("use sunscreen at the beach", "Using sunscreen at the beach", "rates of sunburn", "lower"),
 ("drink heavily for years", "Drinking heavily for years", "rates of liver disease", "higher"),
 ("finish university", "Finishing university", "lifetime earnings", "higher"),
 ("text while driving", "Texting while driving", "rates of car crashes", "higher"),
 ("wear helmets when cycling", "Wearing a helmet when cycling", "rates of serious head injury", "lower"),
 ("eat a lot of salt", "Eating a lot of salt", "blood pressure", "higher"),
 ("practise the piano every day", "Practising the piano every day", "scores on piano exams", "higher"),
 ("work with asbestos without protection", "Working with asbestos without protection", "rates of lung disease", "higher"),
 ("work for years in very loud noise", "Working for years in very loud noise", "rates of hearing loss", "higher"),
 ("use sunbeds often", "Using sunbeds often", "rates of skin cancer", "higher"),
 ("read every day as children", "Reading every day as a child", "vocabulary scores", "higher"),
 ("are obese", "Being obese", "rates of type 2 diabetes", "higher"),
]
# invented supplement and invented blood marker, one pair per item
INVENTED = [("velmorin","tarsin"),("quoradyl","nesmin"),("ibrathene","colvax"),("sudelane","prethin"),
 ("marovex","dulicin"),("tennarol","hybrex"),("oclavine","sorbetin"),("phyrazol","mentrin"),
 ("lunadrex","kavorin"),("ebrisan","toluxin"),("crovadil","anserin-B"),("zemathol","pirocin"),
 ("halquine","vostrin"),("norbexa","glycarin"),("ystrolan","fermidin"),("duvapine","rocalin"),
 ("thessadol","immurex"),("gavirone","leptarin"),("pelmoxil","cadrin"),("arvotane","sulfenin")]

STRONG = ("A study followed 12,000 people for ten years. People who {who} ended up with {dir} {y} than "
          "otherwise similar people who did not, after accounting for other differences between the groups. "
          "Two independent teams repeated the study and found the same.")
WEAK = ("I read a comment online saying that people who {who} have {dir} {y}. "
        "The person who wrote it sounded very sure.")
CLAIM = "{gerund} leads to {dir} {y}."
FLIP = {"lower": "higher", "higher": "lower"}

items = []
for i, ((who, gerund, y, d), (drug, marker)) in enumerate(zip(BASE, INVENTED), 1):
    variants = {
        "settled": dict(who=who, gerund=gerund, y=y, dir=d),
        "reversed": dict(who=who, gerund=gerund, y=y, dir=FLIP[d]),
        "invented": dict(who=f"take the supplement {drug} every day",
                         gerund=f"Taking the supplement {drug} every day",
                         y=f"levels of the blood marker {marker}", dir=d),
    }
    items.append({"id": i, "variants": {
        k: {"claim": CLAIM.format(**v), "strong": STRONG.format(**v), "weak": WEAK.format(**v)}
        for k, v in variants.items()}})

json.dump({"version": "v0", "date": "2026-11-19", "licence": "CC BY 4.0",
           "note": "settled = the direction of the claim is the textbook one; reversed = same sentence with lower/higher swapped; invented = made-up supplement and blood marker, same direction word as settled. The evidence in every argument is invented.",
           "items": items}, open("items.json", "w"), indent=1)
print(len(items), "items")
