Draws a Christmas garland: two concentric rings of flowers in green ink on a red screen. Each flower is a set of seven curved petals, drawn as pairs of arcs out from and back to a point on the ring, and the second ring is larger and holds more flowers than the first. The size of the ring, the number of flowers and petals, the petal length and the curve of each petal are all set in plainly labelled variables at lines 110–240, so you can edit them to make other designs; the REMs advise using prime or odd numbers for the flower and petal counts.
REMs credit Gertie Andersson, October 1986, with thanks to Oleg D. Jefimenko, whose equations appeared in Timelinez 4/86. The program was published as “Garland” in Timelinez in April 1987.
Program Analysis
- Lines 110–140: centre 128,87, radius 56 and 15 flowers. Lines 210–240: flower shape
C=360,A=180, petal length 16 by 16, curveP=.375*PIand 7 petals. - Lines 405–480: for each of two rings, step
Tround the circle and plot a point, then draw the petals withDRAW H/.82,V,P: DRAW -H/.82,-V,P. - Line 500: the second ring gets radius +15 and 9 more flowers.
Notable Techniques
- The third parameter of
DRAWturns each petal into an arc ofPradians, and drawing out and back with the same angle makes the two sides of the petal bulge apart. - Horizontal distances are divided by 0.82 to correct for the screen’s pixel aspect, so the ring comes out round rather than flattened.
- A REM notes that there are 546 pixels in a circle of any size, and the ring step
546/Fis built on that figure.
Potential Issues
- Large radius or petal settings run the drawing off the screen and stop with an out-of-screen error.
- The drawing takes several minutes in BASIC, and the program simply stops when it is finished.
This program came from an Oliger (JLO SAFE) disk and was converted to load from tape. It needed no changes and was tested in ZEsarUX.
Source Code
10 REM ..GARLAND ..LOAD "GARLAND"
15 REM ..WITH THANKS TO OLEG ..D. JEFIMENKO, ..TIMELINEZ 4/86 ..PAGE 200
20 REM ..BY GERTIE ANDERSSON ..10/86
25 REM ..THERE ARE 546 PIXELS ..IN A REUE CIRCLE OF ..ANY SIZE
30 REM ..PRIME OF ODD NUMBERS ..BEST FOR F AND N
50 REM ..FOR CHRISTMAS COLORS
55 BORDER 2: PAPER 2: INK 4: CLS
100 REM ..CIRCLE VARIABLES
110 LET X=128: REM H CENTER
120 LET Y=87: REM V CENTER
130 LET R=56: REM RADIUS
140 LET F=15: REM NUMBER OF FLOWERS WANTED
200 REM ..FLOWER VARIABLES
210 LET C=360: LET A=180: REM SHAPE OF FLOWER
220 LET HH=16: LET VV=16: REM LENGTH OF PETALS
230 LET P=.375*PI: REM CURVE OF PETALS
240 LET N=7: REM NUMBER OF PETALS
400 REM ..GARLAND
405 FOR K=1 TO 2: REM NUMBER OF CIRCLES
410 LET S=546/F: REM STEP FOR CIRCLES
415 LET SS=C/N: REM STEP FOR FLOWERS
420 FOR T=0 TO 2*PI STEP S/87
430 PLOT X+R*COS T/.82,Y+R*SIN T
440 FOR I=0 TO C STEP SS
450 LET H=HH*SIN (I*PI/A)
460 LET V=VV*COS (I*PI/A)
470 DRAW H/.82,V,P: DRAW -H/.82,-V,P
480 NEXT I: NEXT T
500 LET R=R+15: LET F=F+9
550 NEXT KNote: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
