Sha256: 1d2e2d0a70b881c97839da06bf17b363a6d71f48ac764120271246cd91ff3eb5
Contents?: true
Size: 556 Bytes
Versions: 3
Compression:
Stored size: 556 Bytes
Contents
# # https://adventofcode.com/2018/day/14 part 1 # # Does not use any cem functions \o/ recipes = 30121 nexta = 3 storage = [3, 7] elves = [0, 1] i = 2 while i < recipes + 10 r = storage[elves[0]] + storage[elves[1]] r.to_s.chars.each { |c| storage << c.to_i i += 1 if i == recipes + 10 break; end } elves[0] = (1 + elves[0] + storage[elves[0]]) % storage.size elves[1] = (1 + elves[1] + storage[elves[1]]) % storage.size end puts storage[-10,15].map { |i| i.to_s}.join
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cem-0.1.7 | examples/aoc2018/day14.rb |
cem-0.1.6 | examples/aoc2018/day14.rb |
cem-0.1.5 | examples/aoc2018/day14.rb |