Complete Bone Quest high-resolution anatomy quiz

This commit is contained in:
Brian Holman committed 2026-11-11 23:43:09 -07:00
1 parent 3cc37be5fb
commit 2ceb44a48c
62 files changed
+3204 -1301

No files matched your search

+9 -6
View File
@@ -1,24 +1,27 @@
#!/usr/bin/env python3
"""Validate authored anatomy facts and regenerate the small CMOC question table."""
"""Validate the 28 reference topics and regenerate the compact CMOC table."""
import argparse
import json
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
CODES=('CRANIUM','MANDIBLE','CLAVICLE','SCAPULA','STERNUM','RIBS','CERVICAL','THORACIC','LUMBAR','SACRUM','COCCYX','PELVIS','HUMERUS','RADIUS','ULNA','CARPALS','METACARPALS','FINGERS','FEMUR','PATELLA','TIBIA','FIBULA','TARSALS','METATARSALS','TOES')
CODES=('SKULL','CERVICAL','MANUBRIUM','STERNUM','XIPHOID','LUMBAR','ILIUM','SACRUM','COCCYX','PUBIS','FEMUR','PATELLA','TARSALS','METATARSALS','TOES','ORBIT','NASAL','CLAVICLE','SCAPULA','RIBS','HUMERUS','ULNA','RADIUS','CARPALS','METACARPALS','FINGERS','FIBULA','TIBIA')
KINDS=('bone','bone_group','bone_part','cavity')
def generated():
rows=json.loads((ROOT/'data/bones.json').read_text());assert tuple(r['code'] for r in rows)==CODES
seen=set()
for row in rows:
assert 0<len(row['name'])<=22 and 0<len(row['hint'])<=30
assert 0<len(row['name'])<=18 and 0<len(row['hint'])<=30
assert row['hint'].isascii() and row['kind'] in KINDS
for value in [row['name']]+row['aliases']:
assert value.isascii() and len(value)<40 and '|' not in value
assert value.isascii() and 0<len(value)<=33 and '|' not in value
normalized=' '.join(value.lower().split());assert normalized and normalized not in seen
seen.add(normalized)
assert all(a==a.lower() and a==' '.join(a.split()) for a in row['aliases'])
out='/* Generated from data/bones.json; labels/codes remain in the authoring data. */\n#include "quiz.h"\nconst Bone bones[BONE_COUNT] = {\n'
assert {r['code'] for r in rows if r['kind']=='cavity'}=={'ORBIT','NASAL'}
out='/* Generated from data/bones.json; labels/codes/kinds remain in authoring data. */\n#include "quiz.h"\nconst Bone bones[BONE_COUNT] = {\n'
for row in rows:out+=' {'+', '.join(json.dumps(value) for value in (row['name'],row['hint'],'|'.join(row['aliases'])))+'},\n'
return out+'};\n'
if __name__=='__main__':
parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--check',action='store_true');args=parser.parse_args();out=generated();path=ROOT/'src/bones.c'
if args.check:assert path.read_text()==out,'Regenerate src/bones.c';print('PASS 25 anatomy topics, unique aliases, bounds, and generated C identity.')
if args.check:assert path.read_text()==out,'Regenerate src/bones.c';print('PASS 28 reference topics, unique aliases, bounds, structure kinds, and generated C identity.')
else:path.write_text(out);print('Generated src/bones.c')