2014-12-06 27 views

回答

11

這是一個具有5個狀態的元胞自動機。規則是3457/357/5使用表示法。

它有5個狀態:0,1,2,3,4。在每個步驟中,細胞的行爲如下:

  • 0 - >1如果3,5或7的八個鄰居是1,或0否則
  • 1 - >1如果3,4,5或7它的八個相鄰的1,或2否則
  • 2 - >3
  • 3 - >4
  • 4 - >0

這裏是一個振盪器:

enter image description here

+0

就是這樣!與golly的鏈接非常有幫助。從來沒有聽說過它! – Askaga 2015-04-05 17:15:20

+2

這裏是我的JavaScript實現Wolfram特定動畫的jsfiddle。不得不抓住其中一個框架的屏幕截圖來初始化它。我抓住的那個非常簡單,但我很想知道他們使用的絕對起點。 https://jsfiddle.net/iAmMortos/espncctd/ – 2015-12-22 15:50:42

-1

這是康威的生命遊戲。有一個非常好的維基百科文章,我建議你去看看那裏。

+0

這不可能是真實的,因爲康維的生命遊戲只有兩種可能的狀態:死亡和活着。 WA載入頁面上顯示的自動機有3種狀態:空,小圓和大圓。也許這是生命遊戲的一些變化?如果是的話,你能指出我對它的描述/特定實現嗎? – Askaga 2014-12-06 16:37:12

1

這裏是一個非常快的matlab實現Wolfram Alpha的的元胞自動機:

rng(38); % 31 lasts a while/38 has two oscillators/39 lasts longer /42 lasts muuuuch longer 
X = randi([0 4],30,40); 

[a,b] = size(X); 

initialFig = figure('toolbar','none','menubar','none'); 
[x,y]  = meshgrid(1:b,1:a); 
scathandle = scatter(x(:),y(:),20*X(:)+1,X(:)+1,'filled'); 
colormp = linspace(1,0.4,5)'*[1 1 1]; colormap(colormp); 
axis([0 b+1 0 a+1]); axis off; set(gca,'position',[0 0 1 1]); set(gcf,'toolbar','none','menubar','none','color','w','numbertitle','off','name',''); axis equal; 

n = [a 1:a-1]; % The previous row 
s = [2:a 1]; % The next row 
e = [2:b 1]; % The next column 
w = [b 1:b-1]; % The previous column 

[A,B,C] = meshgrid(1:a,1:b,[0 1]); 

Xnew = X; 
while 1 
    N = (X(n,:)==1) + (X(s,:)==1) + (X(:,e)==1) + (X(:,w)==1) + (X(n,e)==1) + (X(n,w)==1) + (X(s,e)==1) + (X(s,w)==1); % Look for the total number of nieghbours == 1 

    Xnew(X>=2) = mod(X(X>=2)+1,5); % if state is greater or equal to 2, increment 1 modulo 5 
    Xnew(X==0) = (N(X==0)==3 | N(X==0)==5 | N(X==0)==7); % if state is 0, turn to 1 when neighbours equal 3,5 or 7. Leave 0 otherwise. 
    Xnew(X==1) = 2 - (N(X==1)==3 | N(X==1)==4 | N(X==1)==5 | N(X==1)==7); % if state is 1, turn to 2 unless neighbours equal 3, 4 or 5. In the latter case, leave 1. 
    X = Xnew; 
    set(scathandle,'cdata',X(:)+1,'sizedata',20*X(:)+1); 
    drawnow; 

    if ~ishandle(initialFig) 
     return 
    end 
end 

我猜,在任何時候,有人會發現這有用(以某種方式)。