Explorar o código

Implement string mode

ApisNecros hai 1 ano
pai
achega
8ff68bd01a
Modificáronse 1 ficheiros con 6 adicións e 1 borrados
  1. 6 1
      starfish.js

+ 6 - 1
starfish.js

@@ -242,6 +242,11 @@ class CodeBox {
                     this.stack.push(y == x ? 1 : 0);
                     break;
                 }
+                //String mode
+                case "\"":
+                case "'":
+                    this.stringMode = !!this.stringMode ? 0 : dec(instruction);
+                    break;
                 // Movement
                 case "^":
                     this.MoveUp();
@@ -339,7 +344,7 @@ class CodeBox {
     Swim() {
         const instruction = this.box[this.pointer.Y][this.pointer.X];
 
-        if(this.stringMode != 0 && instruction != this.stringMode) {
+        if(this.stringMode != 0 && dec(instruction) != this.stringMode) {
             this.stack.Push(dec(instruction));
         }
         else {