|
@@ -152,6 +152,19 @@ module.exports = class Computer {
|
|
|
Reset() {
|
|
|
this.stack = new Stack(this._initialMemory);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Sets the computer's memory to a new stack
|
|
|
+ *
|
|
|
+ * Note: This resets the computer's initial memory, so `Reset` will use this value
|
|
|
+ *
|
|
|
+ * @param {number[]} stack The new memory stack for the computer
|
|
|
+ * @returns {void}
|
|
|
+ */
|
|
|
+ SetMemory(stack) {
|
|
|
+ this._initialMemory = DeepClone(stack);
|
|
|
+ this.stack = new Stack(stack);
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
/**
|