# ---------------------------------------------------------------
# PSEUDOCODE — plain-English plan, not runnable Verse yet.
# Each step below maps to a real concept we will code later.
# ---------------------------------------------------------------
# Step 1: Find the lights
# We ask the game to find all creative_prop objects whose
# gameplay tag matches "PuzzleLight".
all_lights = GetCreativeObjectsWithTag(tag{"PuzzleLight"})
# Step 2: Start checking them
# We will look at each light in our list.
for (Light : all_lights):
# Step 3: Check the state
# Is the light currently turned on?
# creative_prop exposes IsEnabled() for this purpose.
if (Light.IsEnabled[] = true):
# Step 4: Remember the result
# We add this light to our "On" list.
on_lights_list += array{Light}
# Step 5: Check the win condition
# Did we find all the lights we needed?
if (on_lights_list.Length = total_needed):
# Step 6: Win!
# Signal the door device to open.
SecretDoor.Open()
Verse Library
verse
01 Fragment
Checks if all tagged lights are enabled and triggers a door opening sequence.
verse-library/tagged-lights-1-creating-the-algorithm-in-verse/01-fragment.verse