Grilled Cheese

ExploreLog inSign up
Terms of UsePrivacy PolicyCommunity StandardsHelpGet the app

Grilled Cheese is a product of Village Compute

Version devBuilt at: 2026-12-03 22:42:33 EST

PhotosVideosAllPeople
LatestRanked
Load more
@sadsadsadpandaface.bsky.socialDec 5, 2026, 2:22 PM

I just completed "Rhythmic Factory" - Day 5 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/5

wasn't too bad

adventofcode.comDay 5 - Advent of Code 2026
@danarama.bsky.socialDec 5, 2026, 2:10 PM

lol, today's #AdventOfCode example had a sequence of numbers so I was curious if it was a known/famous sequence and googled it. Google AI summary: "Oh this is the December 5th Advent of Code puzzle! Do you want to know how to solve it?"

ughhh

@aeris.fyiDec 5, 2026, 2:00 PM

I just completed "Rhythmic Factory" - Day 5 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/5

adventofcode.comDay 5 - Advent of Code 2026
@aoanla.hachyderm.io.ap.brid.gyDec 5, 2026, 1:42 PM

I just completed "Rhythmic Factory" - Day 5 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/5

Now I'm back home, done entirely in #chapel which was surprisingly smooth (given this is my second ever chapel program). Some syntax still trips me up - chapel select/switch statements […]

hachyderm.ioOriginal post on hachyderm.io
@jesseskinner.toot.cafe.ap.brid.gyDec 5, 2026, 1:35 PM

I just completed "Rhythmic Factory" - Day 5 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/5

Today was fun. I love puzzles where there are seemingly infinite possibilities, but you can find a trick to turn it into a much simpler problem.

My solution is here: github.com/jesseskinner…

adventofcode.com
@elfly.bsky.socialDec 5, 2026, 1:26 PM

I just brute forced "Rhythmic Factory" - Day 5 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/5

adventofcode.comDay 5 - Advent of Code 2026
@0xdf.bsky.socialDec 5, 2026, 1:20 PM

#AdventOfCode Day5! Today's challenge is looking for all possible values generated by the given buttons. I'll have to append, multiple, divide, replace, use octal, and backspace. In part 1 I get up to 3 button presses. In part two as many as I want up to 4 digits.

www.youtube.com/watch?v=6Sd3...

youtube.comRhythmic Factory [AOC2026 Day 5]YouTube video by 0xdf
@arnaught.bsky.socialDec 5, 2026, 1:18 PM

#AdventOfCode Day 5!

github.com/Rayquaza01/a...

github.comadvent-of-code-2026/day05 at main · Rayquaza01/advent-of-code-2026Contribute to Rayquaza01/advent-of-code-2026 development by creating an account on GitHub.
@usrbinprl.bsky.socialDec 5, 2026, 1:04 PM

Day 5 of #AdventOfCode and a simple problem with slightly difficult parsing.
Part 2 is a no brainer; just keep applying part 1 until nothing happens.

topaz.github.io/paste/#XQAAA...

topaz.github.iopaste
?Unknown authorDec 5, 2026, 12:51 PM

I just completed "Rhythmic Factory" - Day 5 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/5

adventofcode.comDay 5 - Advent of Code 2026
?Unknown authorDec 5, 2026, 12:49 PM

I just completed "Rhythmic Factory" - Day 5 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/5

adventofcode.comDay 5 - Advent of Code 2026
@seddy.comDec 5, 2026, 12:45 PM

I just completed "Rhythmic Factory" - Day 5 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/5

This one gave me a bit of trouble, but I eventually got there.

The solution is here:

github.com/ymiseddy/Adv...

adventofcode.comDay 5 - Advent of Code 2026
@bazraubach.bsky.socialDec 5, 2026, 12:42 PM

I've completed "Rhythmic Factory" - Day 5 - Advent of Code 2026 #AdventOfCode

I had a bad feeling about part 2 when I read this... Turned out to be ok, though! BFS for part 2 would probably be better, but I like DFS 😅

adventofcode.com/2026/day/5

Photo, no description
?Unknown authorDec 5, 2026, 12:40 PM

I've completed "Rhythmic Factory" - Day 5 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/5

Writeup: sheinxy.github.io/Advent-Of-Co...

Code: github.com/Sheinxy/Adve...

sheinxy.github.io
@razemix.mamutovo.cz.ap.brid.gyDec 5, 2026, 12:26 PM

Cajk, dneska jsem napsal optimální algoritmus na první dobrou, takže změna pro druhou část zabrala jen pár sekund. 😁️ #AdventOfCode

@aranaya.bsky.socialDec 5, 2026, 12:00 PM

I just completed "Rhythmic Factory" - Day 5 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/5

adventofcode.comDay 5 - Advent of Code 2026
@oinak.comDec 5, 2026, 11:49 AM

SPOILERS!!! #adventOfCode 2026 Day 5
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

# frozen_string_literal: true

# Advent of code - Day 5
class RhythmicFactory
  attr_reader :data

  def initialize(filename)
    @data = File.read(filename).strip.delete('[]').split
  end

  def part1 = combinations.to_a.map(&:to_i).sum

  def part2 = combinations_infinite.to_a.map(&:to_i).sum

  private

  def combinations
    ['0'].to_set.tap { |inputs| 3.times { inputs.merge(unfold(inputs)) } }
  end

  def unfold(inputs, limit: nil)
    inputs.flat_map { |inp| buttons.map { |but| but.push(inp, limit:) } }.to_set
  end

  def buttons = data.map { Button.new(it) }

  # part2
  def combinations_infinite
    ['0'].to_set.tap do |inputs|
      loop do
        results = unfold(inputs, limit: 4)
        break if results <= inputs # no new resuls

        inputs.merge(results)
      end
    end
  end
end

if __FILE__ == $PROGRAM_NAME
  obj = RhythmicFactory.new(ARGV[0])
  puts obj.part1
  puts obj.part2
end
  class Button
    attr_reader :operator

    def initialize(text)
      @operator =
        case text
        when /bksp/ then del
        when /oct/ then oct
        when /.->./ then swp(text)
        when /\*./ then prd(text)
        when %r{/} then div(text)
        when /\d/ then cat(text)
        else
          raise "Unrecognized #{text}"
        end
    end

    def push(input, limit: nil)
      result = operator.call(input)
      return result unless limit
      return result if result.length <= limit

      input
    end

    private

    def del = ->(input) { input.length == 1 ? '0' : input[..-2] }
    def oct = ->(input) { input.to_i.to_s(8) }
    def prd(text) = ->(input) { (input.to_i * text[1].to_i).to_s }
    def div(text) = ->(input) { (input.to_i / text[1].to_i).to_s }
    def cat(text) = ->(input) { input == '0' ? text : input + text }

    def swp(text)
      from, to = text.split('->')
      ->(input) { input.tr(from, to) }
    end
  end