Files
NumberSwipe_New/archive/revision-scripts/widen-hex.py
T

5 lines
515 B
Python

from pathlib import Path
p=Path(r'G:\项目\NumberSwipe-Variants\tools\generate.mjs');s=p.read_text(encoding='utf-8-sig');a=s.index('function hex(index){');b=s.index('function blocks(',a)
s=s[:a]+'''function hex(index){const count=[6,8,11,12,14,16,18,19][index];let cells=[];const rows=index>=4?3:2;for(let q=0;cells.length<count;q++)for(let r=0;r<rows&&cells.length<count;r++)cells.push({id:'c'+cells.length,q,r});if(index===3){cells[5].r=2;cells[5].q=1;}return cells;}
''' +s[b:];p.write_text(s,encoding='utf-8')