你能用不到 500 字节构建一张可辨识的世界地图吗?
Can you build a recognizable World Map in under 500 bytes?

原始链接: https://www.experimentlog.com/blog/building-a-world-map-with-only-500-bytes

几年前,作者曾为 JS1k 比赛成功制作了一个小于 1KB 的世界地图,最近他重温这一挑战,尝试利用生成式人工智能(GenAI)来优化结果。通过使用 Codex,作者发现尽管 AI 在处理 SVG 路径复杂度和空间识别上存在困难,但在迭代 ASCII 表示形式方面却很有帮助。 此次突破不仅在于简化地图,更在于选择了针对压缩优化的格式。通过去除空白边缘和水印,作者发现“填充式”的陆地形状——包含长而可预测的重复字符——比稀疏的轮廓线压缩效果更好。通过对纯陆地的 ASCII 地图应用 `deflate-raw` 算法,作者将地图数据压缩到了仅 445 字节。加上必要的 base64 数据和解压逻辑,整个项目依然远低于 1KB 的限制。 作者目前正向其他人发起挑战,欢迎大家超越这一效率,或创作出更逼真的 1KB 世界地图。

抱歉。
相关文章

原文
World Map with only 500 bytes

A little over 10 years ago, I entered a JS1k compeition and built a small jsfiddle clone in under 1k. A few years later, I joined the competiton again to see if it was possible to build a World Map in under 1k. My approach was to render the world as ASCII inside a <pre> tag and use tiny characters for land and water. It worked, but lately I wanted to see if we can go even smaller in size, perhaps with the help of GenAI.

I have been doing a lot with Claude Code so for this I wanted to try Codex and I was surprised that AI did not perform very well. Codex considered a variety of approaches, starting with SVG which failed because 500 bytes seems not enough to draw anything recognizable. A real-looking world map is mostly coastline detail, and SVG/canvas paths have to pay for every coordinate. Once the shapes were simplified enough to be small, they stopped looking like the world.

Eventually, Codex landed back on ASCII format but it did not recommend further improvements like removing anything that did not help recognition. I suggested that water dots could be removed, the empty left margin was cropped, and the map was reduced to land-only * characters inside a tighter bounding box. We tested removing the filled interiors and keeping only continent outlines, but that actually compressed worse. Filled land creates long predictable runs of repeated characters, and compression loves repeated runs more than sparse outlines with lots of little gaps.

The final compression step used deflate-raw on the land-only cropped map. The visible map text was still 8,523 bytes uncompressed, but the compressed map data dropped to 445 bytes. I think that was the highlight, not drawing a less detailed map but choosing a representation that compression can exploit. The HTML is larger (still under 1k) because it needs base64 data plus browser decompression code, but the map itself is under 500 bytes.

You can check it out here and this is the repo. Now, can someone beat this with a different approach (not just removing a few characters) or generate a 1k version that is more realistic?

联系我们 contact @ memedata.com