|
@@ -5,12 +5,16 @@ const Stack = require("./Stack");
|
|
|
const ComputerParameterMode = require("./ComputerParameterMode");
|
|
|
const { DeepClone } = require("./common");
|
|
|
|
|
|
-/**
|
|
|
- * An Intcode Computer for the Advent of Code 2019 challenge
|
|
|
- *
|
|
|
- * @author Apis Necros
|
|
|
- */
|
|
|
module.exports = class Computer {
|
|
|
+ /**
|
|
|
+ * An Intcode Computer for the Advent of Code 2019 challenge
|
|
|
+ *
|
|
|
+ * @author Apis Necros
|
|
|
+ *
|
|
|
+ * @param {number[]} stack The initial memory to load into the computer
|
|
|
+ * @param {Object} options Options that can be enabled within the computer
|
|
|
+ * @param {boolean} options.followPointer When true, the memory will be dumped every call to Execute with the current instruction highlighted
|
|
|
+ */
|
|
|
constructor(stack, options = {}) {
|
|
|
this._initialMemory = DeepClone(stack);
|
|
|
this.stack = new Stack(stack);
|