|
@@ -0,0 +1,27 @@
|
|
|
+const fs = require("node:fs");
|
|
|
+const { render } = require("./common");
|
|
|
+const Computer = require("../IntComp/Computer");
|
|
|
+
|
|
|
+async function main() {
|
|
|
+ // Load and parse the input
|
|
|
+ const input = fs.readFileSync("./13/input.dat", "utf8")
|
|
|
+ .split(",")
|
|
|
+ .map((x) => parseInt(x, 10));
|
|
|
+
|
|
|
+ const arcade = new Computer(input);
|
|
|
+ arcade.Run();
|
|
|
+
|
|
|
+ do {
|
|
|
+ render(arcade.outputValues);
|
|
|
+ while (arcade.awaitingInput) {
|
|
|
+ // arcade.Input(0);
|
|
|
+ }
|
|
|
+ await sleep(500);
|
|
|
+ } while (arcade.running);
|
|
|
+}
|
|
|
+
|
|
|
+function sleep(ms) {
|
|
|
+ return new Promise((resolve) => setTimeout(resolve, ms));
|
|
|
+}
|
|
|
+
|
|
|
+main();
|