スピログラフ

 投稿者:しばっち  投稿日:2017年10月29日(日)14時40分45秒
  CALL GINIT(800,800)
LOCATE VALUE NOWAIT(1),RANGE 0 TO 300,AT 150 : R0
LOCATE VALUE NOWAIT(2),RANGE 0 TO 300,AT 120 : R1
LOCATE VALUE NOWAIT(3),RANGE 0 TO 300,AT 50 : P
LOCATE VALUE NOWAIT(4),RANGE 1 TO 200,AT 50 : SP
LOCATE VALUE NOWAIT(5),RANGE 1 TO 20,AT 3 : N
DO
   LET T0=R0
   LET T1=R1
   LET RR=P
   LET SS=SP
   LET NN=N
   DO
      LOCATE VALUE NOWAIT(1): R0
      LOCATE VALUE NOWAIT(2): R1
      LOCATE VALUE NOWAIT(3): P
      LOCATE VALUE NOWAIT(4): SP
      LOCATE VALUE NOWAIT(5): N
      LET R0=INT(R0)
      LET R1=INT(R1)
      LET P=INT(P)
      LET SP=INT(SP)
      LET N=INT(N)
   LOOP WHILE R0=T0 AND R1=T1 AND P=RR AND SP=SS AND NN=N
   CLEAR
   LET R=R0-R1
   LET XX=400+R-P
   LET YY=400
   LET D=0
   FOR I=1 TO 360*N
      LET D=D+SP
      LET S1=D*PI/180
      LET S0=S1*R1/R0
      LET X=R*COS(S0)-P*COS(S1)
      LET Y=R*SIN(S0)+P*SIN(S1)
      CALL LINE(XX,YY,400+X,400+Y,7)
      LET XX=400+X
      LET YY=400+Y
   NEXT  I
LOOP
END

EXTERNAL SUB GINIT(XSIZE,YSIZE)
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0,XSIZE-1,YSIZE-1,0
SET POINT STYLE 1
SET COLOR MIX(0) 0,0,0
SET COLOR MIX(1) 0,0,1
SET COLOR MIX(2) 1,0,0
SET COLOR MIX(3) 1,0,1
SET COLOR MIX(4) 0,1,0
SET COLOR MIX(5) 0,1,1
SET COLOR MIX(6) 1,1,0
SET COLOR MIX(7) 1,1,1
CLEAR
END SUB

EXTERNAL SUB LINE(XS,YS,XE,YE,C)
SET COLOR C
PLOT LINES:XS,YS;XE,YE
END SUB
 

戻る