Skip to content

Commit

Permalink
Adding my own solution
Browse files Browse the repository at this point in the history
  • Loading branch information
s0alken committed May 23, 2022
1 parent 23b6680 commit 611b23b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions solution.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { readFileSync } from 'fs';

const program = [...readFileSync('input.hand', 'utf8')];

const memory = [0];

let pointer = 0;
let index = 0;
let pointer = 0;

const moveToNextCell = () => {
++pointer;
Expand Down Expand Up @@ -47,7 +46,7 @@ const endLoop = () => {
}

const displayCellValue = () => {
process.stdout.write(String.fromCharCode(memory[pointer]))
process.stdout.write(String.fromCharCode(memory[pointer]));
}

const instructions = {
Expand All @@ -57,7 +56,7 @@ const instructions = {
"πŸ‘‡": decreaseCellValue,
"🀜": startLoop,
"πŸ€›": endLoop,
"πŸ‘Š": displayCellValue,
"πŸ‘Š": displayCellValue
}

while(index < program.length) {
Expand Down

0 comments on commit 611b23b

Please sign in to comment.