Microsoft Basic Chirstmas Star Author: Sergey Kiselev Category: Christmas Challenge System: Any system running Microsoft BASIC (CP/M MBASIC, IBM PC - GWBASIC, MSX - MSX BASIC, etc.) Language: Microsoft BASIC Len source code: 185 Len exe file: 185 bytes Len code only: 185 bytes (can be reduced, but will make code less readable) Instructions: Use your favorite computer that can run Microsoft BASIC (other BASIC versions might work too) 1. Load the program by typing: LOAD "STARP.BAS" 2. Type "RUN" to run the program An online BASIC interpreter, such as https://www.quitebasic.com/ can be used too: 1. Open starp.bas in a text editor 2. Copy the content of the file to the "BASIC Program" (erase the default content first) 3. Modify line 10 to "10 LET S = 4" (Microsoft BASIC does not need LET operator when defining variables) 4. Click the Run button to run the program Description: The algorithm uses the symmetry of the star, with the origin (0,0) being in the center of the star. It iterates over -8 <= X <= 8 and -8 <= Y <= 8 - For the positive quarter, it draws asterisks everywhere except of the following cases: - The corner, where both X>4 and Y>4 - Two 45° cutouts. These cutouts can be described by the following inequalities: X-Y>4 and Y-X>4 The other three quarters are a mirror image of the positive quarter, and are checked using using absolute value of coordinates "ABS()" Note that the star size is parameterized (S), so the algorithm can be easily modified to draw larger or smaller stars Comments: The code is pretty elegant and straightforward, and can be easily ported to other BASIC implementations or any other programming languages It is possible to make the code slightly smaller by removing the size parameterization and combining several lines into one, but that will make it less readable