microsoft basic 79 chars
Author: Thorbjørn Ravn Andersen
Category: Christmas Challenge
System: CP/M (but should work on any 8-bit Microsoft Basic)
Language: Microsoft Basic 5.29
Len source code: 79 (saved as ascii)
Len exe file: N/A
Len code only: N/A
Instructions:
Clone and compile https://github.com/MockbaTheBorg/RunCPM. I did it on a Mac.
In the RunCPM directory unpack the included DISK.ZIP to A/0
Copy X3.BAS to A/0
Execute the RunCPM binary, this should give an "A0>" prompt
Type "DIR" to verify files are present, including MBASIC.COM and X3.BAS
Type "MBASIC X3" to execute the program.
Type "SYSTEM" to return to the A0> prompt
Type "EXIT" to leave the emulator
Comments:
The code uses the fact that the desired pattern can be drawn using
lines that are 45 degrees giving that an +1 change horisontally
(variable J)
give either a +1 or a -1 change vertically. (variable I)
As they also are 6 characters apart this can be done simply by saying
that we look at I+J and I-J modulo 6 to see if an asterisk should be drawn.
The loop values are chosen to ensure that the pattern is drawn correctly and
to avoid that (I-J) becomes negative which appeared to confuse MOD.
The CHR$ replaced an IF...THEN?"*";ELSE?" " construction to save two characters.
The ">0" returns -1 if true.
This was fun. Thanks
Mac OS X 2 ¾ ð ATTR ð X X com.apple.quarantine q/0083;658a0a0a;com.apple.Safari.SandboxBroker.xpc;1A025890-209B-4C66-83EC-5481AA800CB9