AI Command Lab // Flight Simulator
1C: Logic Gateways
Initial AI Output (Fragile)
// Vague Prompt Result: Fails the Sanity Check
void BuyUpgrade() {
coinCount -= 50;
Debug.Log("Upgrade Purchased!");
}
Initial AI Prompt
"You give an AI a vague instruction like "Write a function to let the player buy an upgrade that costs 50 coins.""
Pilot Comm Link
Mission Objective: Ensure you cache the reference in the Awake or Start method to save performance.
Optimized Protocol
// Result of a Guided Prompt
void BuyUpgrade() {
if (coinCount >= 50) {
coinCount -= 50;
Debug.Log("Upgrade Purchased!");
} else {
Debug.Log("Not enough coins!");
}
}