|
@@ -351,10 +351,13 @@ class CodeBox {
|
|
|
case "o":
|
|
|
output = String.fromCharCode(this.stacks[this.curr_stack].Pop());
|
|
|
break;
|
|
|
- // Misc
|
|
|
+ // Code box manipulation
|
|
|
case "g":
|
|
|
this.PushFromCodeBox();
|
|
|
break;
|
|
|
+ case "p":
|
|
|
+ this.PlaceIntoCodeBox();
|
|
|
+ break;
|
|
|
// End execution
|
|
|
case ";":
|
|
|
output = true;
|
|
@@ -624,6 +627,28 @@ class CodeBox {
|
|
|
|
|
|
this.stacks[this.curr_stack].Push(valParsed);
|
|
|
}
|
|
|
+ /**
|
|
|
+ * Implement p
|
|
|
+ *
|
|
|
+ * Pops `y`, `x`, and `v` off of the stack, and then places the string
|
|
|
+ * representation of that value at `[x, y]` in the code box.
|
|
|
+ */
|
|
|
+ PlaceIntoCodeBox() {
|
|
|
+ const y = this.stacks[this.curr_stack].Pop();
|
|
|
+ const x = this.stacks[this.curr_stack].Pop();
|
|
|
+ const v = this.stacks[this.curr_stack].Pop();
|
|
|
+
|
|
|
+ while(y >= this.box.length) {
|
|
|
+ this.box.push([]);
|
|
|
+ }
|
|
|
+ while(x >= this.box[y].length) {
|
|
|
+ this.box[y].push(" ");
|
|
|
+ }
|
|
|
+
|
|
|
+ this.EqualizeBoxWidth();
|
|
|
+
|
|
|
+ this.box[y][x] = String.fromCharCode(v);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* Implement `
|