Novicesyntax & basics
The Griffon-Roost of Aldermere Cliffs
High on the Aldermere Cliffs, the Roostwardens keep the griffons that carry Bitwick's couriers over the mountains. Before any rider may take a griffon aloft, the Roostwardens' charter must be checked. The Wardens are offering a standing bounty to whoever writes the check so no rider is sent up against the charter.
Write canLaunch(fed, wind, charm), where:
fedis a boolean: whether the griffon has been fed today.windis a non-negative integer: the wind speed at the cliff edge, in knots.charmis a boolean: whether the rider carries a storm-charm.
Return a boolean. Return true (True in Python) if and only if all of the following hold:
1. fed is true. 2. wind is less than 50. 3. Either wind is less than 30, or charm is true (or both).
Otherwise return false (False in Python).
examples
- case 1
fed is true, wind of 35, charm is truetrue: the wind is too strong without a charm, but the rider carries one - case 2
fed is true, wind of 30, charm is falsefalse: 30 knots is not less than 30, and there is no charm - case 3
fed is true, wind of 50, charm is truefalse: at 50 knots or more, no charm helps - case 4
fed is false, wind of 0, charm is truefalse: an unfed griffon never flies
- reward
- 150 XP
- signature
canLaunch
TypeScript, run as ES2022 — types are stripped, not checked. If a JS engine would run it, so will we.
loading the editor…
- calm day, fed, no charm
- unfed griffon grounded even with charm
- wind exactly 30 without charm
- wind exactly 30 with charm
- wind 49 with charm
- wind exactly 50 with charm
- wind 29 without charm
- dead calm, fed, no charm
- strong wind, no charm
- unfed in calm wind