Skip to content

Instantly share code, notes, and snippets.

View nesevis's full-sized avatar

Chris Kolbu nesevis

View GitHub Profile
@nesevis
nesevis / advent_of_code_2020_day24.swift
Last active January 21, 2021 03:57
Advent of Code 2020 Day 24
struct CubeCoordinate: Hashable {
let x: Int
let y: Int
let z: Int
func neighbors() -> [CubeCoordinate] {
Direction.allCases.map(neighbor(for:))
}
func neighbor(for direction: Direction) -> CubeCoordinate {
@nesevis
nesevis / advent_of_code_2020_day18.swift
Last active January 15, 2021 01:40
Advent of Code 2020 Day 18
indirect enum Element {
case number(Int)
case operation(Character)
case subexpression([Element])
}
func parse(_ remainder: String.SubSequence, _ accumulator: [Element] = []) -> [Element] {
guard let head = remainder.first else { return accumulator }
switch head {
case " ":
@nesevis
nesevis / ControlFreakProgramParsing.fs
Last active January 20, 2024 22:27
This represents a proof of concept for how to parse and output the binary format the Polyscience Control Freak cooker uses.
open System.IO
[<AutoOpen>]
module ControlFreak =
type Timer = {
hours: int;
minutes: int;
seconds: int
}