1234567891011121314151617181920212223242526272829303132333435363738394041 |
- const Computer = require("../IntComp/Computer");
- const input = [3, 15, 3, 16, 1002, 16, 10, 16, 1, 16, 15, 15, 4, 15, 99, 0, 0];
- 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,
- }),
- ];
- console.log("Running computer A");
- computerArray[0].Run();
- let arrayOutput = computerArray[0].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);
|