Skip to content

Instantly share code, notes, and snippets.

@dtryon
Created June 4, 2015 21:40
Show Gist options
  • Save dtryon/cde9df43e3b2e9705156 to your computer and use it in GitHub Desktop.
Save dtryon/cde9df43e3b2e9705156 to your computer and use it in GitHub Desktop.
var Game = (function () {
var _grid;
var init = function (size) {
_grid = [];
for (var x = size - 1; x >= 0; x--) {
var row = [];
for (var y = size - 1; y >= 0; y--) {
row.push(0);
}
_grid.push(row);
}
}
var grid = function () {
return _grid;
};
return function(size) {
init(size);
return {
grid: grid
};
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment