wolfram.pde
来自「This is processing for java examples.」· PDE 代码 · 共 39 行
PDE
39 行
/** * Wolfram Cellular Automata * by Daniel Shiffman. * * Simple demonstration of a Wolfram 1-dimensional cellular automata * When the system reaches bottom of the window, it restarts with a new ruleset * Mouse click restarts as well. */ CA ca; // An instance object to describe the Wolfram basic Cellular Automatavoid setup() { size(640, 360, P2D); frameRate(30); background(0); int[] ruleset = {0,1,0,1,1,0,1,0}; // An initial rule system ca = new CA(ruleset); // Initialize CA}void draw() { ca.render(); // Draw the CA ca.generate(); // Generate the next level if (ca.finished()) { // If we're done, clear the screen, pick a new ruleset and restart background(0); ca.randomize(); ca.restart(); }}void mousePressed() { background(0); ca.randomize(); ca.restart();}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?