Daily Creative Coding

元「30 min. Processing」。毎日、Creative Codingします。

セルオートマトン

侵入型パーコレーションモデル

/** * invation percolation model * * @author aa_debdeb * @date 2016/08/08 */ float[][] values; int[][] states; ArrayList<PVector> targets; int[][] dir = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; void setup(){ size(400, 400); frameRate(360); values = new </pvector>…

バリステック凝集モデル

/** * Balistic Aggregation Model * * @author aa_debdeb * @date 2016/08/05 */ int[] stacks; void setup(){ size(300, 300); frameRate(360); noFill(); stroke(0); initialize(); } void mousePressed(){ initialize(); } void initialize(){ backgroun…

Nagel–Schreckenbergモデルによる交通流シミュレーション

/** * Nagel–Schreckenberg model * * @author aa_debdeb * @date 2016/08/04 */ int maxVel = 5; float p = 0.4; ArrayList<Car> cars; void setup(){ size(500, 500); int pos = 0; cars = new ArrayList<Car>(); while(pos < width){ pos += int(random(1, 7)); car</car></car>…

セルオートマトンによるチューリングパターン

/** * turing pattern by CA * * @author aa_debdeb * @date 2016/07/10 */ int cellNum = 250; float cellSize = 2; int[][] cells; int innerNeighbor = 2; int outerNeighbor = 4; float w; color bg, fc; void setup(){ size(500, 500); frameRate(10); …

単純なセルオートマトンによるBZ反応

/** * BZ reaction by simple cellular automata * * @author aa_debdeb * @date 2016/07/08 */ int cellNum = 100; float cellSize = 5; int[][] cells; int[][] dir = {{0, 1, 0, -1}, {-1, 0, 1, 0}}; // up, right, down, left void setup(){ size(500, …

六角形のライフゲーム

/** * Hexagonal Life Game * * @author aa_debdeb * @date 2016/07/04 */ float e = 6.0; int X = 50; int Y = 50; int[][] states; void setup(){ size(640, 480); frameRate(10); stroke(30); states = new int[X][Y]; for(int x = 0; x < X; x++){ for(i…

拡散セルオートマトン

/** * cell automaton for diffusion * * @author aa_debdeb * @date 2016/07/02 */ int cellNum = 50; float cellSize = 10; float[][] cells; int[][] dir = {{0, -1, 0, 1, 1, 1, 0, -1, -1}, {0, -1, -1, -1, 0, 1, 1, 1, 0}}; void setup(){ size(500, …

環状の1次元セルオートマトン

/** * ringed 1d cellular automata * * @author aa_debdeb * @date 2016/05/03 */ int ruleNo = 110; // 30, 110, 90... int[] rule; ArrayList<ArrayList<Integer>> gens; int genSize = 100; int stateSize = 100; void setup(){ size(500, 500); noStroke(); rule = new int</arraylist<integer>…

1次元セルオートマトン

/** * 1D Cellular Automaton * * @author aa_debdeb * @date 2016/02/13 */ int RULE_NO = 110; int[] rule; int[] states; void setup(){ size(500, 500); frameRate(45); background(255); rule = new int[8]; String binaryRule = binary(RULE_NO); for(…

積み重ねセルオートマトン

/** * Incrustation * * @author aa_debdeb * @date 2016/02/01 */ int[][] cells; int cellNum = 50; int cellSize = 10; void setup(){ size(500, 500); frameRate(1000); noStroke(); colorMode(HSB, 360, 100, 100); cells = new int[cellNum][cellNum];…

エネルギーを拡散させるセルオートマトン

/** * Cellular Automata for Diffusion * * @author aa_debdeb * @date 2016/01/11 * */ ArrayList<Cell> cells; void setup(){ size(500, 500); smooth(); frameRate(30); colorMode(HSB, 360, 100, 100); Cell[][] cellArray = new Cell[50][50]; for(int y = 0</cell>…