‹ back to the board

Tuesday, November 3

Novicesyntax & basics

The Skull-Marks of the Ashveil Wastes

The Cartographers' Guild of Ashveil is sending an expedition into the Ashveil Wastes. They will pay any adventurer who can letter the labels for their new map. Every landmark on the map gets one line of text. The line gives the landmark's name, its grid position, and how many skull-marks of danger the scouts gave it.

Write markLabel(place, x, y, skulls), where:

  • place is a non-empty string: the landmark's name.
  • x and y are integers, possibly negative: the landmark's grid coordinates.
  • skulls is a non-negative integer: the danger rating.

Return a single string of the form:

<place> (<x>, <y>): <danger>

The parts are:

  • place, exactly as given.
  • One space, then an opening parenthesis.
  • x in ordinary decimal, with a leading - if it is negative.
  • A comma and one space, then y in the same form.
  • A closing parenthesis, a colon, and one space.
  • The danger text.

The danger text is:

  • safe when skulls is 0.
  • 1 skull when skulls is 1.
  • <skulls> skulls for any other value, for example 4 skulls.

There is no other text and no trailing whitespace.

  • string formatting
  • Novice

examples

  1. case 1place "Ember Well", x 3, y -2, skulls 2"Ember Well (3, -2): 2 skulls"
  2. case 2place "Glasswind Dunes", x -14, y 7, skulls 1"Glasswind Dunes (-14, 7): 1 skull"
  3. case 3place "Hollow Spire", x 0, y 0, skulls 0"Hollow Spire (0, 0): safe"
reward
110 XP
signature
markLabel
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…
  • plural skulls with negative y
  • zero skulls is safe
  • single skull is singular
  • larger coordinates
  • one-letter name, both negative, double-digit skulls
The Skull-Marks of the Ashveil Wastes · bitwick