gfoot's VCCC2025 entry
Author: George Foot
Category: Christmas Challenge
System: BBC Micro
Language: BBC BASIC 2
Len source code: 122
Len exe file: 82
Len code only: 82
Instructions:
Transfer the bbcbasic file to an emulator (e.g. by embedding it in an SSD file) and run it.
For convenience here is a link to load it in a web-based emulator: https://virtual.bbcmic.ro/?embedBasic=FORY%3D-9TO9%3APRINT%3AFORX%3D-9TO9%3AC%3DABSX*ABSY%3AVDU9%2FEXPTAN(C%3D0ORC%3D49ORC%3C37ANDABSX%3E4ANDABSY%3E4ORC%3C17AND(ABSX-ABSY)MOD3%3D0)%3ANEXT%2C
Description:
The code works by looping X and Y over the whole region, and checking certain conditions at each point to determine whether to draw a star (character 42) or just move the cursor to the right (character 9). It uses a nasty hack with EXP and TAN to pick between these two - this works because TRUE is -1 and 9/EXP(TAN(-1)) rounds down to 42, while 9/EXP(TAN(0)) is just 9.
The conditions checked are whether X or Y is zero (for the major axes), whether X-Y is a multiple of 3 (for most of the diagonal lines), whether X*Y=49 i.e. both are 7 (for an awkward special case), and whether X and Y are both greater than 4 but X*Y is less than 37 (for the bulges on the diagonal lines).
Comments:
Thanks to Logiker for setting the challenge, these are always fun to play with!