From f50c04e071ededa9ddbe74e072caffd8e3d0cbec Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Thu, 15 Dec 2016 20:49:31 +0100 Subject: day15 --- day15 | 6 ++++++ day15.k | 14 ++++++++++++++ day15.rb | 15 +++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 day15 create mode 100644 day15.k create mode 100644 day15.rb diff --git a/day15 b/day15 new file mode 100644 index 0000000..396cee2 --- /dev/null +++ b/day15 @@ -0,0 +1,6 @@ +Disc #1 has 13 positions; at time=0, it is at position 10. +Disc #2 has 17 positions; at time=0, it is at position 15. +Disc #3 has 19 positions; at time=0, it is at position 17. +Disc #4 has 7 positions; at time=0, it is at position 1. +Disc #5 has 5 positions; at time=0, it is at position 0. +Disc #6 has 3 positions; at time=0, it is at position 1. diff --git a/day15.k b/day15.k new file mode 100644 index 0000000..7741439 --- /dev/null +++ b/day15.k @@ -0,0 +1,14 @@ +{n::x;p::y}.+{.:'x 3 11}'" "\'0:"day15" +{n::x;p::y}..:''(+" "\'0:"day15")@3 11 + +-1+{0<+/n!'p+x+!#p}(1+)/0 / 203660 +-1+{(0<+/x!'y+(!#y)+)(1+)/0}..:''(+" "\'0:"day15")@3 11 +{m::*/x;m!+/(x-x!'y+1+!#y)*{v*(~1=x!(v:m%x)*)(1+)/1}'x}..:''(+" "\'0:"day15")@3 11 +-1+0{(0