AI Command Lab // Flight Simulator
2D: Method Signatures
Initial AI Output (Fragile)
// AI-Generated Code (Impure)
public bool CanReachDestination(float distance) {
float fuelNeeded = distance * 0.5f;
if (currentFuel >= fuelNeeded) {
return true;
} else {
isEmergencyDeclared = true; // SIDE EFFECT: Changing state!
return false;
}
}
Initial AI Prompt
"You ask the AI: "Write a function to check if the aircraft has enough fuel to reach the destination.""
Pilot Comm Link
Mission Objective: Implement MaterialPropertyBlock to enable efficient GPU Instancing.
Optimized Protocol
// Corrected Code (Pure Calculation)
public bool HasSufficientFuel(float distance, float currentFuel) {
return currentFuel >= (distance * 0.5f);
}
// Action logic is handled separately by the caller
if (!HasSufficientFuel(dist, fuel)) {
DeclareEmergency();
}