SnakeGPT, a game completely written by ChatGPT4
Recently I was experimenting with the code generation capabilities of ChatGPT4 and wanted to build a snake-like game with custom logic. I prompted my requirements, and it built everything for me!
Here’s SnakeGPT (works on desktop only), a game with 100% code written by ChatGPT4 based on my prompts. I only edited the names and URLs and hosted the generated files in Firebase Hosting.
Major highlights:
- It generated all the code, even fixing some issues in its own code.
- It generated the game instructions text, based on the code it was generating.
- It even generated the README file to put in the git repo, 🤯🤯🤯 how does it do that???
Believe it or not, ChatGPT4 is jaw-droppingly smart. I can’t imagine what its next versions can do.
Will it replace the developer?
Yes and No.
ChatGPT itself is not going to replace a developer, but another developer who knows how to use ChatGPT will. ChatGPT will definitely increase a developer’s productivity manyfold. The key skill here is to know how to prompt your requirements to get the best out of ChatGPT.
In my case, even though I have been writing code for more than a decade, my experience in HTML and Javascript is pretty basic, but I was able to do several prompts, figure out the proper solution, correctly prompt for fixes and identify what to fix, and finally assemble everything together, is just because of my development experience. The productivity gain here is the time saved to build the entire thing in a short time.
Next, I tried to build the same game using the HTML Canvas. But after several prompts, I started to struggle and eventually got stuck at a point because my knowledge of Canvas APIs is really bad, and I didn’t know how to identify the problems, so I didn’t know what solutions I have to ask for. So I had to give up the Canvas-based game. You can see the half-baked result here that’s based on the Canvas APIs.
To summarize, if you know what exactly you are doing, and have the knowledge to identify the problems, then you can ask ChatGPT for solutions. Again, you need a good level of experience to ensure that the solution suggested by ChatGPT is not flawed, or how to ask for a better solution. It’s more like an assistant typing the code for you, based on your commands.
Browse the source on GitHub. Look at the full list of prompts and responses here
💡 Tip: The winning score is 10. The winning animation is also built by ChatGPT4 based on my prompt (I asked for exploding boxes).