Skip to content

Commit

Permalink
simplify cursor logic
Browse files Browse the repository at this point in the history
  • Loading branch information
mousetail committed Mar 13, 2024
1 parent 740612b commit b40b1c4
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/scripts/interpreter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,6 @@ export function step(o: ProgramState) {
o.cursor[0] += o.cursor_direction[0];
o.cursor[1] += o.cursor_direction[1];

const program_size = [
o.program.reduce((a, b) => Math.max(a, b.length), 0),
o.program.length
]

o.cursor[1] = (o.cursor[1] + o.program.length[1]) % o.program.length[1];
o.cursor[1] = (o.cursor[1] + o.program.length) % o.program.length;
o.cursor[0] = (o.cursor[0] + o.program[o.cursor[1]].length) % o.program[o.cursor[1]].length;
}

0 comments on commit b40b1c4

Please sign in to comment.