Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
29
Task/Dragon-curve/QuickBASIC/dragon-curve.basic
Normal file
29
Task/Dragon-curve/QuickBASIC/dragon-curve.basic
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
REM Dragon curve
|
||||
REM SIN, COS in arrays for PI/4 multipl.
|
||||
DECLARE SUB Dragon (BYVAL Insize!, BYVAL Level%, BYVAL RQ%)
|
||||
DIM SHARED S(7), C(7), X, Y, RotQPi%
|
||||
CONST QPI = .785398163397448# ' PI / 4
|
||||
FOR I = 0 TO 7
|
||||
S(I) = SIN(I * QPI)
|
||||
C(I) = COS(I * QPI)
|
||||
NEXT I
|
||||
X = 112: Y = 70
|
||||
SCREEN 2: CLS
|
||||
CALL Dragon(128, 15, 1) ' Insize = 2^WHOLE_NUM (looks better)
|
||||
END
|
||||
|
||||
SUB Dragon (BYVAL Insize, BYVAL Level%, BYVAL RQ%)
|
||||
CONST SQ = 1.4142135623731# ' SQR(2)
|
||||
IF Level% <= 1 THEN
|
||||
XN = C(RotQPi%) * Insize + X
|
||||
YN = S(RotQPi%) * Insize + Y
|
||||
LINE (2 * X, Y)-(2 * XN, YN) ' For SCREEN 2 doubled x-coords
|
||||
X = XN: Y = YN
|
||||
ELSE
|
||||
RotQPi% = (RotQPi% + RQ%) AND 7
|
||||
CALL Dragon(Insize / SQ, Level% - 1, 1)
|
||||
RotQPi% = (RotQPi% - RQ% * 2) AND 7
|
||||
CALL Dragon(Insize / SQ, Level% - 1, -1)
|
||||
RotQPi% = (RotQPi% + RQ%) AND 7
|
||||
END IF
|
||||
END SUB
|
||||
Loading…
Add table
Add a link
Reference in a new issue