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
Photo, no description
Uncanny Mr. Incredible (disturbing)
{
  let color = String.index "roygbv"
  let steps c i = match ((color i) - (color c) + 6) mod 6 with 0 -> 6 | d -> d
}

rule move dist cur = parse
| eof | '\n' { dist }
| _ as instr { move (dist + steps cur instr) instr lexbuf }

{
  Printf.printf "%d\n" (move 0 'r' (Lexing.from_channel stdin))
}
Photo, no description
Photo, no description
Photo, no description
# Star 1
cols <- strsplit("roygbv", "")[[1]]
n <- length(cols)

# Position of each colour in the cycle
pos <- setNames(seq_len(n), cols)

# All ordered pairs
pairs <- expand.grid(a = cols, b = cols, stringsAsFactors = FALSE)
# Distance to the next waypoint, named by colour combo
distance <- with(pairs, {
  d <- (pos[b] - pos[a]) %% n
  d[d == 0] <- n
  setNames(d, paste0(a, b))
})

input <- readLines("input.txt")
waypoints <- paste0("r",input) #missed the red 1st time
waypairs <- substring(waypoints, 1:(nchar(waypoints) - 1), 2:nchar(waypoints))
sum(distance[waypairs])
#####
# Star 2
# can see bug if input doesn't have a colour, won't fix if don't have to
(nchar(gsub("[^r]", "", input))-1) * 6 + 6 + # + 6 for from r start
(nchar(gsub("[^v]", "", input))-1) * 6 + 5 + # + 5 for from r to v
(nchar(gsub("[^b]", "", input))-1) * 6 + 5 + # + 6 for from v to b
(nchar(gsub("[^g]", "", input))-1) * 6 + 5 + # etc
(nchar(gsub("[^y]", "", input))-1) * 6 + 5 +
(nchar(gsub("[^o]", "", input))-1) * 6 + 5 
# didn't have to as it accepted the answer as is
prod(as.numeric(names(sort(table(readLines("input.txt")),decreasing = TRUE)[1:3])))
prod(as.numeric(names(sort(table(readLines("input.txt")))[1:3])))
A screenshot of my times for Day 1 & 2 of Advent of Code 2026.

Day 1
Part 1: 23:15:13
Part 2: 23:16:56

Day 2
Part 1: 00:07:22
Part 2: 00:16:51
Game window showing the current progress on a project to run Advent of Code solutions in Godot. It has a stack of status text labels on a gray background.
Photo, no description
Photo, no description
Photo, no description
Advent of Code day one solution
Photo, no description
def one []: string -> int {
  lines
  | uniq --count
  | sort-by count
  | last 3
  | get value
  | into int
  | math product
}

def two []: string -> int {
  lines
  | uniq --count
  | sort-by count
  | first 3
  | get value
  | into int
  | math product
}
Photo, no description

⊜⋕⊸≠@\n &fras "day1.txt"
∩/×⊃↙₃↙₋₃ ◴⊏⍖⊸⧆
using TidierData, DataFrames

str_to_int(x::AbstractString) = parse(Int, x)
str_to_int(x::Vector{String}) = parse.(Int, x) 

df = @chain DataFrame(l = readlines("data/1.txt")) begin
    @count l
    @arrange desc(n)
    @slice(1:3, n() - 2:n())
    @mutate(part = row_number() > 3, l = str_to_int(l))
    @group_by(part)
    @summarize(ans = ~prod(l))
end
Load more