51 byte Christmas Diamonds in Basic
Author: serato / finnish gold
Category: Christmas Challenge
System: C64
Language: C64 Basic V2
Len source code: 78
Len exe file: 53
Len code only: 51
Instructions:
Load PRG and run
Description:
The desired repeating diamond pattern may be constructed as the union of forward-
leaning diagonal stripes /// and backward-leaning diagonal stripes \\\. As these
are just mirror images, this code only calculates the x values of the backward
leaning stripes over a range of [-17,18] and uses ABS() to fold the negative
values onto the positive range.
Comments:
1. C64 Basic V2 has no modulo function. The conventional substitution is
x-n*INT(x/n). The coarse X offset is added inside the brackets.
2. The key to this working is giving TAB() random access, which is achieved by
allowing the natural carriage return provided by PRINT, and cursoring up one line.