- Programming in a Trance: The author, an early adopter of large language models (LLMs) since 2022, used them to generate code including for a large-scale JavaScript project. The goal was to test trance-like code generation. The author chose free versions of Grok 3, Claude, and Gemini, with Gemini 2.0 Flash being the main one used.
- The Game: Kriegspiel: Germans invented war games like Kriegspiel after the Napoleonic Wars. The game has simple rules with six unit types and the goal is to eliminate the opposing general. The author had dreamed of creating it but lacked time and skills. The game code can be found by clicking a specific link.
- Choosing the LLMs: The author set a constraint to use only free versions. Gemini 2.0 Flash was mainly used for a reasonable-sized project. Claude and Grok 3 were used for specific functions. Models showed limitations when the project exceeded a certain size.
- First Mistake: The Monolithic Approach: The author's initial attempt to write a detailed prompt for the entire game was rejected by the LLM as too complex. The LLM provided a plan instead.
- The Incremental Approach: The author adopted a step-by-step strategy. Started with generating a game map in JavaScript, then added graphical elements. Encountered issues with icon generation and code splitting. It's essential to use Git for version control. Errors accumulate as the session grows.
- Developing the Initial Version: Managed to develop a first version with a map, color variations, units, movement, and combat mechanics. Combat mechanics were complex and some decisions were abandoned. Added fog of war and then tried to add server capabilities.
- The Weight of Files and Performance Degradation: Adding server mode increased code size and degraded model performance. Had to review code for changes. Encountered issues with the machine generating only part of the code.
- Function Hallucinations: When working function by function, the code started hallucinating nonexistent functions. Corrected functions often matched the requested ones.
- The Need for Programming Knowledge: As the project grew, understanding programming became essential. LLMs struggled to identify code's internal logic. Solid programming knowledge was needed for fine-grained modifications. The best workaround was to generate specialized code and insert it manually.
- Conclusion: LLMs helped produce most code, especially when lacking JavaScript expertise. But as the project progressed, they had limitations. Code generated by the model was useful for taking over at the end. LLMs may handle massive projects in the future but are currently limited. Vibe-coding has possibilities but also has its limits.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。