|
@@ -1,18 +1,41 @@
|
|
|
const Computer = require("../IntComp/Computer");
|
|
|
|
|
|
-const input = [3, 10, 3, 12, 1, 10, 12, 12, 4, 12, 99];
|
|
|
+const input = [3, 15, 3, 16, 1002, 16, 10, 16, 1, 16, 15, 15, 4, 15, 99, 0, 0];
|
|
|
|
|
|
-const c = new Computer(input, {
|
|
|
- inputFromConsole: true,
|
|
|
- outputToConsole: false,
|
|
|
- followPointer: false,
|
|
|
- tickRate: 0,
|
|
|
-});
|
|
|
-const c2 = new Computer(input);
|
|
|
-const c3 = new Computer(input);
|
|
|
+const computerArray = [
|
|
|
+ new Computer(input, {
|
|
|
+ inputFromConsole: true,
|
|
|
+ }),
|
|
|
+ new Computer(input, {
|
|
|
+ inputFromConsole: true,
|
|
|
+ }),
|
|
|
+ new Computer(input, {
|
|
|
+ inputFromConsole: true,
|
|
|
+ }),
|
|
|
+ new Computer(input, {
|
|
|
+ inputFromConsole: true,
|
|
|
+ }),
|
|
|
+ new Computer(input, {
|
|
|
+ inputFromConsole: true,
|
|
|
+ outputToConsole: true,
|
|
|
+ }),
|
|
|
+];
|
|
|
|
|
|
-c.outputComputer = c2;
|
|
|
-c2.outputComputer = c3;
|
|
|
+console.log("Running computer A");
|
|
|
+computerArray[0].Run();
|
|
|
+let arrayOutput = computerArray[0].FetchOutputValue();
|
|
|
|
|
|
-c.RunWithInput(-15);
|
|
|
-console.log(c3.FetchOutputValue());
|
|
|
+console.log("Running computer B");
|
|
|
+computerArray[1].RunWithInput(arrayOutput);
|
|
|
+arrayOutput = computerArray[1].FetchOutputValue();
|
|
|
+
|
|
|
+console.log("Running computer C");
|
|
|
+computerArray[2].RunWithInput(arrayOutput);
|
|
|
+arrayOutput = computerArray[2].FetchOutputValue();
|
|
|
+
|
|
|
+console.log("Running computer D");
|
|
|
+computerArray[3].RunWithInput(arrayOutput);
|
|
|
+arrayOutput = computerArray[3].FetchOutputValue();
|
|
|
+
|
|
|
+console.log("Running computer E");
|
|
|
+computerArray[4].RunWithInput(arrayOutput);
|