‹ back to the board

Saturday, November 7

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:

  • fed is a boolean: whether the griffon has been fed today.
  • wind is a non-negative integer: the wind speed at the cliff edge, in knots.
  • charm is 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).

  • boolean expressions
  • Novice

examples

  1. case 1fed is true, wind of 35, charm is truetrue: the wind is too strong without a charm, but the rider carries one
  2. case 2fed is true, wind of 30, charm is falsefalse: 30 knots is not less than 30, and there is no charm
  3. case 3fed is true, wind of 50, charm is truefalse: at 50 knots or more, no charm helps
  4. case 4fed is false, wind of 0, charm is truefalse: an unfed griffon never flies
reward
150 XP
signature
canLaunch
not yet run

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
The Griffon-Roost of Aldermere Cliffs · bitwick