Skip to content

Commit

Permalink
chore: for test, only log output
Browse files Browse the repository at this point in the history
  • Loading branch information
ctjlewis committed Apr 20, 2024
1 parent 840672d commit 3db75a2
Show file tree
Hide file tree
Showing 3 changed files with 253 additions and 250 deletions.
7 changes: 5 additions & 2 deletions programs/automata/eval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ export function deformatTape(tape: string): Tape {
export default function testAutomata(
initialState: string | TapeValue[],
ruleNumber: string | RuleNumber,
generations: string | number = 24
generations: string | number = 24,
silent = false
): string {
if (typeof ruleNumber === "string") ruleNumber = Number(ruleNumber)
if (typeof generations === "string") generations = Number(generations)
Expand All @@ -72,8 +73,10 @@ export default function testAutomata(

let output = ""
const log = (msg: string) => {
console.log(msg)
output += msg + "\n"
if (!silent) {
console.log(msg)
}
}

let state = initialState
Expand Down
Loading

0 comments on commit 3db75a2

Please sign in to comment.