Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //P(X=1) = c, P(X=0) = (1-c)
- function get01(M, i, j, c){
- const a = Math.round(Math.random());
- if (a<c){
- return 1;
- }
- else{
- return 0;
- }
- }
- function get02(M, i, j, c){
- const aliveNeighbors = countNeighbors(M, i, j, 'alive');
- const deadNeighbors = countNeighbors(M, i, j, 'dead');
- return {alive: aliveNeighbors, dead: deadNeighbors};
- }
- function getEntry(param){
- if (param == 1){
- return get01;
- }
- if (param == 2){
- return get02;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement