AI Command Lab // Flight Simulator
102B: The Null Check Protocol
Initial AI Output (Fragile)
// AI-Generated Code: Dangerous
void AttackNearest() {
Enemy e = FindNearestEnemy();
// Audit Fail: What if there are NO enemies?
// Crash: NullReferenceException
e.TakeDamage(10);
}
Initial AI Prompt
"You ask the AI: "Find the nearest enemy and attack it.""
Pilot Comm Link
Mission Objective: A professional Pilot uses USS (Unity Style Sheets) to separate visual style from UI structure.
Optimized Protocol
// Corrected: Safe and concise
void AttackNearest() {
Enemy e = FindNearestEnemy();
// "If e is NOT null, take damage. Otherwise, do nothing."
e?.TakeDamage(10);
}