‹ back to the board

Wednesday, October 7

Novicesyntax & basics

The Salamander Circle of Pyrewick

The Conjurers' Lodge of Pyrewick pays well for any adventurer who can say, before the chalk is drawn, whether a fire-salamander can be called into the iron circle on the cliffs tonight. A failed summoning wastes a season's worth of brimstone, so the Lodge wants a certain answer.

A salamander can be summoned when all three of these conditions hold:

1. The brazier's heat is at least 300 degrees. 2. The night is moonless, or the summoner wears a salt-iron ring, or both. 3. It is not raining.

Write canSummon(heat, moonless, ring, rain) where:

  • heat is an integer, the brazier's heat in degrees (it may be zero).
  • moonless is a boolean, true if the night is moonless.
  • ring is a boolean, true if the summoner wears a salt-iron ring.
  • rain is a boolean, true if it is raining.

Return a boolean: true if all three conditions hold, otherwise false.

  • boolean expressions
  • Novice

examples

  1. case 1heat of 300, moonless night, no ring, no raintrue (exactly 300 degrees is hot enough)
  2. case 2heat of 450, moon is up, no ring, no rainfalse (neither a moonless night nor a ring)
  3. case 3heat of 500, moonless night, wearing a ring, rainingfalse (rain spoils any summoning)
reward
140 XP
signature
canSummon
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…
  • exactly 300 degrees is enough
  • one degree short fails
  • ring alone suffices under the moon
  • neither moonless nor ring
  • rain spoils everything
  • cold brazier and nothing else
  • all in favour
  • zero heat with everything else right
The Salamander Circle of Pyrewick · bitwick