Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
mrfrac committed Feb 26, 2020
1 parent 4b7a625 commit d8dd0e1
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 129 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules\\typescript\\lib"
}
8 changes: 4 additions & 4 deletions dist/game-of-life.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var Game = /** @class */ (function () {
};
Game.prototype.calcNeighbours = function (x, y) {
var _this = this;
var getCellVall = function (xx, yy) {
var getCellValue = function (xx, yy) {
if (xx < 0)
xx = _this.options.cols - 1;
if (xx >= _this.options.cols)
Expand All @@ -57,9 +57,9 @@ var Game = /** @class */ (function () {
return _this.matrix[xx][yy];
};
return [
getCellVall(x - 1, y - 1), getCellVall(x, y - 1), getCellVall(x + 1, y - 1),
getCellVall(x - 1, y), getCellVall(x + 1, y),
getCellVall(x - 1, y + 1), getCellVall(x, y + 1), getCellVall(x + 1, y + 1)
getCellValue(x - 1, y - 1), getCellValue(x, y - 1), getCellValue(x + 1, y - 1),
getCellValue(x - 1, y), getCellValue(x + 1, y),
getCellValue(x - 1, y + 1), getCellValue(x, y + 1), getCellValue(x + 1, y + 1)
].reduce(function (a, b) { return a + b; }, 0);
};
return Game;
Expand Down
8 changes: 4 additions & 4 deletions dist/game-of-life.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var Game = /** @class */ (function () {
};
Game.prototype.calcNeighbours = function (x, y) {
var _this = this;
var getCellVall = function (xx, yy) {
var getCellValue = function (xx, yy) {
if (xx < 0)
xx = _this.options.cols - 1;
if (xx >= _this.options.cols)
Expand All @@ -53,9 +53,9 @@ var Game = /** @class */ (function () {
return _this.matrix[xx][yy];
};
return [
getCellVall(x - 1, y - 1), getCellVall(x, y - 1), getCellVall(x + 1, y - 1),
getCellVall(x - 1, y), getCellVall(x + 1, y),
getCellVall(x - 1, y + 1), getCellVall(x, y + 1), getCellVall(x + 1, y + 1)
getCellValue(x - 1, y - 1), getCellValue(x, y - 1), getCellValue(x + 1, y - 1),
getCellValue(x - 1, y), getCellValue(x + 1, y),
getCellValue(x - 1, y + 1), getCellValue(x, y + 1), getCellValue(x + 1, y + 1)
].reduce(function (a, b) { return a + b; }, 0);
};
return Game;
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
"license": "MIT",
"dependencies": {
"add": "^2.0.6",
"rimraf": "^3.0.0",
"rollup": "^1.21.4",
"rollup-plugin-typescript2": "^0.24.2",
"rollup-plugin-uglify": "^6.0.3",
"tslib": "^1.10.0",
"typescript": "^3.6.3",
"yarn": "^1.17.3"
"rimraf": "^3.0.2",
"rollup": "^1.31.1",
"rollup-plugin-typescript2": "^0.26.0",
"rollup-plugin-uglify": "^6.0.4",
"tslib": "^1.11.0",
"typescript": "^3.8.2",
"yarn": "^1.22.0"
},
"scripts": {
"build": "npm run clean && rollup -c ",
Expand Down
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class Game {
}

private calcNeighbours(x: number, y: number): number {
const getCellVall = (xx: number, yy: number): number => {
const getCellValue = (xx: number, yy: number): number => {
if (xx < 0) xx = this.options.cols - 1;
if (xx >= this.options.cols) xx = 0;
if (yy < 0) yy = this.options.rows - 1;
Expand All @@ -69,9 +69,9 @@ export class Game {
};

return [
getCellVall(x - 1, y - 1), getCellVall(x, y - 1), getCellVall(x + 1, y - 1),
getCellVall(x - 1, y), getCellVall(x + 1, y),
getCellVall(x - 1, y + 1), getCellVall(x, y + 1), getCellVall(x + 1, y + 1)
getCellValue(x - 1, y - 1), getCellValue(x, y - 1), getCellValue(x + 1, y - 1),
getCellValue(x - 1, y), getCellValue(x + 1, y),
getCellValue(x - 1, y + 1), getCellValue(x, y + 1), getCellValue(x + 1, y + 1)
].reduce((a, b) => a + b, 0);
}
}
Expand Down
Loading

0 comments on commit d8dd0e1

Please # to comment.