Novicesyntax & basics
The Warden Door of the Sunken Vault
Beneath the drowned hills east of Bitwick lies the Sunken Vault, sealed by a warden door that judges every adventurer who lays a hand on it. The Delvers' Guild will pay well for a charm that predicts the door's verdict before anyone risks the descent.
The door follows exactly these rules:
- A cursed adventurer is always refused, whatever else is true of them.
- An adventurer who is not cursed is admitted if they carry the vault key, or if their level is 10 or higher.
- Anyone else is refused.
Write wardenDoor(level, key, cursed), where:
levelis a non-negative integer, the adventurer's level.keyis a boolean, true if the adventurer carries the vault key.cursedis a boolean, true if the adventurer bears a curse.
Return a boolean: true if the door admits the adventurer, false if it refuses them.
examples
- case 1
level 10, no key, not cursedtrue (level 10 is enough on its own) - case 2
level 4, carries the key, not cursedtrue - case 3
level 20, carries the key, cursedfalse (the curse overrides everything) - case 4
level 9, no key, not cursedfalse
- reward
- 150 XP
- signature
wardenDoor
TypeScript, run as ES2022 — types are stripped, not checked. If a JS engine would run it, so will we.
loading the editor…
- high level, no key, not cursed
- exactly level 10 passes
- level 9 without key is refused
- low level with key passes
- curse overrides key and level
- level zero, nothing else
- cursed with key at low level
- cursed high level without key
- level zero with key passes