AI Command Lab // Flight Simulator
302A: The Command Link
Initial AI Output (Fragile)
// AI-Generated Code: Rigid & Brittle
void Update() {
// Audit Fail: Input is welded to the logic.
// Cannot be undone, replayed, or AI-controlled easily.
if (Input.GetKeyDown(KeyCode.Space)) {
FireWeapon();
}
}
Initial AI Prompt
"You ask the AI: "Fire the weapon when I press Space.""
Pilot Comm Link
Mission Objective: A skilled Navigator directs the AI to use Commands.
Optimized Protocol
// Corrected: Decoupled & Flexible
public interface ICommand { void Execute(); }
public class FireCommand : ICommand {
private Weapon _weapon;
public FireCommand(Weapon w) { _weapon = w; }
public void Execute() { _weapon.Fire(); }
}
// The InputHandler just calls currentCommand.Execute()