SNOW Author: regregex Category: Christmas Challenge System: BBC Micro A/B/Master, Acorn Electron Language: BBC BASIC Len source code: 116 bytes Len exe file: 94 bytes Len code only: 94 bytes Instructions: Install and open BeebEm ( http://www.mkw.me.uk/beebem/ ). Click File -> Run Disc, select bbcsnow.ssd. On hardware, insert the disc then tap BREAK while holding SHIFT. Description: The program runs under BBC BASIC version 1 and up, and displays a specific snowflake pattern on the screen. It selects display MODE 4, which automatically clears the screen. For each character cell in a large rectangle in the top left corner it then calculates the Euclidean distance from the centre, and prints an asterisk if the radius is within a prescribed limit AND in a lookup table of radii, or if the cell lies on an axis. The program waits for a keypress before exiting. Comments: An annotated dissection of the code follows. Abbreviations have been expanded for clarity. 0 A leading line number puts the line in memory: MODE4: Display MODE 4 is preferred for square pixels. FORY=-14TO9: Loop for 24 rows of which five are blank: PRINT: Move the cursor down, leaving row 0 also blank. FORX=-20TO9: Loop for 30 columns per row, first 11 blank: H=Y*Y+X*X: H := square of the Euclidean distance from (0,0) VDU Send one character to the VDU routine: 32EOR10AND " " if Boolean expression is FALSE, "*" if TRUE H<99AND( All asterisks are within 7*SQR(2) of the origin X*Y=0OR All points on axes starred (can't lookup (0,0)!) 0