Skip to content

Commit

Permalink
feat: update rule
Browse files Browse the repository at this point in the history
  • Loading branch information
rei1024 committed Oct 15, 2024
1 parent b28a872 commit 22de86e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 6 additions & 1 deletion src/lib/setRLE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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] });
}
Expand Down

0 comments on commit 22de86e

Please sign in to comment.