Code: Select all

```
10 REM "SNOWFLAKES" (c) S.DENNINGTON, Nov.1984
20 :
30 REM R sets size of flakes; X,Y set position on screen
40 REM G determines central spines or not
50 REM P sets no. of branches; F sets where they occur
60 REM T determines inward or outward pointing branches
70 :
80 REM *************************************************
90 :
110 MODE7:PRINT''"Press a key ";:*FX15
115 TIME=0:REPEATUNTILINKEY0<>-1ORTIME>1000:IFRND(-TIME)OR TRUE MODE0:VDU19,0,4,0,0,0
120 REPEAT:R=150
130 CLS
140 :
150 FORY=300TO700STEP400
160 FORX=200TO1080STEP440
170 G=RND(2)
180 FORP=1TO4:F=RND(1):T=RND(2)
190 FORangle=0TO300STEP60
200 deltaX=(SIN(RAD(angle))*R)
210 deltaY=(COS(RAD(angle))*R)
220 ON G GOTO230,240
230 MOVEX,Y:DRAWX+deltaX,Y+deltaY
240 PROCspike
250 NEXT:NEXT:NEXT:NEXT:*FX15
255 TIME=0:REPEATUNTILINKEY0<>-1ORTIME>1000:UNTILFALSE
260 END
270 :
280 :
290 DEF PROCspike
300 VX=X+(deltaX)*F:VY=Y+(deltaY)*F
310 A=((R*(1-F))*SIN(RAD(angle+60)))
320 B=((R*(1-F))*COS(RAD(angle+60)))
330 C=((R*(1-F))*SIN(RAD(angle-60)))
340 D=((R*(1-F))*COS(RAD(angle-60)))
350 ON T GOTO370,400
360 :
370 MOVEVX,VY:DRAWVX+A,VY+B
380 MOVEVX,VY:DRAWVX+C,VY+D:GOTO420
390 :
400 MOVEVX,VY:DRAWVX-A,VY-B
410 MOVEVX,VY:DRAWVX-C,VY-D
420 ENDPROC
430 :
440 DEFPROCSCREENDUM0
450 LOCALX%,Y%,Z%,M%
460 VDU2
470 VDU1,27,1,ASC"1",1,10;0;
480 FORZ%=-320TO312STEP8
490 VDU1,27,1,ASC"*",1,5,1,0,1,2;
500 FORY%=9920TO-9920STEP-640
510 M%=&5800+Y%+Z%
520 FORX%=7TO0STEP-1
530 VDU1,M%?X%,1,M%?X%
540 NEXT:NEXT:VDU1,10;0;
550 NEXT:VDU1,27,1,ASC"@";0;:VDU3
560 ENDPROC
```

EDIT: Updated for compatibility with BBC BASIC For SDL and For Windows.