‹ back to the board

Tuesday, October 20

Novicesyntax & basics

The Griffin-Nests of Halvoran Crag

High on Halvoran Crag, the griffins of the eastern peaks lay their clutches in nests of iron-bark and stolen spearshafts. The Talonward Company pays well for an accurate count of eggs, and each nest a climber reaches must be marked with a painted tag before the mother returns.

Write nestTag(name, eggs), which builds the tag for one nest.

  • name is a string: the name of the griffin that guards the nest. Use it exactly as given.
  • eggs is a non-negative integer: the number of eggs in the nest.

Return a string in exactly one of these three forms, with a single space after the colon:

  • If eggs is 0: <name>: no eggs
  • If eggs is 1: <name>: 1 egg
  • Otherwise: <name>: <eggs> eggs, with the number written in ordinary digits.

Only the exact value 1 uses the singular word egg. Every other count above zero uses eggs.

  • string formatting
  • Novice

examples

  1. case 1name of "Skarra", eggs of 3"Skarra: 3 eggs"
  2. case 2name of "Vell", eggs of 1"Vell: 1 egg"
  3. case 3name of "Ommeth", eggs of 0"Ommeth: no eggs"
  4. case 4name of "Brisk", eggs of 11"Brisk: 11 eggs"
reward
130 XP
signature
nestTag
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…
  • several eggs
  • exactly one egg is singular
  • empty nest says no eggs
  • eleven is plural
  • twenty-one is plural
  • name kept exactly as given
  • large clutch
The Griffin-Nests of Halvoran Crag · bitwick