AI Command Lab // Flight Simulator
200A: The Flight State
Initial AI Output (Fragile)
// AI-Generated Code: Conflicting Logic
public bool isIdle;
public bool isPatrolling;
public bool isAttacking;
void Update() {
if (isIdle) { ... }
if (isPatrolling) { ... }
// Audit Fail: What happens if both are true?
}
Initial AI Prompt
"You ask the AI: "Create a drone that can idle, patrol, and attack.""
Pilot Comm Link
Mission Objective: A skilled Architect directs the AI to use an Enum for states. You command: "Use an Enum to define exclusive states and a switch statement to handle logic."
Optimized Protocol
// Corrected: Exclusive States
public enum DroneState { Idle, Patrol, Attack }
public DroneState currentState;
void Update() {
switch (currentState) {
case DroneState.Idle: DoIdle(); break;
case DroneState.Patrol: DoPatrol(); break;
}
}