Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var ArrayCreator = class({
- constructor: function(name,height,width){
- this.name = name;
- this.height = height;
- this.width = width;
- },
- create2DArray: function(){
- for (var i = 0; i < this.height; i++) {
- this.name[i] = [];
- }
- for (i = 0; i < this.h; i++) {
- for (var j = 0; j < this.width; j++) {
- this.name[i][j] = 0;
- }
- }
- }
- toBlocks: function(name2) {
- for (var i = 0; i < 2 * this.width + 1; i++) {
- this.name[0][i] = 1;
- this.name[2 * this.height][i] = 1;
- this.name[i][0] = 1;
- this.name[i][this.width * 2] = 1;
- }
- var x, y;
- for (i = 0; i < this.height; i++) {
- for (var j = 0; j < this.width; j++) {
- x = i * 2 + 1;
- y = j * 2 + 1;
- this.name[x + 1][y] = (name2[i][j] & S) === 0;
- if (name2[i][j] & E)
- this.name[x + 1][y + 1] = ((name2[i][j] | name2[i][j + 1]) & S) === 0;
- else
- this.name[x][y + 1] = this.name[x + 1][y + 1] = 1;
- }
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement