请注意以下粒子物理动画:
var atoms = [{pos:10, vel:1.2913513}, {pos:20,vel:0}, {pos:24, vel:-2}, {pos:60,vel:0}, {pos: 60, vel:0}];
setInterval(function(){
var has_atom = {};
for (var i=0, l=atoms.length; i<l; ++i){
for (var j=0; j<l; ++j)
atoms[i].vel += (atoms[j].pos - atoms[i].pos) * 0.005;
atoms[i].pos += atoms[i].vel;
has_atom[~~atoms[i].pos] = true;
};
for (var image=" ", i=0; i<72; ++i)
image += has_atom[i] ? "O" : "_";
document.getElementById("atoms").innerHTML = image;
}, 25);
<div id="atoms" style="font-family: monospace"></div>
虽然简单,它涉及距离的作用:即,在每个蜱处,原子与其他任意远的原子相互作用。对于仅具有局部规则的细胞自动机,这是不可能的。因此,我想知道:什么是最简单的自动机编码,可以显示类似的粒子物理行为?