跳到正文
Roland.W· 来源· @rwayne · X·· 7 天前同新闻AI 评分82

同一新闻,精选展示《Karpathy 用 Claude Code 和 Opus 5.5 基于真实数据构建游戏地图》

正文

45K 行代码,7 个小时,31 个美国官方数据源,卡帕西在 Claude Code 用 Opus 5.5把整个美国都放进了一张《文明》地图里。

他要求很简单,就是抓取公开数据,然后铺成像回合制游戏一样的六边形地图,跑完之后可以直接点开玩。

数据源包括人口普查局、经济分析局、劳工统计局、能源信息署、NOAA、USGS、国防部、国家公园管理局、FAA、FEMA、CDC 这些。

海拔、地表覆盖、GDP、就业、发电厂、矿山、港口、机场、军事基地、公园、大学、货物运输路线、灾害记录,所有这些东西都被对齐到了同一个 25 公里的六边形网格上。

这些数字被转化成了游戏里的产出。比如金矿产量就是 GDP。

城市划分是按照当地真实的产业来定的:圣何塞被标记为“校园”区,底特律是“汽车城”。

居民的构成也是基于真实的劳动力结构生成的:圣何塞每四位上班族里就有一位是工程师、程序员或者科学家,而全国平均是十四位里有一位。

奇观的选择也是依据公开规则来的:国家公园是按游客量排序的,大学是按研发投入排序的。

他还留了 19 个图层,包括收入、学历、宗教信仰、灾害等等,而且 524 个都市区都有自己的城市视图。

还有九个顾问加上一个探索器。这个探索器可以把 3100 多个县里的任意一列数据拉出来做成表格和散点图,并且可以和地图联动。

我一直以为这种数据工程得好几个人干好几个月,结果它一个周末就搞定了 😅

引用Andrej Karpathy@karpathy
I asked Claude to populate a Civilization-style game map with real data from the US. Opus 5.5 downloaded and parse a ton of public data and 7 hours and 45K lines of code later... it works :) - 31 real data sources including Census, BEA, BLS, EIA, NOAA, USGS, DoD, NPS, FAA, FEMA, CDC... - Real elevation, land cover, GDP, jobs, power plants, mines, ports, airports, bases, parks, universities, freight flows, disasters; all reconciled onto one 25 km hex grid. - The data is converted into Civilization language, e.g. Gold yield is GDP. A city's districts are its real industry specializations: San Jose gets a Campus, Detroit is "Motor city". Its citizens are its real workforce: 1 in 4 San Jose workers are engineers, coders or scientists, against 1 in 14 nationally. Wonders are chosen by published rules, such as national parks by visitor numbers and universities by R&D spending, etc etc. - 19 lenses (income, degrees, faith, disasters…), a City View for 524 metros, and nine advisors plus an Explorer. The Explorer turns any column for any of 3,100+ counties into a table and scatter plot, linked to the map. - Claude decided to skip a few states and territories sry - Built using Claude Code desktop app, Opus 5.5 on medium and turning on ultracode. It's deployed here: https://karpathy.ai/usaciv/ and the "?" has the source link too. I don't exactly know where I was going with this but it's really fun to browse and play with. Possibly it can be expanded or built into a game. I only have half of my weekly Claude quote left though so someone else will have to take over :D. Claude also made a trailer:
在 X 查看被引用的帖子

来源:Roland.W · x.com