Browse Source

Add demos folder

This folder holds assorted demo programs written in Intcode
ApisNecros 1 year ago
parent
commit
83b501f57e
1 changed files with 16 additions and 0 deletions
  1. 16 0
      demos/hello_world.js

+ 16 - 0
demos/hello_world.js

@@ -0,0 +1,16 @@
+/**
+ * Hello, World! script from the Esolang wiki
+ *
+ * Outputs the string "Hello, world!" in ASCII decimal.
+ *
+ * @see https://esolangs.org/wiki/Intcode#Example_Programs
+ */
+const Computer = require("../IntComp/Computer");
+
+const program = [4, 3, 101, 72, 14, 3, 101, 1, 4, 4, 5, 3, 16, 99, 29, 7, 0, 3, -67, -12, 87, -8, 3, -6, -8, -67, -23, -10];
+
+const c = new Computer(program, {
+    outputToConsole: true,
+});
+
+c.Run();