Well, it’s late Sunday afternoon in California, but already after midnight GMT, so I guess I missed the deadline. My code is for the Apple 1, and is 76 bytes of machine language. You need about 176 keystrokes to enter it into WozMon, so it has to be broken into two lines.
80:D8 A9 FF 48 A9 1E 48 A9 FA 85 95 A2 4 A9 FE 85 92 A9 0 18 69 0 18 69 8 85 92 20 AE 0 CA D0 F0 E6 95 E6 95 30
:E4 A9 2 20 AE 0 A9 2 85 C2 A9 8D 20 EF FF A9 26 38 E5 C2 4A A8 A9 A0 20 C5 0 A0 0 A9 AA 20 EF FF 88 10 FA 60
It’s pure self-modifying code, with no tables.
I used a legal pad and a #2 pencil for development, and I assembled and debugged a slightly different version of it using the monitor and mini-assembler on an Apple ][ 'mulator before pasting it into an Apple 1 'mulator and executing.
Ok, I decided for a poetic effort in BASIC (for Commodore 8-bit), meaning, rather than optimizing for length (180 bytes including the REMark), I went for a festive underline decoration, nicely filled lines and a poem-like structure.
Mind that the bare algorithm looks something like this (122 bytes), putting into consideration that the argument passed to SPC() is truncated to integer anyway:
2 FOR A=1 TO 3:FOR B=1 TO 4:PRINT SPC(20-B*A);STRING$(2*B*A-1,"*"):NEXT:NEXT:PRINT SPC(18)"***"'SPC(18)"***"
Aw, BBC-BASIC and its STRING$ command – this is unfair!
*) Meaning, in Commodore BASIC, we’d either have to define a base string to operate on (compare my “festive underline decoration”) or use FOR-NEXT loops to print the individual characters, which is much lengthier (both in code and runtime).
Nice! “dc (desk calculator) is a cross-platform reverse-Polish calculator which supports arbitrary-precision arithmetic … one of the oldest Unix utilities, preceding even the invention of the C programming language.”
Well with shell programs, 3 keys and a click comes to mind.
Click on tree, select all, select cut, select paste, select trash can. copied exactly:)
Uinix people can | dev/null
Lots of great ways to print that tree. Good work people. Ben,
Is there any sense in which you could hand-code the CINTCODE, in an analogous way to writing in assembler? Perhaps just tweaking and optimising the compiler’s output?? (Not that this would necessarily be fun, but perhaps it might be…)