RGB Cellular Automata/Random Walk

3 views (last 30 days)
Obi Carwood
Obi Carwood on 26 May 2019
Hey, I know its hard to see, but attached is an image that I wish to run a simulation on. The image will be the initial array, and I wish to run a random walk against this array. The random walk I wish to create will have the following criteria:
  • The walk will only run on a cell (pixel) that is grey (200,200,200)
  • The when a pixel takes a random step, it will duplicate its pixel. For example, if you have a particle in position (x,y) and it randomly moves to (x+1,y+1), I want there to now be a pixel in the position (x,y) and (x+1,y+1). In other words, I want my walk to leave a visible trail of where it was.
  • I want the pixels that are running the walk to be of a distinct colour, preferably red (255,0,0).
  • If possible, I would like for each step in the simulation, the walk to not only "duplicate" in one direction but multiple. For example, if a particle is in position (x,y) and it randomly walks to (x+1,y+1), I would like it to also randomly go to another position, such as (x-1,y-1). So now after 1 step, there would be three pixels.
Now during this random walk, I also wish to implement a cellular automata simulation. Now I am not sure how possible this is in general. But to a novice matlab user such as myself, this seems beyond out of reach. That is why I am in desperate need of assistance.
My idea for the cellular automata (CA) was to have one step of the random walk take place, then initiate CA rules on the next step, then take the random walk step 2. And keep this repeating, so the cellular automata works in between random walk steps. I am quite familiar with how a standard cellular automata works, as they mostly occur as a masked array. 1's and 0's. Example: John Conways game of life. However, my CA is a bit different. I wish for the cells to have multiple stages. Not just "alive" (1) and "dead' (0). I wish to have "red", "green", "blue", "grey" ... etc. And each colour has their own set of rules when they interact with other colours. A few rules I wish to implement are:
  • If a red cell is neighboured by at least 6 red cells, then the cell dies.
  • If a red cell is neighboured by at least 1 green or blue cell, the cell dies.
What I'm considering as a "dead" cell is a grey cell (200,200,200), and a "living" cell is red (255,0,0). And other cells such as, green, blue, black, white, are just other cells that can interact with the red and grey cells.
I'm not looking for someone to pump out this enitre simulation for me (although you are more than welcome to), I am simply asking for assistance or any tips on how to even remotely approach this. Again, my matlab skills are definitely not up to scratch, and so any advice at all will be very helpful.
Thankyou greatly for taking the time in reading this, and potentially answering.

Answers (0)

Categories

Find more on Desktop in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!