AI news

Karpathy shows a Civilization-style US data map built with Claude

By 新智元1 viewsSource: 新智元
Karpathy shows a Civilization-style US data map built with Claude

Karpathy says Claude Opus 5.5 built usaciv in about 7 hours and 45,000 lines of code, mapping 31 public sources with 19 data lenses. It is a visualization, not a game, covering the contiguous 48 states and DC; its data processing and indicators follow project-specific definitions.

Seven hours and 45,000 lines of code: Claude packed the United States into a Civilization-style map!

Today, Andrej Karpathy, an OpenAI founding member and the father of "vibe coding," posted this:

I asked Claude to fill a Civilization-style game map with real US data. Opus 5.5 downloaded and parsed a huge amount of public data. Seven hours and 45,000 lines of code later... it worked :)

Article illustration

His setup was simple: open the Claude Code desktop app, set Opus 5.5 to medium, and turn on ultracode mode.

Thirty-one public government data sources, ranging from the census, GDP, and power plants to natural disasters, were all laid onto the same 25-kilometer hexagonal grid. Every number can be traced to its source.

The website is now live and open for anyone to explore at karpathy.ai/usaciv. Karpathy's post also included a 30-second trailer.

The project's entire source code has been released for free under the MIT license and can be downloaded through the "?" in the website's upper-right corner. First, take a look around the site; then dig into the source.

01

GDP turns into gold; San Jose has one coder in four people

Open the website and you are greeted by a hexagonal, turn-based strategy map that Civilization players will instantly recognize. None of the terrain, forests, or farmland was invented: it all comes from real NOAA and USGS data.

Article illustration

Zoom into the northeastern United States, and the New York metropolitan area's banner stands tall. It displays two hard numbers: $2.44 trillion in GDP and a population of 20.11 million, both ranking first nationwide.

Article illustration

The very first sentence of the source documentation says:

This is a visualization, not a game. It depicts the real United States as a turn-based strategy map.

It is not a game, but it borrows Civilization's game vocabulary to explain statistics.

Claude replaced all five of the game's yields with actual government statistics:

• Gold = actual GDP data from the US Bureau of Economic Analysis for 2024, totaling $29.3 trillion in the national top bar;

• Food = employment in agriculture, forestry, fishing, and hunting;

• Production = employment in manufacturing, construction, and mining;

• Science = employment in professional and technical services and information;

• Culture = employment in arts and entertainment.

Even Civilization's "Amenities" were replaced with CDC health indicators.

You can also turn on "lenses" to make the map a window into America's socioeconomic landscape.

Article illustration

Claude created 19 data lenses, divided into 7 groups, in one go. With a click, the map smoothly switches among layers for income, education, broadband, religion, disasters, and more.

Turn off the lenses and return to the main map, and the most eye-catching features are its golden arcs. These are the country's top 40 interstate trade routes, drawn by Claude using Federal Highway Administration data.

Article illustration

The leading trade route links New York and Boston, 306 kilometers apart, carrying $61.9 billion in goods each year.

Follow a trade route back into a city, and its "districts" and city badges are also classified strictly by actual industries. Claude retrieved industry employment data from the US Bureau of Labor Statistics to calculate each city's industrial location quotients.

Put simply, this identifies industries that are more concentrated in a city than the national average. Detroit, which ranks sixth nationwide in production, receives the "Motor City" badge.

San Jose, in the heart of Silicon Valley, displays a "Tech City" badge and has its own "Campus" district. That is because computer services account for at least 2.8 times the national average share of local employment.

Article illustration

Click into the "city view," which covers 524 US metropolitan areas, and the detail is just as extensive. Rows of little figures in the panel are arranged strictly according to the area's actual occupations, ages, commuting patterns, educational attainment, and birthplaces.

In San Jose, one in every 4 workers is an engineer, programmer, or scientist. Nationally, the average is only one in 14!

02

31 official sources: Missing data stays blank, never zero

