Can you build a recognizable World Map in under 500 bytes?

(experimentlog.com)

33 points | by iweczek 4 days ago ago

48 comments

  • chriscjcj 12 hours ago ago

    I know this doesn't meet the spirit of the challenge, but...

              _,--',   _._.--._____
       .--.--';_'-.', ";_      _.,-'
      .'--'.  _.'    {`'-;_ .-.>.'
            '-:_      )  / `' '=.
              ) >     {_/,     /~)
      snd     |/               `^ .'
  • simonw 15 hours ago ago

    I didn't know you could do this with fetch() and a data: URI:

      fetch('data:;base64,1ZpLsgIxCEXnrM...==').then(
        r => r.body.pipeThrough(new DecompressionStream('deflate-raw'))
      ).then(
        s => new Response(s).text()
      ).then(
        t => b.innerHTML = '<pre style=font-size:.65vw>' + t
      )
  • BretonForearm 14 hours ago ago

    Going from "SVG/Canvas is wasteful" to a tile based approach is a giant leap. Wouldn't AI suggest delta encoding of polyline coordinates and discretization of deltas as small, maybe just 2-4 bit integers? Storing the X and Y delta vectors separately, rather than interleaved, could lead to a further increase to the compression ratio.

    What was asked of Claude? The article is very sparse on this.

  • AaronAPU 15 hours ago ago

    Is there a good known algorithm which performs general purpose compression where the target is a given turing complete instruction set? Rather than relying on a fixed general purpose decoder and the associated compressed data.

    I’m asking here instead of asking an LLM because that’s what humans used to do and it was pleasant.

  • gus_massa 3 days ago ago

    Why is there a lake in Africa near Congo/Gabon istead of one near Uganda?

    Also, can this be done with png? Most consecutive lines are very similar, so I'd expect the algebraic pass to be very useful.

    • TacticalCoder 12 hours ago ago

      > Why is there a lake in Africa near Congo/Gabon istead of one near Uganda?

      Africa and Europe are connected through Spain.

      There's no Suez channel.

      There are plenty of approximation: it's the whole point of the thing... You only get 1013 bytes (or, well, 500 bytes in the question asked).

      • TurboTveit 11 hours ago ago

        If you were to render only one lake in Africa I would expect Lake Victoria

  • 1e1a 13 hours ago ago

    I feel like this challenge would be a lot more interesting if the size of complete code needed to output the map were counted.

  • magicalhippo 11 hours ago ago

    With a whooping 500 bytes it should have sound, animation and disco lights[1][2].

    [1]: https://www.youtube.com/watch?v=_RtfXZQihes

    [2]: https://www.pouet.net/prod.php?which=105717

  • cwmoore 14 hours ago ago

    I like that yours is 45 rows of asterisks.

    Makes me think a project-and-rasterize pipeline, sampling a simplified world water boundary map under a variety of projection parameters should give you a range of bitmaps, and then it is up to whoever to decide if the detail lost in all of this renders it incompatible with the world as they know it.

    The site below takes detailed map files and removes significant detail for practical purposes:

    https://mapshaper.org/

  • userbinator 14 hours ago ago

    32x32 4bpp 16-color icon is 512 bytes. There definitely were programs that had a recognisable world map for an icon in those days, so the answer is yes.

  • ksymph 15 hours ago ago

    Since the map just has two states - land or water - I wonder if there's a way to represent the same information more efficiently bits rather than bytes.

    • H8crilA 15 hours ago ago

      Any decent compressor will take care of this - and much more.

    • hnuser123456 13 hours ago ago

      Here's a map in one bit, where 0 is water and 1 is land: 0

  • snailmailman 10 hours ago ago

    Its a fun challenge.

    I used https://squoosh.app to make a pretty good one. Mostly just a resize and then OxiPNG for compression. Managed a 124x62 black/white image. OP has a resolution of 195x53, so I had very similar, but slightly worse i think? mostly a different aspect ratio + map projection i think.

    playing with Squoosh.app is very fun, and you can very easily see how the jump from 500b to 1-2kb turns a map from "awful" to "very good" with the right settings.

  • 12 hours ago ago
    [deleted]
  • 12 hours ago ago
    [deleted]
  • Analemma_ 15 hours ago ago

    Presumably you could precompute some parametric function (probably a Fourier sum) which draws a reasonably close map of the world, and get that into 500 bytes with a math-focused programming environment (R, Julia, etc.)? I might try throwing Fable at this and seeing what I can get.

    • Analemma_ 15 hours ago ago

      Well, here's what Fable came up with in 499 bytes of R in about half an hour: https://pastebin.com/sBsiGD9t, result: https://imgur.com/a/W3eDdIC. Probably with sitting down and tweaking you could do even better, but I think this is a decent first start.

      • gus_massa 12 hours ago ago

        Did you or Fable decide to split North and South America?

        Can the it also split Africa/Arabia/Eurasia?

        Who/how decided which islands to keep and which to erase?

        If you want to save a few characters, you can replace `length(v)` with the actual number.

        • Analemma_ 11 hours ago ago

          Fable did that, I pretty much just told it to find the best Fourier sum which can draw a map of the world in less than 500 bytes of R. It downloaded geo data and made the curves to fit that on its own.

          • gus_massa 9 hours ago ago

            Can you post the unencode version? It would be nice to see the vector with the data, for example to count how many coefficients each continent got.

            Have you tried with Bezier curves? Your images show a lot of pointy parts, like Southeast Asia and that usually needs a lot of high frequencies in the Fourier representation, so I think something piecewise may be better. (Perhaps a polygon is better.)

      • boulos 11 hours ago ago

        And it made a classic optimization: removing New Zealand :).

        • Analemma_ 11 hours ago ago

          In its defense, it actually asked me whether I wanted to spend my 500 bytes on more resolution for the main continents or more landmasses, and I opted for the former. You can blame me for that, not Claude :)

      • cwmoore 13 hours ago ago

        I can see leas than half of it. Imgur?

  • netsharc 11 hours ago ago

    The ASCII art reminds me of teletext.. this page shows a globe on a teletext page: https://www.wikiwand.com/en/Teletext

  • roshin 9 hours ago ago

    you could save some bytes by removing new Zealand, the world would still be recognizable ;)

  • iweczek 4 days ago ago

    Experimenting with drawing a world map and micro-optimization.

  • im3w1l 13 hours ago ago

    Representation for this I came up with: Allocate one magic number for "start line with space" another for "start line with asterisk" then any other number means this many of the current character and then swap character.

    Then it's a matter of picking a suitable way to encode numbers into bits.

    I came up with groups of four bits. If the high bit is not set that is the number, if it is set then read an additional group of four bits, and interpret as a biased 7 bit number. This came out to 400 bytes not including decompressor.

    • urbnspacecowboy 12 hours ago ago

      > Allocate one magic number for "start line with space" another for "start line with asterisk" then any other number means this many of the current character and then swap character.

      The galaxy brain move would be to always arbitrarily start with one character, replace the two special numbers with a single "don't output any characters, just swap" number, and then... congratulations, you just reinvented CompuServe RLE!

      http://fileformats.archiveteam.org/index.php?title=CompuServ...

  • effnorwood 15 hours ago ago

    heck yea! 499 tera. no problem.

  • shattl 11 hours ago ago

    [flagged]

  • throwrioawfo 14 hours ago ago

    What's the point in doing things like this if you just get Claude to do it?

    • StilesCrisis 12 hours ago ago

      What's the point of any of it to begin with? Why paint a painting? Why learn to play guitar?

      • hmry 12 hours ago ago

        Why make Claude play the guitar?

    • netsharc 11 hours ago ago

      I wonder how many people hallucinated the word "can" in your comment and downvoted because of it..

      • wizzwizz4 3 hours ago ago

        To be fair, the greyed-out text is hard to read.

  • 27183 13 hours ago ago

    Yes. Here's a map of the entire world in 1 byte. Both hemispheres. The northern hemisphere is depicted above, the southern hemisphere is depicted below:

      :
    
    You're welcome.
    • FireBeyond 13 hours ago ago

      How is that "recognizable"?

      • 27183 12 hours ago ago

        I claim it's obviously recognizable as the entire surface of a 3-sphere projected onto 2 dimensions, and therefore is clearly an acceptable answer to the original question posed. I added some helpful and clarifying prose expounding upon which hemisphere is what, but could have left that as an exercise to the reader without loss of generality.