AI Command Lab // Flight Simulator
5B: The List Launchpad
Initial AI Output (Fragile)
// AI-Generated Code: Dangerously Rigid
public string[] completedObjectives = new string[5];
void FinishTask(string name) {
// Audit Fail: If the player finishes 6 tasks,
// the system will throw an 'IndexOutOfRangeException' and crash!
completedObjectives[currentIndex] = name;
currentIndex++;
}
Initial AI Prompt
"You ask the AI: "Keep track of every objective the player completes.""
Pilot Comm Link
Mission Objective: Use a Compute Shader for massive parallel vertex manipulation.
Optimized Protocol
// Corrected: Flexible and safe.
private List<string> completedObjectives = new List<string>();
void FinishTask(string name) {
// The List handles the 'parking space' management automatically.
completedObjectives.Add(name);
}