not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

41 lines
931 B

var initialPattern = function initialPattern() {
return new Array(30).fill(0).map(function () {
return new Array(50).fill(0);
});
};
var generateRandomBoardState = function generateRandomBoardState() {
return new Array(30).fill(0).map(function () {
var row = new Array(50).fill(0);
return row.map(function () {
return Math.floor(Math.random() * 2);
});
});
};
var glider = function glider() {
var pattern = initialPattern();
pattern[5][7] = 1;
pattern[6][5] = 1;
pattern[6][6] = 1;
pattern[7][6] = 1;
pattern[7][7] = 1;
return pattern;
};
var no = function no() {
var pattern = initialPattern();
for (var j = 0; j < 30; j++) {
if (!((j + 1) % 4 === 0)) {
for (var i = 2; i < 50; i += 4) {
pattern[j][i] = 1;
}
}
}
return pattern;
};
var patterns = [generateRandomBoardState, glider, no, initialPattern];
define(function () {
return patterns;
});