┌─ 소리 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
┌─ 프로그램 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
├─ 재생 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
├─ 조작 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
RULE=30defnext_row(row, w):
out =[0]* w
for x inrange(w):
left = row[(x -1)% w]
here = row[x]
right = row[(x +1)% w]
pattern = left *4+ here *2+ right
out[x]=RULE>> pattern &1return out
constRULE=30;functionnextRow(row, w){const out =newUint8Array(w);for(let x =0; x < w; x++){const left = row[(x -1+ w)% w];const here = row[x];const right = row[(x +1)% w];const pattern = left *4+ here *2+ right;
out[x]=(RULE>> pattern)&1;}return out;}
#defineRULE30voidnext_row(constchar row[],char out[],int w){for(int x =0; x < w; x++){int left = row[(x -1+ w)% w];int here = row[x];int right = row[(x +1)% w];int pattern = left *4+ here *2+ right;
out[x]=(RULE>> pattern)&1;}}
constexprintRULE=30;
std::vector<char>next_row(const std::vector<char>& row){int w =static_cast<int>(row.size());
std::vector<char>out(w,0);for(int x =0; x < w; x++){int left = row[(x -1+ w)% w];int here = row[x];int right = row[(x +1)% w];int pattern = left *4+ here *2+ right;
out[x]=(RULE>> pattern)&1;}return out;}
constintRule=30;staticbyte[]NextRow(byte[] row){int w = row.Length;byte[] next =newbyte[w];for(int x =0; x < w; x++){int left = row[(x -1+ w)% w];int here = row[x];int right = row[(x +1)% w];int pattern = left *4+ here *2+ right;
next[x]=(byte)((Rule>> pattern)&1);}return next;}
staticfinalintRULE=30;staticbyte[]nextRow(byte[] row){int w = row.length;byte[] out =newbyte[w];for(int x =0; x < w; x++){int left = row[(x -1+ w)% w];int here = row[x];int right = row[(x +1)% w];int pattern = left *4+ here *2+ right;
out[x]=(byte)((RULE>> pattern)&1);}return out;}