Every layer and every number on the map is backed by official data. This is the most substantial part of the project.

Article illustration

Claude gathered 31 public data sources, choosing only public downloads that required no API-key application. The data comes from the census, the Bureau of Economic Analysis, the Bureau of Labor Statistics, the Energy Information Administration, NOAA, the National Park Service, and FEMA.

In sources.json, every downloaded file is recorded with its exact URL and SHA-256 checksum. The first full pipeline run downloads about 500 MB of raw data. After cleaning and aggregation, opening the website requires loading only about 6 MB.

Downloading is relatively easy. The hardest part is aligning all the different statistical definitions. The 31 sources include power plants located by latitude and longitude, tables aggregated by county, and remote-sensing rasters distributed by pixel.

Underneath, Claude uses an Albers equal-area projection to ensure each cell represents the same real land area. The contiguous United States is covered by a 25-kilometer hexagonal grid, with each cell representing approximately 1,600 square kilometers. County figures are allocated to a cell according to the share of the county's area it covers.

To prevent numerical errors, the pipeline ends with a strict validation gate.

Every row in the validation report must be marked pass, note, warning, or failure. A single "failure" means the entire run does not pass.

The source documentation even includes a dedicated section titled "Reading This Map Honestly":

The map is playful, but the numbers are real.

The map insists that missing data stays blank and is never replaced with zero, and each lens explicitly states its limitations. The religion lens, for example, openly notes that it counts only adherents reported by churches, covering roughly half the US population.

Even the selection rules for the map's 52 wonders are clearly documented. National parks are ranked by visitor numbers, with the leading Great Smoky Mountains attracting 11.53 million visits a year. Research universities are ranked by R&D expenditure, with leader Johns Hopkins University spending $4.53 billion a year.

For another 12 National Historic Landmarks, the project plainly states that they were "handpicked, not ranked by any data."

The map includes only the contiguous 48 states and Washington, DC. Alaska, Hawaii, and overseas territories are absent. Karpathy even apologized on the AI's behalf in his post: "Claude decided to skip a few states and territories on its own, sry."

03

45,000 lines with zero dependencies; art and music made entirely in code

The 45,000 lines of code Claude delivered are remarkably clean:

• A purely static website, using only vanilla JavaScript and the Canvas 2D API;

• Zero external dependencies: no framework and no npm, without even a build or bundling step;

• A standard-library-only backend: the Python pipeline that processes 500 MB of data uses only Python's built-in standard library.

The project imports no ready-made textures. All its artwork is drawn in code: snowy mountains, water, icons, and city skylines stretching across several cells are all rendered stroke by stroke through Canvas drawing instructions.

The source also includes a "trailer maker," which produced the 30-second trailer Karpathy posted. It uses no video-editing software, rendering a 1080p video directly in the browser, frame by frame.

Even the original background score is synthesized live in code through the Web Audio API, precisely timed to the cuts!

Article illustration

04

An ordinary subscription, and a new craft for the AI era

The map was finished, but Karpathy's own assessment was casual:

I'm not sure where this is going, but it's really fun to explore and play with. Maybe it could be expanded or turned into a game. But I only have half my Claude allowance left this week, so someone else will have to take over :D

Readers picked up on the allowance remark. One asked whether work accounts had higher limits. Karpathy casually replied that they did, but "this is just a side project I made for fun, so I'm using my ordinary subscription."

One ordinary subscription, 7 hours, 31 official data sources, and 45,000 lines of code with zero dependencies, plus artwork, editing, and composition.

Finding data, aligning it, drawing graphics, and composing music: Opus 5.5 did all of that. Karpathy supplied only the idea of filling a Civilization-style map with real data. But now that agents can churn out code all day, that idea is precisely what is most valuable.

Code is no longer scarce. What is scarce is people who know what to make.

This article is from Xinzhiyuan, by Xinzhiyuan.

Related topics

After reading

Join the AINRK community

Read how to join the community and connect with people working in AI.

Community information (opens in a new tab)