AI Command Lab // Flight Simulator
7C: The Constant Canopy
Initial AI Output (Fragile)
// AI-Generated Code: Cryptic and Rigid
void Update() {
// Audit Fail: What do 5.0f and 0.2f represent?
// If you change the landing pad size, you have to hunt for these numbers.
if (Vector3.Distance(pos, pad) < 5.0f) {
speed *= 0.2f;
}
}
Initial AI Prompt
"You ask the AI: "Slow the drone down when it gets close to the landing pad.""
Pilot Comm Link
Mission Objective: A skilled Mechanic directs the AI to **Define the Constants**. You command: "Replace the raw numbers with constants for the LandingProximity and the BrakingForce."
Optimized Protocol
// Corrected: Readable and Centralized.
public class Drone : MonoBehaviour {
private const float LANDING_PROXIMITY = 5.0f;
private const float BRAKING_FORCE = 0.2f;
void Update() {
// Audit Pass: The logic is now human-readable.
if (Vector3.Distance(pos, pad) < LANDING_PROXIMITY) {
speed *= BRAKING_FORCE;
}
}
}