News for hackers. Stuff that matters.
Re:Can you build a recognizable World Map in under 500 bytes? by iweczek on Wednesday July 01, 2026 @10:48AM (#48747763)
Experimenting with drawing a world map and micro-optimization.
Re:Can you build a recognizable World Map in under 500 bytes? by gus_massa on Thursday July 02, 2026 @12:34PM (#48763940)
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.

Re:Can you build a recognizable World Map in under 500 bytes? by TacticalCoder on Saturday July 04, 2026 @10:22PM (#48790781)
> 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).

Re:Can you build a recognizable World Map in under 500 bytes? by TurboTveit on Saturday July 04, 2026 @10:41PM (#48790864)
If you were to render only one lake in Africa I would expect Lake Victoria
Re:Can you build a recognizable World Map in under 500 bytes? by AaronAPU on Saturday July 04, 2026 @06:38PM (#48789725)
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.

Re:Can you build a recognizable World Map in under 500 bytes? by wizzwizz4 on Saturday July 04, 2026 @06:45PM (#48789780)
A perfect implementation would be a Kolmogorov oracle. https://en.wikipedia.org/wiki/Kolmogorov_complexity#Halting_... suggests this is equivalent to a halting oracle. So, it depends what you mean by "good".
Re:Can you build a recognizable World Map in under 500 bytes? by convolvatron on Saturday July 04, 2026 @06:42PM (#48789758)
that sounds pretty related to Kolgomorov complexity, which is uncomputable in general. https://en.wikipedia.org/wiki/Kolmogorov_complexity

I too would be interested in approximations or heuristics if anyone has any

Re:Can you build a recognizable World Map in under 500 bytes? by Analemma_ on Saturday July 04, 2026 @06:43PM (#48789764)
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.
Re:Can you build a recognizable World Map in under 500 bytes? by Analemma_ on Saturday July 04, 2026 @07:17PM (#48789941)
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.
Re:Can you build a recognizable World Map in under 500 bytes? by cwmoore on Saturday July 04, 2026 @08:52PM (#48790373)
I can see leas than half of it. Imgur?
Re:Can you build a recognizable World Map in under 500 bytes? by cwmoore on Sunday July 05, 2026 @10:29AM (#48794556)
Thanks? for the obtrusive ads and the downvote?

HN can do better.

Re:Can you build a recognizable World Map in under 500 bytes? by gus_massa on Saturday July 04, 2026 @09:32PM (#48790556)
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.

Re:Can you build a recognizable World Map in under 500 bytes? by Analemma_ on Saturday July 04, 2026 @10:30PM (#48790820)
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.
Re:Can you build a recognizable World Map in under 500 bytes? by gus_massa on Sunday July 05, 2026 @12:37AM (#48791299)
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.)

Re:Can you build a recognizable World Map in under 500 bytes? by boulos on Saturday July 04, 2026 @10:35PM (#48790837)
And it made a classic optimization: removing New Zealand :).
Re:Can you build a recognizable World Map in under 500 bytes? by Analemma_ on Saturday July 04, 2026 @10:37PM (#48790846)
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 :)
Re:Can you build a recognizable World Map in under 500 bytes? by effnorwood on Saturday July 04, 2026 @06:46PM (#48789784)
heck yea! 499 tera. no problem.
Re:Can you build a recognizable World Map in under 500 bytes? by ksymph on Saturday July 04, 2026 @06:46PM (#48789785)
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.
Re:Can you build a recognizable World Map in under 500 bytes? by H8crilA on Saturday July 04, 2026 @07:18PM (#48789947)
Any decent compressor will take care of this - and much more.
Re:Can you build a recognizable World Map in under 500 bytes? by hnuser123456 on Saturday July 04, 2026 @08:53PM (#48790380)
Here's a map in one bit, where 0 is water and 1 is land: 0
Re:Can you build a recognizable World Map in under 500 bytes? by fourthark on Saturday July 04, 2026 @10:48PM (#48790883)
Rather lossy
Re:Can you build a recognizable World Map in under 500 bytes? by simonw on Saturday July 04, 2026 @06:59PM (#48789848)
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
  )
Re:Can you build a recognizable World Map in under 500 bytes? by gabrielsroka on Friday July 17, 2026 @01:05PM (#48949645)
u don't need the first .then: https://github.com/piwodlaiwo/smallest-world-map/pull/1

mine is shorter

Re:Can you build a recognizable World Map in under 500 bytes? by throwrioawfo on Saturday July 04, 2026 @07:27PM (#48789992)
What's the point in doing things like this if you just get Claude to do it?
Re:Can you build a recognizable World Map in under 500 bytes? by StilesCrisis on Saturday July 04, 2026 @09:40PM (#48790590)
What's the point of any of it to begin with? Why paint a painting? Why learn to play guitar?
Re:Can you build a recognizable World Map in under 500 bytes? by hmry on Saturday July 04, 2026 @09:44PM (#48790615)
Why make Claude play the guitar?
Re:Can you build a recognizable World Map in under 500 bytes? by netsharc on Saturday July 04, 2026 @10:27PM (#48790801)
I wonder how many people hallucinated the word "can" in your comment and downvoted because of it..
Re:Can you build a recognizable World Map in under 500 bytes? by wizzwizz4 on Sunday July 05, 2026 @06:58AM (#48793119)
To be fair, the greyed-out text is hard to read.
Re:Can you build a recognizable World Map in under 500 bytes? by iweczek on Monday July 06, 2026 @01:00PM (#48807406)
well i did it 10 years ago by myself in 1013 bytes :)
Re:Can you build a recognizable World Map in under 500 bytes? by BretonForearm on Saturday July 04, 2026 @07:39PM (#48790053)
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.

Re:Can you build a recognizable World Map in under 500 bytes? by userbinator on Saturday July 04, 2026 @07:48PM (#48790109)
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.
Re:Can you build a recognizable World Map in under 500 bytes? by cwmoore on Saturday July 04, 2026 @07:59PM (#48790150)
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 if 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/

Re:Can you build a recognizable World Map in under 500 bytes? by 1e1a on Saturday July 04, 2026 @08:44PM (#48790335)
I feel like this challenge would be a lot more interesting if the size of complete code needed to output the map were counted.
Re:Can you build a recognizable World Map in under 500 bytes? by iweczek on Monday July 06, 2026 @12:56PM (#48807342)
Both are interesting, my html file is 846 bytes and the actual map data pulled in is 445 bytes but a comment on my blog someone came down to 786 bytes and it looks like under 400 bytes of data for the map.
Re:Can you build a recognizable World Map in under 500 bytes? by im3w1l on Saturday July 04, 2026 @08:55PM (#48790391)
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.

Re:Can you build a recognizable World Map in under 500 bytes? by urbnspacecowboy on Saturday July 04, 2026 @09:53PM (#48790656)
> 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...

Re:Can you build a recognizable World Map in under 500 bytes? by im3w1l on Sunday July 05, 2026 @01:35PM (#48796122)
While the idea of using RLE with implicit swapping is the same, everything else is different. I'm not sure it's better in this case. One thing my version did is that it had explicit linebreaks, this approach was chosen as the map in the article had lines of varying lengths. If you don't now you have to accomplish that some other way, e.g. explicitly fill the line up with spaces and some mechanism of communicating the width of the image.

I also think using a varint encoding is a big win over fixed-width.

Re:Can you build a recognizable World Map in under 500 bytes? by 27183 on Saturday July 04, 2026 @09:05PM (#48790434)
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.
Re:Can you build a recognizable World Map in under 500 bytes? by FireBeyond on Saturday July 04, 2026 @09:19PM (#48790495)
How is that "recognizable"?
Re:Can you build a recognizable World Map in under 500 bytes? by 27183 on Saturday July 04, 2026 @09:27PM (#48790530)
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.
Re:Can you build a recognizable World Map in under 500 bytes? by chriscjcj on Saturday July 04, 2026 @09:34PM (#48790563)
I know this doesn't meet the spirit of the challenge, but...

          _,--',   _._.--._____
   .--.--';_'-.', ";_      _.,-'
  .'--'.  _.'    {`'-;_ .-.>.'
        '-:_      )  / `' '=.
          ) >     {_/,     /~)
  snd     |/               `^ .'
Re:Can you build a recognizable World Map in under 500 bytes? by murderfs on Saturday July 04, 2026 @10:34PM (#48790832)
Re:Can you build a recognizable World Map in under 500 bytes? by Retr0id on Saturday July 04, 2026 @11:21PM (#48790993)
I asked deepseek to turn this into an offscreen-canvas-based ascii renderer: https://retr0.id/stuff/worldgolf.html

Weighs in at 379 bytes (or 378 if you trim the newline). Obviously it is font-dependent, but it works on my machine!

Edit: golfed a bit further, but unsure how reliable it'll be with different fonts: https://retr0.id/stuff/worldgolf2.html

Re:Can you build a recognizable World Map in under 500 bytes? by cwmoore on Monday July 06, 2026 @01:46AM (#48801067)
Enhance!
Re:Can you build a recognizable World Map in under 500 bytes? by sethev on Saturday July 04, 2026 @10:28PM (#48790810)
it said recognizable, and I recognize this :)
Re:Can you build a recognizable World Map in under 500 bytes? by TacticalCoder on Saturday July 04, 2026 @10:20PM (#48790774)
One could probably map this in JavaScript in 3D on a rotating sphere and it'd be a "recognizable world map" of sorts.
Re:Can you build a recognizable World Map in under 500 bytes? by chriscjcj on Sunday July 05, 2026 @01:40AM (#48791516)
Re:Can you build a recognizable World Map in under 500 bytes? by cwmoore on Monday July 06, 2026 @01:45AM (#48801054)
180?
Re:Can you build a recognizable World Map in under 500 bytes? by netsharc on Saturday July 04, 2026 @10:30PM (#48790813)
The ASCII art reminds me of teletext.. this page shows a globe on a teletext page: https://www.wikiwand.com/en/Teletext
Re:Can you build a recognizable World Map in under 500 bytes? by magicalhippo on Saturday July 04, 2026 @11:26PM (#48791009)
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

Re:Can you build a recognizable World Map in under 500 bytes? by snailmailman on Sunday July 05, 2026 @12:13AM (#48791202)
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.

Re:Can you build a recognizable World Map in under 500 bytes? by iweczek on Monday July 06, 2026 @12:57PM (#48807361)
great job, looks like you got it down to 786 bytes of html and under 400 for the map data. I like your approach.
Re:Can you build a recognizable World Map in under 500 bytes? by roshin on Sunday July 05, 2026 @12:29AM (#48791259)
you could save some bytes by removing new Zealand, the world would still be recognizable ;)
Re:Can you build a recognizable World Map in under 500 bytes? by iweczek on Monday July 06, 2026 @12:58PM (#48807382)
lol