AI Command Lab // Flight Simulator
201B: Temporal Logic
Initial AI Output (Fragile)
// AI-Generated Code: The Game Crasher
void OpenDoor() {
door.Open();
// Audit Fail: This loop blocks the Main Thread.
// The game freezes completely until the door is open.
while (!door.isOpen) {
// Do nothing
}
Move();
}
Initial AI Prompt
"You ask the AI: "Wait until the door is fully open before moving.""
Pilot Comm Link
Mission Objective: A skilled Architect directs the AI to Yield. You command: "Use a Coroutine with `yield return null` to wait effectively without freezing the game."
Optimized Protocol
// Corrected: Non-Blocking Wait
IEnumerator WaitForDoor() {
door.Open();
// The game keeps running while we check the door each frame
while (!door.isOpen) {
yield return null;
}
Move();
}