ASCIRISK_BAS
Author: Arnolde/Leosoft
Category: Wild
System: Amstrad CPC
Language: Locomotive BASIC
Len source code: 102 bytes
Len exe file: 100 bytes
Len code only: 97 bytes
Instructions:
Load the ascirisk_bas.dsk file and type RUN"ASCIRISK
Description:
After experimenting with the lengths of blanks and stars for each line and not
getting anywhere, I decided to go with a coordinates-based approach instead.
The center of the star is 0,0 and it goes 8 squares in each direction.
I combined two shapes:
When drawing stars only if (|x|<5 OR |y|<5) we get a plus-shaped cross.
When drawing only if (||x|-|y||<5), we get a X-shaped cross.
By combining (ANDing) these two forms, we get the requested star shape.
I ended up with a BASIC condition like this:
IF (ABS(x)>4 AND ABS(y)>4) OR (ABS(ABS(x)-ABS(y))>4) THEN PRINT " "
(instead of default *)
The fact that all the values are compared to 4 led me to this construction:
IF MAX(MIN(ABS(x),ABS(y)),ABS(ABS(x)-ABS(y)),4)=4 THEN PRINT "*"
Last step: Why not get rid of the comparison and just adding this value to 38?
If it's 4, we get 42, the ASCII value of *, if it's more, we get other symbols
and a nice pattern outside of the star.