Boss: Spot the disaster
Quick check
Which sentence describes vibe coding honestly?
- Great for trying ideas fast, but risky for a real product unless someone organises and checks the code
- It always produces clean, safe code that is ready to sell
- It only works for games, never for apps or websites
Show the answer
Great for trying ideas fast, but risky for a real product unless someone organises and checks the code
Vibe coding got Kai and Remy two fun games quickly. But code nobody has read needs structure, save points and testing before it's a real product.
Quick check
A prototype's main job is to answer the question "is this fun?"
- True
- False
Show the answer
True
A prototype is a quick test of an idea. Both our games passed the fun test, so now we turn them into solid products.
Bug hunt
1let score = 0;2function reset() {3 score = 0;4 music.restart();5}6function openShop() {7 shop.visible = true;8 reset();9}
Remy asked the AI to restart the music when the shop opens. Now the score drops to 0 every time the shop opens. Which line causes it?
- Line 1
- Line 7
- Line 8
Show the answer
Line 8
Line 8 calls reset(), which restarts the music but also sets the score to 0 on line 3. In a giant file, functions often do several jobs, so reusing one causes side effects.
Quick check
Why are AI changes to a 5,000-line file risky?
- The important lines are buried among thousands of others, so the AI can miss connections and break distant code
- AI models can only read files written in English
- Long files are automatically deleted after a month
Show the answer
The important lines are buried among thousands of others, so the AI can miss connections and break distant code
A giant file crowds the context window and hides how parts depend on each other. Small modules with one job each keep AI changes focused and safe.
Find the fix
Which one do I send to the testers? There is game_FINAL.js, game_FINAL_v3.js and game_FINAL_v3_REAL.js.
What really fixes this problem?
- Stop copying files and use Git, so there is one project with a history of commits
- Rename the newest copy to game_FINAL_FINAL.js
- Send all three copies and let the testers choose
Show the answer
Stop copying files and use Git, so there is one project with a history of commits
Copies with made-up names always end in confusion. Git keeps one project and a history of commits, each with a message, an author and a time.
Quick check
What is a commit?
- A snapshot of the project, with a message, an author, a time and the exact lines that changed
- The editor's undo button
- A copy of the game emailed to a friend
Show the answer
A snapshot of the project, with a message, an author, a time and the exact lines that changed
A commit is a save point you can always go back to. Unlike undo, it survives closing the editor and can be shared through GitHub.
Quick check
A player reached wave 30 on a laptop, then opens Garden Defense in a browser on a phone. What do they see?
- Wave 1, because local storage stays on the laptop
- Wave 30, because saves follow the player
- Wave 15, because progress is split between devices
Show the answer
Wave 1, because local storage stays on the laptop
Local storage belongs to one browser on one device. Stage 4 moves saves to the cloud with Firebase so progress follows the player.
Spot the cheat
1. @zapzap 99,999,999 (played 2 minutes) 2. @novaqueen 48,210 3. @starhopper 31,900
What is the right fix for scores like the one at the top?
- Save scores on a server that checks them, because the player's device can't be trusted
- Ask players nicely not to cheat
- Store the score under a secret name in local storage
Show the answer
Save scores on a server that checks them, because the player's device can't be trusted
Never trust the client. Anything on the player's device can be edited, even under a secret name, so important data must be checked on a server the studio controls.