Tier 1 Series 4

4G: The Tower Exam

Capstone Exam
Pilot Record
Student Profile
"The AI has generated a "Traffic Controller" that is overloading the drone's CPU. Identify the three critical logic failures to clear the airspace for landing."

Target Asset for Audit

FRAGILE_CODE_DETECTED
using UnityEngine;

public class TrafficController : MonoBehaviour {
    public Transform runway;
    public bool isPilotReady;
    public float fuel;

    void Update() {
        // Audit Requirement: Lesson 4A (Nested Pyramid) & 4F (Update Bloat)
        if (isPilotReady) {
            if (fuel > 10f) {
                // Audit Requirement: Lesson 4C (Logic Redundancy)
                if (Vector3.Distance(transform.position, runway.position) < 50f) {
                    Debug.Log("Authorization Granted.");
                    
                    // Expensive distance check REPEATED
                    if (Vector3.Distance(transform.position, runway.position) < 10f) {
                        LandDrone();
                    }
                }
            }
        }
    }

    void LandDrone() { /* Landing Logic */ }
}

Supervisor's Certification

Authenticated Pilot
pilot_fc620e15e0d7a3fa
Session Secure

Failure Point #1

Flattening the Pyramid

Command the AI to use Guard Clauses to remove the nested layers of the pilot and fuel checks.

Failure Point #2

Removing Redundant Math

The AI is calculating Vector3.Distance twice. Command it to store the result in a local variable.

Failure Point #3

Update Loop Isolation

The logic is cluttering the Update loop. Command the AI to extract a 'CanLand' boolean method.