Dear All,

I'm a beginner programmer, having a beginner question :)

I'm trying to set a probability result for a conditional statement.

To be honest i tried to read a bit about probability in processing but couldn't get my head around it without a clear example.

I'm trying to program a Cellular Automata script and want to set the rules using probability as follows:

- // Rules of Life
- if ((board[x][y] == 1) && (neighbors < 1)) next[x][y] = 0; // Loneliness
- else if ((board[x][y] == 1) && (neighbors > 5)) next[x][y] = 0; // Overpopulation
- else if ((board[x][y] == 0) && (neighbors == 2)) next[x][y] = 1; //Reproduction
- else next[x][y] = board[x][y]; // Stasis

I want to replace the results by probability, so for example if the board cell state is (1) and the neighbours are > 5 then the chance of death (0) is 60% (not 100% as it is now)...

Many thanks,

Omar

1