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:
placeis a non-empty string: the landmark's name.xandyare integers, possibly negative: the landmark's grid coordinates.skullsis 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.
xin ordinary decimal, with a leading-if it is negative.- A comma and one space, then
yin the same form. - A closing parenthesis, a colon, and one space.
- The danger text.
The danger text is:
safewhenskullsis 0.1 skullwhenskullsis 1.<skulls> skullsfor any other value, for example4 skulls.
There is no other text and no trailing whitespace.
examples
- case 1
place "Ember Well", x 3, y -2, skulls 2"Ember Well (3, -2): 2 skulls" - case 2
place "Glasswind Dunes", x -14, y 7, skulls 1"Glasswind Dunes (-14, 7): 1 skull" - case 3
place "Hollow Spire", x 0, y 0, skulls 0"Hollow Spire (0, 0): safe"
- reward
- 110 XP
- signature
markLabel
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