Post Reply 
Does G2 Break this program?
01-18-2020, 04:37 PM (This post was last modified: 01-18-2020 04:38 PM by toml_12953.)
Post: #1
Does G2 Break this program?
Here's a projectile program that works on my HW A and C machines but doesn't work on my HW D (G2) machine. It passes the syntax check on all three. Can anyone tell me why G2 seems to break it? Try running it with velocity 230 and angle 30. On the older machines, the entire trajectory is plotted. On the G2, only one point is plotted.

Code:
FNA(X,Y,Z)
BEGIN
  RETURN X*SIN(Y*0.01745329)*Z-16*Z^2;
END;
TAB(X)
BEGIN
  LOCAL I,T;
  T:="";
  FOR I:=1 TO X DO
    T=T+" ";
  END;
  RETURN T;
END;
EXPORT PROJECTILE()
BEGIN
  LOCAL X,K,F2,W4,K1,ANS,TMP,M1;
  HFormat:=1; HDigits:=4;
  X:=MAKELIST(0,C,0,126);K:=MAKELIST(0,C,0,2);
  PRINT();
  //REPEAT
    F2:=0;
    INPUT({M,A},"MUZZLE VELOCITY AND ANGLE",{"FT/SEC: ","DEGREES: "});
    X(0):=0;
    FOR T:=0.2 TO 25 STEP 0.2 DO
      L:=IP(5*T+0.001);
      X(L):=FNA(M,A,T);
      IF X(L)<0 THEN 
        BREAK;
      END;
      IF X(L)-X(L-1)<=0 AND F2=0 THEN
        IF X(L-1)-X(L-2)<X(L)-X(L-1) THEN 
          K(1):=X(L-2);
          W4:=T-0.4+J;
        ELSE
          K(1):=X(L-1);
          W4:=T-0.2+J;
        END;
        F2:=1;
        FOR J:=0.01 TO 0.2 STEP 0.01 DO
          K(2):=FNA(M,A,W4);
          IF K(1)-K(2)<=0 THEN 
            BREAK;
          END;
          K(1):=K(2);
        END;
        K1:=MAX(K(1),K(2));
      END;
    END;
    W:=L-1;
    FOR J:=0.01 TO 0.2 STEP 0.01 DO
      K(1):=FNA(M,A,T-0.2+J);
      IF K(1)<0 THEN 
        BREAK;
      END;  
    END;
    PRINT("MAXIMUM HEIGHT IS "+K1+" FEET");
    Y:=M*COS(A*0.01745329)*(T-0.2+J-0.01);
    PRINT("RANGE IS "+Y+" FEET");
    PRINT("TOTAL TIME AIRBORNE IS "+(T+J-0.01)+" SECONDS");
    IF K1+14>60 THEN 
      M1:=1/(IP(K1/60+1));
      PRINT("SCALE OF HEIGHT IS 1 SPACE = "+1/M1+" FEET");
    ELSE 
      M1:=1;
    END;
    TMP:=TAB(14);
    FOR D:=1 TO 30 DO
      TMP:=TMP+"+";
    END;
    PRINT(TMP);
    PRINT("0"+TAB(14)+"+");
    FOR N:=1 TO W DO  
      PRINT(0.2*N*M*COS(A*0.01745329)+" +"+TAB(X(N)*M1)+"*");
    END;
    //INPUT({{ANS,[2]}},"ANYMORE (YES OR NO)?"); 
  //UNTIL UPPER(ANS) == "NO";
  HFormat:=0;
END;

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Does G2 Break this program? - toml_12953 - 01-18-2020 04:37 PM



User(s) browsing this thread: 1 Guest(s)