‹ back to the board

Sunday, October 25

Novicesyntax & basics

The Fog-Ferry of Marrowfen

Beyond the last waymarker of Bitwick lies Marrowfen, a black marsh crossed by a single flat-bottomed ferry. It is poled by the Fenwarden, who takes adventurers across to the drowned barrows on the far shore under fixed terms. The Bitwick board seeks someone to write those terms down, so that parties stop wading out to the landing only to be turned away.

Write canCross(party, charm, fog, iron), which decides whether a party may board the ferry tonight.

Arguments: - party: an integer, zero or more, giving the number of adventurers in the party. - charm: a boolean, true if the party carries a ward-charm. - fog: a boolean, true if fog lies on the fen tonight. - iron: a boolean, true if anyone in the party carries cold iron.

Return a boolean. It is true only if all three of these hold: 1. party is between 1 and 4, inclusive. 2. iron is false. 3. charm is true, or fog is false, or both.

If any of the three fails, return false.

  • boolean expressions
  • Novice

examples

  1. case 1party of 4, no charm, fog on the fen, no ironfalse (fog without a ward-charm)
  2. case 2party of 4, a ward-charm, fog on the fen, no irontrue
  3. case 3party of 2, no charm, clear night, but one carries cold ironfalse
  4. case 4party of 0, a ward-charm, clear night, no ironfalse (an empty party cannot board)
reward
150 XP
signature
canCross
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…
  • clear night, plain party
  • fog without charm
  • fog with charm, full raft
  • empty party
  • too many aboard
  • iron with charm
  • iron on a clear night
  • lone adventurer, clear night
  • charm on a clear night
  • everything wrong