summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--life2/game/cell.js2
-rw-r--r--life2/game/rule.js1
2 files changed, 3 insertions, 0 deletions
diff --git a/life2/game/cell.js b/life2/game/cell.js
index e232366..cd5274f 100644
--- a/life2/game/cell.js
+++ b/life2/game/cell.js
@@ -36,4 +36,6 @@ export const Cell = {
TEAM_A: 1,
/** The cell is filled with the color of the second team. */
TEAM_B: 2,
+ /** The cell is a barrier, it is never affected by rules. */
+ BARRIER: 3,
};
diff --git a/life2/game/rule.js b/life2/game/rule.js
index 5a2b1f2..ee723db 100644
--- a/life2/game/rule.js
+++ b/life2/game/rule.js
@@ -88,6 +88,7 @@ export class Rule {
* apply to the cell.
*/
execute(cell, neighbors) {
+ if (cell === Cell.BARRIER) return null;
return this.expression_(cell, neighbors);
}
}