This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Advent of Code 2024. Day 16: Reindeer Maze. | |
// dotnet fsi aoc16.fsx | |
open System | |
open System.IO | |
open System.Collections.Generic | |
module Maze = | |
let get (a : 'a[,]) (x, y) = | |
Array2D.get a y x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Advent of Code 2024. Day 15: Warehouse Woes. | |
// dotnet fsi aoc15.fsx | |
open System | |
open System.IO | |
module Warehouse = | |
let inBounds (a : 'a[,]) (x, y) = | |
let first = y >= 0 && y < a.GetLength(0) | |
let second = x >= 0 && x < a.GetLength(1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Advent of Code 2024. Day 14: Restroom Redoubt. | |
// dotnet fsi aoc14.fsx | |
open System | |
open System.IO | |
open System.Diagnostics | |
type Pos = (int * int) | |
type Robot = { p : Pos; v : Pos } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Advent of Code 2024. Day 13: Claw Contraption. | |
// dotnet fsi aoc13.fsx | |
open System | |
open System.IO | |
type Machine = | |
{ ax : int64 | |
bx : int64 | |
ay : int64 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Advent of Code 2024. Day 12: Garden Groups. | |
// dotnet fsi aoc12.fsx | |
open System | |
open System.IO | |
module Garden = | |
let inBounds (a : 'a[,]) (x, y) = | |
let first = y >= 0 && y < a.GetLength(0) | |
let second = x >= 0 && x < a.GetLength(1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Advent of Code 2024. Day 11: Plutonian Pebbles. | |
// dotnet fsi aoc11.fsx | |
open System | |
open System.IO | |
let applyRules stone = | |
if stone = 0L then [1L] | |
else | |
let s = stone.ToString() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Advent of Code 2024. Day 10: Hoof It. | |
// dotnet fsi aoc10.fsx | |
open System | |
open System.IO | |
module Array2D = | |
let inBounds (a : 'a[,]) (x, y) = | |
let first = y >= 0 && y < a.GetLength(0) | |
let second = x >= 0 && x < a.GetLength(1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Advent of Code 2024. Day 09: Disk Fragmenter. | |
// dotnet fsi aoc09.fsx | |
open System | |
open System.IO | |
open System.Collections.Generic | |
type DiskEntry = | |
| File of (int * int) | |
| Free of int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Advent of Code 2024. Day 08: Resonant Collinearity. | |
// dotnet fsi aoc08.fsx | |
open System | |
open System.IO | |
module Array2D = | |
let inBounds (a : 'a[,]) (x, y) = | |
let first = y >= 0 && y < a.GetLength(0) | |
let second = x >= 0 && x < a.GetLength(1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Advent of Code 2024. Day 07: Bridge Repair. | |
// dotnet fsi aoc07.fsx | |
open System | |
open System.IO | |
let split (splitter : string) (input : string) = input.Split(splitter) | |
let parseLine s = | |
let parts = s |> split ": " |