‹ back to the board

Friday, October 23

Novicesyntax & basics

The Star-Wheel of Ivrenne Observatory

High on the cliffs above Bitwick stands Ivrenne Observatory, where a great brass Star-Wheel is ringed with constellation signs. The sign at the top of the wheel tells night-hunters which beast walks abroad, and the Astronomers' Guild pays well for anyone who can say, before the wheel is turned, which way the signs will lie afterwards.

The wheel is given as a list of strings, signs, read from the top of the wheel round to the bottom. A single turn moves the first sign to the end of the list, and every other sign shifts one place towards the front.

Write turnWheel(signs, turns), where turns is a non-negative integer. Return a new list containing the signs in the order they will lie after the wheel has been turned turns times.

  • turns may be 0, and it may be larger than the number of signs.
  • signs may be empty; in that case return an empty list.
  • Signs are never added, removed or changed - only their order moves.
  • slicing and indexing
  • Novice

examples

  1. case 1signs of ["Hart", "Owl", "Serpent", "Crown"], turns of 1["Owl", "Serpent", "Crown", "Hart"]
  2. case 2signs of ["Hart", "Owl", "Serpent", "Crown"], turns of 6 (one full circle of 4, then 2 more)["Serpent", "Crown", "Hart", "Owl"]
  3. case 3signs of [] (a bare wheel), turns of 5[]
reward
140 XP
signature
turnWheel
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…
  • single turn
  • zero turns
  • full circle
  • more turns than signs
  • empty wheel
  • single sign
  • five signs three turns
  • many turns two signs
The Star-Wheel of Ivrenne Observatory · bitwick