Castle Lease Lantern
Two wizards need the same spell tower, but only one may cast there at a time. Build a timed lease, pass the lantern when time ends, and stop an old spell from sneaking through.
🧠 Before we start
Oasis One-Key Well used one key to protect shared work. But what if its owner disappears? A lease is a lock with a timer. When it expires, a new owner gets a bigger numbered token, so late work from the old owner can be rejected.
Build the lantern program
Tap the instruction blocks in order. A wizard asks first, receives one timed lantern, casts while time remains, then returns it.
Keep one wizard inside
Give Mira the lantern. When Sol asks during Mira's lease, make Sol wait. Then tap the sand beats until the lease expires.
waiting
waiting
Use the newest token
Mira's lease expired while her spell was paused. Sol now owns token 8. Decide which wizard's arriving spell the tower may accept.
Last accepted token: 6
Debug the returning wizard
Mira wakes and still holds her old lantern card. Choose the castle rule that stays safe even when an expired owner does not know that its lease ended.
returns late
owns tower
🌟 What you learned
- A lease is a lock that lasts for a limited time.
- Only one owner may use the shared resource while its lease is active.
- Waiting workers can take over after an expired owner disappears.
- Every new lease receives a larger fencing token.
- The shared resource remembers the newest token it accepted.
- Rejecting smaller old tokens stops late work from an expired owner.