From 22de86e253aa2a29a61dac757989f825b5f47150 Mon Sep 17 00:00:00 2001 From: rei1024 Date: Tue, 15 Oct 2024 22:00:55 +0900 Subject: [PATCH] feat: update rule --- package-lock.json | 8 ++++---- package.json | 2 +- src/lib/setRLE.ts | 7 ++++++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index bbade42..04e89b9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "devDependencies": { "@ca-ts/algo": "npm:@jsr/ca-ts__algo@^0.4.0", "@ca-ts/rle": "npm:@jsr/ca-ts__rle@^0.8.0", - "@ca-ts/rule": "npm:@jsr/ca-ts__rule@^0.2.0", + "@ca-ts/rule": "npm:@jsr/ca-ts__rule@^0.3.0", "babylonjs": "^7.29.0", "typescript": "^5.6.3", "vite": "^5.4.1" @@ -34,9 +34,9 @@ }, "node_modules/@ca-ts/rule": { "name": "@jsr/ca-ts__rule", - "version": "0.2.0", - "resolved": "https://npm.jsr.io/~/11/@jsr/ca-ts__rule/0.2.0.tgz", - "integrity": "sha512-EF4RJx9reZ1KSeDVTegKLEaHsk3rEjAxUSrqHh9acacqdxvHTumhalxNyfYKqFq6DJkZdHxKDniOTICjnQ+lnQ==", + "version": "0.3.0", + "resolved": "https://npm.jsr.io/~/11/@jsr/ca-ts__rule/0.3.0.tgz", + "integrity": "sha512-bK8w2k3P0232vLl/LLtVkoUAxcyCzTDQzroES7/7jqtEn+ZhIi+9F8ym7bKctdTPqY7fFqXUd4mkSbChaRxSxQ==", "dev": true }, "node_modules/@esbuild/aix-ppc64": { diff --git a/package.json b/package.json index a4f27db..5f0b941 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "devDependencies": { "@ca-ts/algo": "npm:@jsr/ca-ts__algo@^0.4.0", "@ca-ts/rle": "npm:@jsr/ca-ts__rle@^0.8.0", - "@ca-ts/rule": "npm:@jsr/ca-ts__rule@^0.2.0", + "@ca-ts/rule": "npm:@jsr/ca-ts__rule@^0.3.0", "babylonjs": "^7.29.0", "typescript": "^5.6.3", "vite": "^5.4.1" diff --git a/src/lib/setRLE.ts b/src/lib/setRLE.ts index 767ea4d..9451453 100644 --- a/src/lib/setRLE.ts +++ b/src/lib/setRLE.ts @@ -6,7 +6,12 @@ export function setRLE(bitWorld: BitWorld, sourceRLE: string) { const data = parseRLE(sourceRLE); try { - bitWorld.setRule(parseRule(data.ruleString).transition); + const rule = parseRule(data.ruleString); + if (rule.type === "outer-totalistic") { + bitWorld.setRule(rule.transition); + } else { + throw new Error("unsupported rule"); + } } catch { bitWorld.setRule({ birth: [3], survive: [2, 3] }); }