9 ms·
I've golfed my assembler for the Nand2Tetris assembly language down to 714 bytes of Python3. Sure I use some cheap tricks (like single-letter variable names, or
by hoosieree 4y ago
I've golfed my assembler for the Nand2Tetris assembly language down to 714 bytes of Python3. Sure I use some cheap tricks (like single-letter variable names, or writing 16384 as 4*7 to save a byte) but more surprisingly, it forced me to write in a completely different style.
When your whole program/algorithm comfortably fits on the screen it affords the unique ability to program "in the large" and "in the small" simultaneously. Bugs can't hide. My assembler contains an "elif" without a closing "else", which would normally bother me. But since I can see it all at once I can judge it in context and weigh its purpose against my aesthetics.
I'd recommend golfing some toy program down until you are sure it is as small as it can possibly be, it's a cool experience.
- rightbyte 4y agoI once made a space ship game in 255 bytes for an uni assignment in a toy instruction where you could do whatever you wanted. The space ship and obstacles were interleaved in the code and you had to play it trough the debugger view. I feel I would have loved programming in the 70s ...
- hoosieree 4y agoThat sounds impressive! Nice work.