Snowflake
Author: 1e1001
Category: Christmas Challenge
System: Browser
Language: WebAssembly
Len source code: 1035
Len exe file: 211
Len code only: 152
Instructions:
Open snowflake.html in your modern web browser of choice.
Description:
3-level lookup table, text is split into 4-byte chunks (15 unique ones), then into 5-chunk "lines" (-ish).
Roughly equivalent C code:
const char lut[] = "...";
int i = 0;
do {
putc(lut[lut[lut[i/20] + i/4 - 64] + i%5 - 4]);
} while (i << 23 != 0);
Comments:
If I'm emulating a computer anyways, might as well use one built to be emulated :)
Since WASM only does libraries, I made it mimic IO of a vintage system (or C)
- js.putc(i32) to write a character
- js.mem for main memory
- export main() entry point