xmas star 1.0 Author: David Payne Category: Christmas Challenge 2022 System: BBC Micro Language: BBC BASIC Len source code: 60 bytes Len exe file: 49 bytes Len code only: 49 bytes Instructions: Open your web browser. Copy and paste the following URL: https://bbcmic.ro/#%7B%22v%22%3A1%2C%22program%22%3A%221F.y%3D-8TO4%3AF.x%3D-4TOy%2B4%3AV.31%2Cx*SGNRND%2B8%2Cy*SGNRND%2B9%2C42%3AN.%2C%3ARUN%22%7D the program will be run immediately. The xmas star looks nicer if you clear the screen first though, so to do this: click on the BBC micro "screen" on the right hit escape enter CLS enter RUN Description: Firstly note that the xmas star consists of 4 overlapping copies of the below triangle centred on the origin (the o). One as below, one reflected in the x-axis, one reflected in the y-axis and one reflected in both of these axes. * ** *** **** ***** ****** ******* ******** ****o**** ********** *********** ************ ************* so the 1st version of the program simply draws the above triangle, which is translated onto the screen (i.e. x+8, y+9) 1FORy=-8TO4:FORx=-4TOy+4:VDU31,x+8,y+9,42:NEXT, VDU31,x,y,42 is equivalent to PRINTTAB(x,y);"*"; the 2nd version "maps" each asterisk to one of the 4 triangles chosen at random. Put it all into an infinite loop and the xmas star then magically appears: 1FORy=-8TO4:FORx=-4TOy+4:VDU31,x*SGN(RND)+8,y*SGN(RND)+9,42:NEXT,:RUN the brackets are optional so may be removed, which gives: 1FORy=-8TO4:FORx=-4TOy+4:VDU31,x*SGNRND+8,y*SGNRND+9,42:NEXT,:RUN finally, some of the keywords can be replaced by abbreviations (although this step doesn't affect the size of the program in memory), which gives the final version: 1F.y=-8TO4:F.x=-4TOy+4:V.31,x*SGNRND+8,y*SGNRND+9,42:N.,:RUN Comments: I did also attempt this challenge in 6502 assembly language but I could not get close to the 49 bytes of the BASIC version. 1F.y=-8TO4:F.x=-4TOy+4:V.31,x*SGNRND+8,y*SGNRND+9,42:N.,:RUN