页面简介
Build an AI-native snake game through conversation, then generalize the workflow to create your own mini game or demo.
正文摘录
Primary 1: AI Era, If You Can Speak, You Can Code This is a project-based learning tutorial. We encourage you to follow the steps one by one and try to reproduce the results. Don't worry about making mistakes or modifying the content. We always believe you can do it. Please always remember:Completion is more important than perfection 🐣Chapter Outline 🎯Learning ObjectivesConversational AI ProgrammingAI-Native Mini-GamesSnake Game PracticeIf you don't know how to program at all, or only know the basics, this chapter is for you. We will start from the very beginning: using conversations to have AI write code for you, without needing to memorize syntax or set up environments. It will run right in your browser.You will personally create your first running program—a Snake game that can "eat words, write poems, and draw". Through this practical exercise, you will experience what AI programming is really like: AI is not replacing your thinking, but rather, you speak your ideas, and AI helps you implement them.All creation starts from 0 to 1. We are glad to pass each bit of confidence and professionalism to you. For you, execution is all you need. ⏱️ Estimated TimeApprox. 4 hours, can be completed in multiple sessions 📦 Expected OutputAI-Native Snake + Custom Mini-Game1 playable AI-native Snake game + (Optional) 1 custom AI-native mini-game or Demo of your choice1. Dilemmas and Opportunities for Ordinary People Many people have a bunch of product ideas in their heads: a small tool to help manage finances, a webpage to record a child's growth, or even a mini-game. But the thought of having to write code or find a programmer often discourages them directly.After the emergence of AI, for the first time, ordinary people have a completely new possibility: you don't need to know how to write code, you just need to learn how to clearly tell AI what you want. Data from GitHub Copilot shows that over 15 million developers are using AI-assisted programming, with an average of 46% of code being AI-generated! In Java projects, this proportion can reach 61%.🚀Leaps in Efficiency and Adoption55%Speed Increase2.4 DaysTask Time (from 9.6)81%Day-1 Install Rate96%Suggestion Adoption What is truly exciting is the leap in efficiency: developers' task completion speed increased by 55%. Code that originally took 9.6 days to deliver can now be done in just 2.4 days. This visible improvement shows that AI is no longer just an "optional feature" but is becoming an indispensable assistant in the development workflow. The adoption rate data confirms this: on the day they granted access, 81% of developers installed and started using it immediately; among them, 96% started adopting the AI's code suggestions that same day. In other words, developers almost instantly integrated AI into their daily coding routines. For ordinary people, this trend is even more significant: if professional programmers are relying heavily on AI to write code, why can't those of us who don't know how to program communicate directly with AI to realize our ideas?The goal of this course is to help you practice a new skill: building apps through natural language conversations. We will teach you how to communicate with AI using computer language and how to let AI turn the ideas in your head into real, usable products.2. To What Extent Can AI Help You? In this section, we only discuss one question: if you completely don't know how to write code, to what extent can today's AI help you?Roughly speaking, you can understand current LLM capabilities as: competent in developing simple internal tools, data visualization dashboards, and some lightweight mini-games. These are generally sufficient for making tools for personal use or validating requirements from a product manager's perspective. But to generate a commercially mature product with one click, it still typically requires manual, continuous polishing of process design and details.Next, let's take Snake as an example and see exactly what AI programming can achieve.2.1 Build a Snake Game in 60 Seconds First, please open the experimental site used in the course, z.ai. z.ai is an AI platform developed by Zhipu AI (one of China's leading LLM companies), powered by their proprietary GLM models. This platform includes various features, such as slideshow generation, poster design, and full-stack development. In this tutorial, we will focus on its full-stack development module.💡 What is the "programming right on the web" paradigm?In the past, developing a web app required:Installing programming environments (Node.js, Python, etc.)Configuring code editorsLearning HTML/CSS/JavaScriptDealing with dependencies and errorsNow, with AI coding platforms, you only need to:Open your browser and visit the siteDescribe your desired features in natural languageHave AI instantly generate the code and let you preview the result liveThis "conversation as programming" paradigm changes coding from "writing instructions" to "describing requirements". You don't need to care about low-level technical details; just clearly state what you want. This is the new programming paradigm of the AI era—Vibe Coding.Input our simple requirement and click the Full-stack Development button. You can watch the webpage being built in real time. Usually, it takes just the time to brew a coffee!Help me create a Snake game: 1. Control snake movement with arrow keys 2. When it eats food, it gets longer and the score increases 3. Hitting walls or itself results in Game Over 4. Include Start and Restart buttons 5. The UI should be clean and elegantOnce generated, you will see a browsable webpage UI on the right. Scroll around or click the 🧭 button at the top to view it in full screen.The buttons at the top from left to right are: Arrow button expands chat history, Pencil button to start a new chat, Refresh icon to rebuild the page, Compass icon to toggle fullscreen, Download button to download the project, <> button to view code, and Publish button to publish it.If you'd like to check the webpage's source code, click the code icon in the top right to view the entire codebase.🌐 Explore More AI Programming ToolsBesides z.ai, we also recommend trying out these excellent AI programming platforms:ToolLinkFeaturesKimi Codekimi.com/code/consoleMoonshot AI's AI coding assistant, offering a terminal-based Kimi Code CLI and a VS Code extension, powered by the code-specialized Kimi K2.7 Code model, and compatible with Claude Code, Roo Code, and other toolsGoogle AI Studio (Recommended)aistudio.google.com/appsOfficial tool from Google, powered by Gemini, great for rapid prototypingFigma Makefigma.com/makeDeeply integrated with design tools, ideal for interactive prototypesCozecoze.comAI bot platform by ByteDance, zero-code visual buildingv0.devv0.devAI generation for React components from VercelBolt.newbolt.newAI full-stack development capable of generating deployed appsLovablelovable.devHigh-quality React app generationReplit Agentreplit.comOnline IDE integrated with AIFor more comparisons, view the appendix: Comparison of 7 AI Programming Tools2.2 What Conversational Programming Can and Cannot Do This section focuses on a specific question: When relying exclusively on conversational AI and writing no code at all, how far can you push a project? In terms of experience, a fairly consistent conclusion is: It can help you complete a "small but complete" thing, but determining "how much is enough" still requires your personal decision on every detailed step.Excels at "Small and Clear" Apps From the Snake game example, you already saw a typical pattern: As long as you can clearly describe the UI and interaction, AI can often piece together a fully functional, clickable webpage in just a few rounds of conversations.Such tasks often share a few characteristics:Clear scope: one page, a simple internal tool, a small game mechanic.Visible results: you immediately see if it works as expected.Direct debugging: you can point out errors and ask for corrections easily.Within these boundaries, you can view the AI as a highly capable "junior assistant".AI's success rate in handling small-scale tasks:Large Projects Require a "Process Perspective" Once it exceeds the small and clear scope, relying purely on conversational requests to build complex systems end-to-end will quickly hit ceilings. Large projects deal with backend databases, third-party services, authentication, permissions, edge cases, state management, etc.In these situations, the logical approach is to define a clear process flowchart and break it into segments to be handled individually.The Difference Between Generating and Validating Just because AI wrote it doesn't mean it's ready for a commercial launch! Always validate AI-generated code, especially in secure systems.⚠️ Usage GuidelinesPrototypes/Tools/Demos: Highly suitable for early stage builds iterations.Large consumer-facing products: Usually needs developers for architecture.High-security systems: Not suitable to deploy immediately. Needs stringent checks.3. Hands-on: Your First AI Native Application Let's do some hands-on work. We'll add some native AI integration elements into our game.3.1 AI-Native Snake You can simply provide these prompts:💡 Example Prompt: Build me a Snake game.💡 Example Prompt: Build me a Snake game that supports:Eating different words and placing them in a collection box.💡 Example Prompt: Build a Snake game that supports:I can eat distinct words, collected in a box.When eating 8 words, the LLM generates a poem using them.An image generation API is called right after the poem is composed.If you face any issues, just screenshot the error or tell the bot what's wrong and it will iterate the changes.3.2 Add New Features to the Game After completing the basic functionality, we can try adding some new twists to our program! If you find the process of the snake eating words or characters a bit boring, you can have the snake eat words of different colors a