-- Leo's gemini proxy

-- Connecting to xchg.cc:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini;lang=en-US

Binary Golf Grand Prix 4


This year I finally managed to complete an entry for BGGP. It's nothing fancy, just a quick take on a self-replicating HTML file. The challenge is a self-replicating file which must make one copy of itself, not run that copy, and display or output the number 4. I figured a self-replicating HTML wouldn't be too much trouble, but seeing just how small I could get it would be interesting, for sure.


My final result is a 123 byte file, which displays the number four in the browser, and downloads an exact copy of itself to a file named 4 in your downloads directory.


<body>4<script>d=document;f=d.createElement('a');f.href='data:;,<body>'+d.body.innerHTML;f.download='4';f.click();</script>


We are able to get this as small as it is by using the variable d to represent document at two places in the file, not specifying a data type in the download, and not closing the body tag. I am still hunting for other possibilities to shave off another byte or two.

-- Response ended

-- Page fetched on Sat May 11 06:01:47 2024