X-Git-Url: https://git.xandkar.net/?p=cellular-automata.git;a=blobdiff_plain;f=life%2F006%2Flife.ts;fp=life%2F006%2Flife.ts;h=7b6ad3b140764c0ff7bc92975f278ab99766ed7e;hp=ac4b969a177ab109bbd9fb756888bd56ff0063b3;hb=537249fc4bd177f195cc2bf52a0ebaa0bcf234ee;hpb=6fe41dc7e88d0b191c2e8d522d66500203ed2bb8
diff --git a/life/006/life.ts b/life/006/life.ts
index ac4b969..7b6ad3b 100644
--- a/life/006/life.ts
+++ b/life/006/life.ts
@@ -53,15 +53,8 @@ class Grid implements GridInterface {
};
map(f : (location: GridLocation) => A) {
- const cells = [];
- for (let r = 0; r < this.rows; r++) {
- cells[r] = [];
- for (let k = 0; k < this.columns; k++) {
- const location = {r: r, k: k};
- cells[r][k] = f(location);
- }
- };
- this.cells = cells;
+ this.cells =
+ this.cells.map((row, r) => row.map((_, k) => f({r: r, k: k})));
};
private print_border(): void {