Christmas Diamonds
*********** * 60x2=32 * *********** Author: Arnolde / Leosoft Category: Christmas Challenge System: CPC 6128 (6128 only!) Language: Z80 Assembler Len source code: 2477 bytes (including comments!) Len exe file: 32 bytes Len code only: 32 bytes Instructions: * Insert Disk ("60x2=32") in emulator or real CPC * LOAD"VCCC23 * CALL &BAE0 Description: The program follows this basic idea: In a window of 19 characters width, repeat typing " *" (5 spaces + 1 star), and you get this: |12345*12345*12345*1| |2345*etc. * * | | * * * | | * * * | etc. For simpler code, we proceed in the other direction: every star is 6 to the left of the previous one, if x<0, 19 is added to the (negative) x-value and we go one line down. |* * * *| 19, 13, 7, 1, (-5) -> | * * * | 14, 8, 2, (-4) -> | * * * | 15, 9, 3, (-3) etc. | * * * | etc. The desired pattern is just these two combined. So, all we have to do is start in the middle position (x=9) and mirror every star to the other side of the line. Repeat 60 times and done. (Hence the name of the program "60x2") Comments: Merry Christmas!
[ back to the prod ]