Rules: no spoilers.

The other rules are made up as we go along.

Share code by link to a forge, home page, pastebin (Eric Wastl has one here) or code section in a comment.

  • @swlabr
    link
    English
    31 year ago

    Here’s where I landed in dart

    no comments
    d9(bool s) {
      print(getLines().fold(0, (p, e) {
        int pre(List h, bool s) {
          return h.every((e) => e == 0)
              ? 0
              : (pre(List.generate(h.length - 1, (i) => h[i + 1] - h[i]), s)) *
                      (s ? -1 : 1) +
                  (s ? h.first : h.last);
        }
    
        return p + pre(stois(e), s);
      }));
    }