XMAS-FLAKE-DRP - Vintage Computing Christmas Challenge 2022 (VC³ 2022)
======================================================================
Date of completion: 2022-12-13
Author: dr-prodigy (Maurizio Montel)
Category: Christmas Challenge
System: C64
Language: BASIC v2
Len source code: 219 bytes (+3 CR)
Len exe file: -
Len code only: -
Instructions:
- Install (Win)Vice
- Drag and drop xmas-flake-drp.prg file into it
Description:
The code, written in BASIC v2 for C64, is designed to be as short as possible
(both PRG and source file are 222 bytes long).
In particular, the whole logic is squeezed into one single line (0), while the
remaining 2 lines contain image DATA.
In order to reach this goal, code makes use of abbreviations (accurately chosen
among the shortest available, eg: SPC( and RIGHT$), so the code is 79 chars
max per line when abbreviated, while (obviously) becoming longer when LISTed.
Algorithm splits the image in 17 rows, each made of 4 blocks, with this
structure:
blanks-stars-blanks-stars
which allows to represent any row of the snowflake image.
DATA lines provide the number of characters to be printed per each block.
Highlights:
- DATA are read and printed using
SPC(x) for blanks
RIGHT$("********",x) for stars
=> shortest possible way (hopefully and IMHO!)
- READ and PRINT commands are unrolled (no additional loops), and print their
part on the same line (;). The last PRINT of the row adds the required new
line. While requiring very short code, this allows also for a pretty quick
execution
- longest streams of stars (max 17 chars) are represented using:
- a block of 9 "*" chars
- a block of 8 "*" chars.
This allows to reduce length of X$ to 9 chars only, thus reducing further the
required program length.
Comments:
Thank you for this nice contest: it's always great to have an excuse to play
around with my beloved breadbin :-)
I wish you all a very Merry XMas and a Happy 2023!
Enjoy XMAS-FLAKE-DRP, your C64, and life!
Cheers
dr-p