"""Print the next N un-done generate-groups (no reuse) with params, for description writing.
Usage: python next_groups.py [N]   (default 8)
"""
import json, sys, io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')

N = int(sys.argv[1]) if len(sys.argv) > 1 else 8
groups = json.load(open('_variant_groups.json', encoding='utf-8'))
done = set(json.load(open('_new_progress.json', encoding='utf-8')).get('done_cks', []))

todo = [g for g in groups if not g['reuse_from'] and not all(c in done for c in g['cks'])]
print(f'remaining generate-groups: {len(todo)}')
for g in todo[:N]:
    print('=' * 70)
    print('CKS:', ', '.join(g['cks']))
    print('NAME:', (g['name'] or '').strip())
    print('CAT:', g['cat'])
    print('PARAMS:', json.dumps(g['params'], ensure_ascii=False))
