‹ back to the board

Wednesday, October 14

Novicesyntax & basics

The Beacon-Watch of Karrowen Tor

High on Karrowen Tor stands the last beacon of the Greyhallow chain. When raiders are sighted in the passes below, its keepers light the great brazier and keep it burning until the warband rides past. The Wardens' Guild pays the keepers by the length of each burning, and the Guild's paymaster will accept a burn-length only when it is written in one exact form.

The keepers count each burning in whole minutes. Your contract is to turn that count into the form the paymaster demands.

Write formatBurn(minutes), where minutes is a non-negative integer giving the total length of one burning in minutes. Return a string of the form H:MM, where:

  • H is the number of whole hours, written with no leading zeros and no upper limit. It may be 0, and it may be more than 24.
  • MM is the remaining minutes, from 0 to 59, always written as exactly two digits, with a leading zero when needed.
  • The two parts are joined by a single colon, with no spaces.
  • string formatting
  • Novice

examples

  1. case 1minutes of 135"2:15"
  2. case 2minutes of 5"0:05" (the minutes keep their leading zero)
  3. case 3minutes of 1500"25:00" (hours do not wrap past a day)
reward
150 XP
signature
formatBurn
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…
  • zero minutes
  • single-digit minutes padded
  • just under an hour
  • exactly one hour
  • hours and minutes
  • two-digit hours
  • last minute of a day
  • more than a day does not wrap
  • padded minutes after many hours
The Beacon-Watch of Karrowen Tor · bitwick