Compare commits
43 Commits
951cf5f12c
...
main
Author | SHA1 | Date | |
---|---|---|---|
fe8e901212
|
|||
4a62be948b
|
|||
ac6082f993
|
|||
632868f7f3
|
|||
7326d17948
|
|||
a786262683
|
|||
e70e71b068
|
|||
c7e8bf103e
|
|||
2239760ce2
|
|||
07ac0b2fc5
|
|||
f6fa8e6b6a
|
|||
5780588903
|
|||
40053ef992
|
|||
dac98f99b5
|
|||
ae1b714614
|
|||
365e67056b
|
|||
aeb51d7c68
|
|||
c4db5fad8d
|
|||
7f201a614b
|
|||
5052110cb1
|
|||
6ffaa01033
|
|||
1104d568d0
|
|||
ab1d21241b
|
|||
ec5a7feb3f
|
|||
984ae73600
|
|||
d751bc64f8
|
|||
b2afe310b4
|
|||
cba675a2b2
|
|||
93f1c73fbf
|
|||
3dd2188f11
|
|||
1ff50f072e
|
|||
c6e3288cb8
|
|||
433d8b4e15
|
|||
5d5300a48e
|
|||
1449da6551
|
|||
3a6a09ee5a
|
|||
c35ad03092
|
|||
c14ff89c45
|
|||
85cfa9003d
|
|||
1e865820a0
|
|||
900ddb6bb2
|
|||
96cf4aff3b
|
|||
e24b32420d
|
16
Package.resolved
Normal file
16
Package.resolved
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"object": {
|
||||
"pins": [
|
||||
{
|
||||
"package": "swift-collections",
|
||||
"repositoryURL": "https://github.com/apple/swift-collections.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "48254824bb4248676bf7ce56014ff57b142b77eb",
|
||||
"version": "1.0.2"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": 1
|
||||
}
|
118
Package.swift
118
Package.swift
@ -6,28 +6,128 @@ import PackageDescription
|
||||
let package = Package(
|
||||
name: "aoc2021",
|
||||
platforms: [.macOS(.v12)],
|
||||
products: [
|
||||
.library(
|
||||
name: "Runner",
|
||||
targets: ["Runner"]),
|
||||
.executable(name: "01", targets: ["01"]),
|
||||
.executable(name: "02", targets: ["02"]),
|
||||
.executable(name: "03", targets: ["03"]),
|
||||
.executable(name: "04", targets: ["04"]),
|
||||
.executable(name: "05", targets: ["05"]),
|
||||
.executable(name: "06", targets: ["06"]),
|
||||
.executable(name: "07", targets: ["07"]),
|
||||
.executable(name: "08", targets: ["08"]),
|
||||
.executable(name: "09", targets: ["09"]),
|
||||
.executable(name: "10", targets: ["10"]),
|
||||
.executable(name: "11", targets: ["11"]),
|
||||
.executable(name: "12", targets: ["12"]),
|
||||
.executable(name: "13", targets: ["13"]),
|
||||
.executable(name: "14", targets: ["14"]),
|
||||
.executable(name: "15", targets: ["15"]),
|
||||
.executable(name: "16", targets: ["16"]),
|
||||
.executable(name: "17", targets: ["17"])
|
||||
],
|
||||
dependencies: [
|
||||
// Dependencies declare other packages that this package depends on.
|
||||
// .package(url: /* package url */, from: "1.0.0"),
|
||||
/*.package(
|
||||
.package(
|
||||
url: "https://github.com/apple/swift-collections.git",
|
||||
.upToNextMajor(from: "1.0.0")
|
||||
)*/
|
||||
)
|
||||
],
|
||||
targets: [
|
||||
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
||||
// Targets can depend on other targets in this package, and on products in packages this package depends on.
|
||||
.target(
|
||||
name: "Runner",
|
||||
path: "Sources/Runner",
|
||||
resources: [.process("Resources")]
|
||||
),
|
||||
.executableTarget(
|
||||
name: "aoc2021",
|
||||
name: "01",
|
||||
dependencies: [.targetItem(name: "Runner", condition: nil)]
|
||||
),
|
||||
.executableTarget(
|
||||
name: "02",
|
||||
dependencies: [.targetItem(name: "Runner", condition: nil)]
|
||||
),
|
||||
.executableTarget(
|
||||
name: "03",
|
||||
dependencies: [.targetItem(name: "Runner", condition: nil)]
|
||||
),
|
||||
.executableTarget(
|
||||
name: "04",
|
||||
dependencies: [
|
||||
//.product(name: "Collections", package: "swift-collections")
|
||||
.targetItem(name: "Runner", condition: nil)
|
||||
],
|
||||
resources: [
|
||||
.process("Resources"),
|
||||
resources: []
|
||||
),
|
||||
.executableTarget(
|
||||
name: "05",
|
||||
dependencies: [
|
||||
.targetItem(name: "Runner", condition: nil)
|
||||
],
|
||||
resources: []
|
||||
),
|
||||
.executableTarget(
|
||||
name: "06",
|
||||
dependencies: [.targetItem(name: "Runner", condition: nil)]
|
||||
),
|
||||
.executableTarget(
|
||||
name: "07",
|
||||
dependencies: [.targetItem(name: "Runner", condition: nil)]
|
||||
),
|
||||
.executableTarget(
|
||||
name: "08",
|
||||
dependencies: [
|
||||
.product(name: "Collections", package: "swift-collections"),
|
||||
.targetItem(name: "Runner", condition: nil)
|
||||
]
|
||||
),
|
||||
.testTarget(
|
||||
name: "aoc2021Tests",
|
||||
dependencies: ["aoc2021"]),
|
||||
.executableTarget(
|
||||
name: "09",
|
||||
dependencies: [.targetItem(name: "Runner", condition: nil)]
|
||||
),
|
||||
.executableTarget(
|
||||
name: "10",
|
||||
dependencies: [
|
||||
.targetItem(name: "Runner", condition: nil),
|
||||
.product(name: "Collections", package: "swift-collections"),
|
||||
]
|
||||
),
|
||||
.executableTarget(
|
||||
name: "11",
|
||||
dependencies: [ .targetItem(name: "Runner", condition: nil) ]
|
||||
),
|
||||
.executableTarget(
|
||||
name: "12",
|
||||
dependencies: [
|
||||
.targetItem(name: "Runner", condition: nil),
|
||||
.product(name: "Collections", package: "swift-collections")
|
||||
]
|
||||
),
|
||||
.executableTarget(
|
||||
name: "13",
|
||||
dependencies: [ .targetItem(name: "Runner", condition: nil) ]
|
||||
),
|
||||
.executableTarget(
|
||||
name: "14",
|
||||
dependencies: [ .targetItem(name: "Runner", condition: nil) ]
|
||||
),
|
||||
.executableTarget(
|
||||
name: "15",
|
||||
dependencies: [ .targetItem(name: "Runner", condition: nil),
|
||||
.product(name: "Collections", package: "swift-collections")]
|
||||
),
|
||||
.executableTarget(
|
||||
name: "16",
|
||||
dependencies: [ .targetItem(name: "Runner", condition: nil) ]
|
||||
),
|
||||
.executableTarget(
|
||||
name: "17",
|
||||
dependencies: [ .targetItem(name: "Runner", condition: nil),
|
||||
.product(name: "Collections", package: "swift-collections")]
|
||||
)
|
||||
]
|
||||
)
|
||||
|
@ -6,8 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
struct Day01 {
|
||||
struct Day01: Runnable {
|
||||
let inputPath: String
|
||||
|
||||
|
11
Sources/01/main.swift
Normal file
11
Sources/01/main.swift
Normal file
@ -0,0 +1,11 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 05.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
Runner(target: Day01.self, day: "01").run()
|
@ -6,6 +6,7 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
enum Direction: String {
|
||||
case forward
|
||||
@ -39,7 +40,7 @@ struct MoveCommand {
|
||||
}
|
||||
}
|
||||
|
||||
struct Day02 {
|
||||
struct Day02: Runnable {
|
||||
let inputPath: String
|
||||
|
||||
|
11
Sources/02/main.swift
Normal file
11
Sources/02/main.swift
Normal file
@ -0,0 +1,11 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 05.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
Runner(target: Day02.self, day: "02").run()
|
@ -6,8 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
struct Day03 {
|
||||
struct Day03: Runnable {
|
||||
let inputPath: String
|
||||
|
||||
func run() {
|
11
Sources/03/main.swift
Normal file
11
Sources/03/main.swift
Normal file
@ -0,0 +1,11 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 05.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
Runner(target: Day03.self, day: "03").run()
|
@ -6,6 +6,7 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
struct Board {
|
||||
var numbers: [[Int?]]
|
||||
@ -48,7 +49,7 @@ struct Board {
|
||||
}
|
||||
}
|
||||
|
||||
struct Day04 {
|
||||
struct Day04: Runnable {
|
||||
let inputPath: String
|
||||
|
||||
func run() {
|
11
Sources/04/main.swift
Normal file
11
Sources/04/main.swift
Normal file
@ -0,0 +1,11 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 05.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
Runner(target: Day04.self, day: "04").run()
|
@ -6,6 +6,7 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
struct Line: CustomStringConvertible {
|
||||
let from: Point
|
||||
@ -79,7 +80,7 @@ struct Field: CustomStringConvertible {
|
||||
}
|
||||
}
|
||||
|
||||
struct Day05 {
|
||||
struct Day05: Runnable {
|
||||
let inputPath: String
|
||||
|
||||
func run() {
|
11
Sources/05/main.swift
Normal file
11
Sources/05/main.swift
Normal file
@ -0,0 +1,11 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 05.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
Runner(target: Day05.self, day: "05").run()
|
40
Sources/06/06.swift
Normal file
40
Sources/06/06.swift
Normal file
@ -0,0 +1,40 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 05.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
struct Day06: Runnable {
|
||||
let inputPath: String
|
||||
|
||||
func run() {
|
||||
let input = try! String(contentsOfFile: inputPath)
|
||||
let internalCounters = input
|
||||
.trimmingCharacters(in: .newlines)
|
||||
.components(separatedBy: ",")
|
||||
.map { Int($0)! }
|
||||
run(fish: internalCounters, numDays: 80)
|
||||
run(fish: internalCounters, numDays: 256)
|
||||
}
|
||||
|
||||
func run(fish: [Int], numDays: Int) {
|
||||
var fishCount = Dictionary(grouping: fish, by: { $0 }).mapValues { $0.count }
|
||||
|
||||
for _ in 1...numDays {
|
||||
var tmpFishCount = fishCount
|
||||
.filter { $0.key >= 0 }
|
||||
.reduce(into: [:]) { $0[$1.key-1, default: 0] = $1.value }
|
||||
let countPregnant = tmpFishCount[-1] ?? 0
|
||||
tmpFishCount[8] = countPregnant
|
||||
tmpFishCount[6] = (tmpFishCount[6] ?? 0) + countPregnant
|
||||
tmpFishCount[-1] = 0
|
||||
|
||||
fishCount = tmpFishCount
|
||||
}
|
||||
print(fishCount.values.reduce(0, +))
|
||||
}
|
||||
}
|
11
Sources/06/main.swift
Normal file
11
Sources/06/main.swift
Normal file
@ -0,0 +1,11 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 05.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
Runner(target: Day06.self, day: "06").run()
|
48
Sources/07/07.swift
Normal file
48
Sources/07/07.swift
Normal file
@ -0,0 +1,48 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 05.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
struct Day07: Runnable {
|
||||
let inputPath: String
|
||||
|
||||
func run() {
|
||||
let input = try! String(contentsOfFile: inputPath)
|
||||
let horizontalPositions = input
|
||||
.trimmingCharacters(in: .newlines)
|
||||
.components(separatedBy: ",")
|
||||
.map { Int($0)! }
|
||||
runA(horizontalPositions: horizontalPositions)
|
||||
runB(horizontalPositions: horizontalPositions)
|
||||
}
|
||||
|
||||
func runA(horizontalPositions: [Int]) {
|
||||
let median = horizontalPositions.sorted()[horizontalPositions.count / 2]
|
||||
let distancesToMedian = horizontalPositions.map { abs(median - $0) }
|
||||
let toalFuel = distancesToMedian.reduce(0,+)
|
||||
print(toalFuel)
|
||||
}
|
||||
|
||||
func runB(horizontalPositions: [Int]) {
|
||||
let average = Double(horizontalPositions.reduce(0, +)) / Double(horizontalPositions.count)
|
||||
let roundedDown = Int(average.rounded(.up))
|
||||
let roundedUp = Int(average.rounded(.down))
|
||||
let fuelForRoundedDown = fuelConsumptionFor(horizontalPositions: horizontalPositions, toPosition: roundedDown)
|
||||
let fuelForRoundedUp = fuelConsumptionFor(horizontalPositions: horizontalPositions, toPosition: roundedUp)
|
||||
print(min(fuelForRoundedDown, fuelForRoundedUp))
|
||||
}
|
||||
|
||||
func fuelConsumptionFor(horizontalPositions: [Int], toPosition targetPos: Int) -> Int {
|
||||
horizontalPositions.map { fuelConsumptionFor(numSteps: abs(targetPos - $0)) }.reduce(0,+)
|
||||
}
|
||||
|
||||
func fuelConsumptionFor(numSteps: Int) -> Int {
|
||||
let dv = Double(numSteps)
|
||||
return Int((pow(dv, 2) + dv) / 2.0)
|
||||
}
|
||||
}
|
12
Sources/07/main.swift
Normal file
12
Sources/07/main.swift
Normal file
@ -0,0 +1,12 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 05.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
//Runner(target: Day07.self, day: "07", isTest: true).run()
|
||||
Runner(target: Day07.self, day: "07", isTest: false).run()
|
89
Sources/08/08.swift
Normal file
89
Sources/08/08.swift
Normal file
@ -0,0 +1,89 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 05.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
import Collections
|
||||
|
||||
struct Day08: Runnable {
|
||||
let inputPath: String
|
||||
|
||||
func run() {
|
||||
let input = try! String(contentsOfFile: inputPath)
|
||||
let entries = input
|
||||
.trimmingCharacters(in: .newlines)
|
||||
.components(separatedBy: .newlines)
|
||||
.map { $0.components(separatedBy: " | ") }
|
||||
let lines = entries.reduce(into: [String:String](), { $0[$1.first!] = $1[1] })
|
||||
runA(lines: lines)
|
||||
print(lines.map { runB(line: $0) }.reduce(0, +))
|
||||
}
|
||||
|
||||
func runA(lines: [String : String]) {
|
||||
let outputSignals = lines.values
|
||||
.flatMap { $0.components(separatedBy: .whitespaces) }
|
||||
let uniqueOutputSignals = outputSignals
|
||||
.filter { $0.count == 2 || $0.count == 3 || $0.count == 4 || $0.count == 7 }
|
||||
.count
|
||||
print(uniqueOutputSignals)
|
||||
}
|
||||
|
||||
func runB(line: Dictionary<String,String>.Element) -> Int {
|
||||
let uniqueInputSignalDict = line.key
|
||||
.components(separatedBy: .whitespaces)
|
||||
.reduce(into: [Int:String](), {
|
||||
switch $1.count {
|
||||
case 2:
|
||||
$0[1] = $1
|
||||
case 3:
|
||||
$0[7] = $1
|
||||
case 4:
|
||||
$0[4] = $1
|
||||
case 7:
|
||||
$0[8] = $1
|
||||
default:
|
||||
break
|
||||
}
|
||||
})
|
||||
let outputSignals = line.value.components(separatedBy: .whitespaces)
|
||||
let len = Double(outputSignals.count - 1)
|
||||
return outputSignals.enumerated()
|
||||
.map { Int(pow(10.0, len - Double($0.offset))) * guessDigit(inputSignals: uniqueInputSignalDict, outputSignal: $0.element)! }
|
||||
.reduce(0, +)
|
||||
|
||||
}
|
||||
|
||||
func guessDigit(inputSignals: [Int:String], outputSignal: String) -> Int? {
|
||||
switch outputSignal.count {
|
||||
case 2:
|
||||
return 1
|
||||
case 3:
|
||||
return 7
|
||||
case 4:
|
||||
return 4
|
||||
case 5:
|
||||
if inputSignals[1]!.allSatisfy({ outputSignal.contains($0) }) {
|
||||
return 3
|
||||
}
|
||||
let isTwo = inputSignals[8]!
|
||||
.filter { !inputSignals[4]!.contains($0) }
|
||||
.allSatisfy { outputSignal.contains($0) }
|
||||
return isTwo ? 2 : 5
|
||||
case 6:
|
||||
if inputSignals[4]!.allSatisfy({ outputSignal.contains($0) }) {
|
||||
return 9
|
||||
}
|
||||
let isZero = inputSignals[7]!.allSatisfy { outputSignal.contains($0) }
|
||||
return isZero ? 0 : 6
|
||||
case 7:
|
||||
return 8
|
||||
default:
|
||||
print("Invalid output signal: \(outputSignal)")
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
12
Sources/08/main.swift
Normal file
12
Sources/08/main.swift
Normal file
@ -0,0 +1,12 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 05.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
//Runner(target: Day08.self, day: "08", isTest: true).run()
|
||||
Runner(target: Day08.self, day: "08", isTest: false).run()
|
139
Sources/09/09.swift
Normal file
139
Sources/09/09.swift
Normal file
@ -0,0 +1,139 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 05.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
struct Coord: Hashable {
|
||||
let row: Int
|
||||
let col: Int
|
||||
|
||||
func getLeft() -> Coord? {
|
||||
guard col > 0 else {
|
||||
return nil
|
||||
}
|
||||
return Coord(row: row, col: col - 1)
|
||||
}
|
||||
|
||||
func getRight() -> Coord { Coord(row: row, col: col + 1) }
|
||||
|
||||
func getAbove() -> Coord? {
|
||||
guard row > 0 else {
|
||||
return nil
|
||||
}
|
||||
return Coord(row: row - 1, col: col)
|
||||
}
|
||||
|
||||
func getBelow() -> Coord { Coord(row: row + 1, col: col) }
|
||||
}
|
||||
|
||||
struct Field:Sequence, IteratorProtocol {
|
||||
typealias Element = Coord
|
||||
let numbers: [[Int]]
|
||||
let numCols: Int
|
||||
let numRows: Int
|
||||
|
||||
var neighbors = [Coord:[Coord]]()
|
||||
|
||||
var current: Coord? = Coord(row: 0, col: 0)
|
||||
|
||||
init(numbers: [[Int]]) {
|
||||
self.numbers = numbers
|
||||
numCols = numbers.first?.count ?? 0
|
||||
numRows = numbers.count
|
||||
}
|
||||
|
||||
mutating func getNeighborsCoordsFor(coord: Coord) -> [Coord] {
|
||||
let n = neighbors[coord] ?? [coord.getAbove(), coord.getRight(), coord.getBelow(), coord.getLeft()]
|
||||
.compactMap { $0 }
|
||||
.filter { $0.row < numRows && $0.col < numCols }
|
||||
neighbors[coord] = n
|
||||
return n
|
||||
}
|
||||
|
||||
mutating func isLowPointAt(coord: Coord) -> Bool {
|
||||
let value = self[coord]
|
||||
return getNeighborsCoordsFor(coord: coord)
|
||||
.map { numbers[$0.row][$0.col] }
|
||||
.allSatisfy { $0 > value }
|
||||
}
|
||||
|
||||
private func getNextCoord() -> Coord? {
|
||||
guard let current = current else {
|
||||
return nil
|
||||
}
|
||||
if current.col == numCols - 1 && current.row == numRows - 1 {
|
||||
return nil
|
||||
}
|
||||
if current.col == numCols - 1 {
|
||||
return Coord(row: current.row + 1, col: 0)
|
||||
}
|
||||
return Coord(row: current.row, col: current.col + 1)
|
||||
}
|
||||
|
||||
mutating func next() -> Coord? {
|
||||
defer {
|
||||
current = getNextCoord()
|
||||
}
|
||||
return current
|
||||
}
|
||||
|
||||
subscript(index: Coord) -> Int {
|
||||
get {
|
||||
numbers[index.row][index.col]
|
||||
}/*
|
||||
set(newValue) {
|
||||
// Perform a suitable setting action here.
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
class Day09: Runnable {
|
||||
let inputPath: String
|
||||
var lowestNeighbors = [Coord: Coord]()
|
||||
var lowPoints = Set<Coord>()
|
||||
var field = Field(numbers: [[Int]]())
|
||||
|
||||
required init(inputPath: String) {
|
||||
self.inputPath = inputPath
|
||||
}
|
||||
|
||||
public func run() {
|
||||
let input = try! String(contentsOfFile: inputPath)
|
||||
let entries = input
|
||||
.trimmingCharacters(in: .newlines)
|
||||
.components(separatedBy: .newlines)
|
||||
.map { line in line.map { $0.wholeNumberValue! } }
|
||||
field = Field(numbers: entries)
|
||||
lowPoints = Set(field.filter { field.isLowPointAt(coord: $0) })
|
||||
|
||||
//Part 1
|
||||
let sum = lowPoints.map { field[$0] }.reduce(0, +) + lowPoints.count
|
||||
print(sum)
|
||||
|
||||
// Part 2:
|
||||
var basinSize = [Coord: Int]()
|
||||
for coord in field {
|
||||
guard field[coord] != 9 else {
|
||||
continue
|
||||
}
|
||||
let bl = basinLocation(for: coord)
|
||||
basinSize[bl, default: 0] += 1
|
||||
}
|
||||
let result = basinSize.values.sorted(by: >)[0..<3].reduce(1, *)
|
||||
print(result)
|
||||
}
|
||||
|
||||
private func basinLocation(for coord: Coord) -> Coord {
|
||||
guard !lowPoints.contains(coord) else {
|
||||
return coord
|
||||
}
|
||||
let closestNeighbor = lowestNeighbors[coord] ?? field.getNeighborsCoordsFor(coord: coord).min(by: { field[$0] < field[$1] })!
|
||||
lowestNeighbors[coord] = closestNeighbor
|
||||
return basinLocation(for: closestNeighbor)
|
||||
}
|
||||
}
|
12
Sources/09/main.swift
Normal file
12
Sources/09/main.swift
Normal file
@ -0,0 +1,12 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 05.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
//Runner(target: Day09.self, day: "09", isTest: true).run()
|
||||
Runner(target: Day09.self, day: "09", isTest: false).run()
|
106
Sources/10/10.swift
Normal file
106
Sources/10/10.swift
Normal file
@ -0,0 +1,106 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 05.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
import Collections
|
||||
|
||||
|
||||
struct Day10: Runnable {
|
||||
let inputPath: String
|
||||
|
||||
public func run() {
|
||||
let input = try! String(contentsOfFile: inputPath)
|
||||
let lines = input
|
||||
.trimmingCharacters(in: .newlines)
|
||||
.components(separatedBy: .newlines)
|
||||
var s = Deque<String.Element>()
|
||||
var illegalCharacters = [String.Element]()
|
||||
var syntaxScore = 0
|
||||
var autocompleteScores = [Int]()
|
||||
for line in lines {
|
||||
s = Deque<String.Element>()
|
||||
var isIllegalLine = false
|
||||
for char in line {
|
||||
if char.isClosing {
|
||||
guard let popped = s.popFirst() else {
|
||||
fatalError()
|
||||
}
|
||||
guard let shouldBeClosedBy = popped.closedBy else {
|
||||
fatalError()
|
||||
}
|
||||
if shouldBeClosedBy == char {
|
||||
continue // Valid chunk
|
||||
}
|
||||
//print("Line: \(lineNumber): Expected \(shouldBeClosedBy), but found \(char) instead")
|
||||
syntaxScore += char.score!
|
||||
isIllegalLine = true
|
||||
break
|
||||
}
|
||||
s.prepend(char)
|
||||
}
|
||||
if !isIllegalLine {
|
||||
var lineScore = 0
|
||||
while let last = s.popFirst() {
|
||||
let charValue = last.closedBy!.autocompleteScore!
|
||||
lineScore = lineScore * 5 + charValue
|
||||
}
|
||||
autocompleteScores.append(lineScore)
|
||||
}
|
||||
}
|
||||
print(syntaxScore)
|
||||
print(autocompleteScores.sorted()[autocompleteScores.count / 2])
|
||||
}
|
||||
}
|
||||
|
||||
extension String.Element {
|
||||
var isClosing: Bool { self == "]" || self == ")" || self == ">" || self == "}" }
|
||||
var closedBy: String.Element? {
|
||||
switch self {
|
||||
case "[":
|
||||
return "]"
|
||||
case "(":
|
||||
return ")"
|
||||
case "{":
|
||||
return "}"
|
||||
case "<":
|
||||
return ">"
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
var score: Int? {
|
||||
switch self {
|
||||
case ")":
|
||||
return 3
|
||||
case "]":
|
||||
return 57
|
||||
case "}":
|
||||
return 1197
|
||||
case ">":
|
||||
return 25137
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
var autocompleteScore: Int? {
|
||||
switch self {
|
||||
case ")":
|
||||
return 1
|
||||
case "]":
|
||||
return 2
|
||||
case "}":
|
||||
return 3
|
||||
case ">":
|
||||
return 4
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
12
Sources/10/main.swift
Normal file
12
Sources/10/main.swift
Normal file
@ -0,0 +1,12 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 05.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
//Runner(target: Day10.self, day: "10", isTest: true).run()
|
||||
Runner(target: Day10.self, day: "10", isTest: false).run()
|
109
Sources/11/11.swift
Normal file
109
Sources/11/11.swift
Normal file
@ -0,0 +1,109 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 11.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
struct Coord: Hashable {
|
||||
let row: Int
|
||||
let col: Int
|
||||
|
||||
var left: Coord { Coord(row: row, col: col - 1) }
|
||||
var right: Coord { Coord(row: row, col: col + 1) }
|
||||
var top: Coord { Coord(row: row - 1, col: col) }
|
||||
var bottom: Coord { Coord(row: row + 1, col: col) }
|
||||
|
||||
var topLeft: Coord { Coord(row: row - 1, col: col - 1) }
|
||||
var topRight: Coord { Coord(row: row - 1, col: col + 1) }
|
||||
var bottomLeft: Coord { Coord(row: row + 1, col: col - 1) }
|
||||
var bottomRight: Coord { Coord(row: row + 1, col: col + 1) }
|
||||
|
||||
var neighbors: [Coord] {
|
||||
[topLeft, top, topRight, left, right, bottomLeft, bottom, bottomRight]
|
||||
.filter {coord in coord.col >= 0 && coord.col < 10 && coord.row >= 0 && coord.row < 10}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Day11: Runnable {
|
||||
let inputPath: String
|
||||
var octopuses = [[Int]]()
|
||||
var flashed = Set<Coord>()
|
||||
let numRows = 10
|
||||
let numCols = 10
|
||||
var numFlashes = 0
|
||||
|
||||
required init(inputPath: String) {
|
||||
self.inputPath = inputPath
|
||||
}
|
||||
|
||||
public func run() {
|
||||
let input = try! String(contentsOfFile: inputPath)
|
||||
octopuses = input
|
||||
.trimmingCharacters(in: .newlines)
|
||||
.components(separatedBy: .newlines)
|
||||
.map { Array($0) }
|
||||
.map { ar in ar.map {c in Int(c.description)!} }
|
||||
|
||||
var step = 0
|
||||
while(flashed.count < numRows * numCols) {
|
||||
flashed = Set<Coord>()
|
||||
for row in octopuses.indices {
|
||||
for col in octopuses[row].indices {
|
||||
octopuses[row][col] += 1
|
||||
}
|
||||
}
|
||||
for row in octopuses.indices {
|
||||
for col in octopuses[row].indices {
|
||||
let coord = Coord(row: row, col: col)
|
||||
checkAndFlash(at: coord)
|
||||
}
|
||||
}
|
||||
for flash in flashed {
|
||||
octopuses[flash] = 0
|
||||
}
|
||||
step += 1
|
||||
if step == 100 {
|
||||
print(numFlashes)
|
||||
}
|
||||
}
|
||||
print("All flashing at step: \(step)")
|
||||
}
|
||||
|
||||
func checkAndFlash(at coord: Coord) {
|
||||
if octopuses[coord] <= 9 || flashed.contains(coord) {
|
||||
return
|
||||
}
|
||||
flashed.insert(coord)
|
||||
numFlashes += 1
|
||||
for neighbor in coord.neighbors.filter({!flashed.contains($0)}) {
|
||||
octopuses[neighbor] += 1
|
||||
checkAndFlash(at: neighbor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Array where Element == Array<Int> {
|
||||
subscript(coord: Coord) -> Int {
|
||||
get { self[coord.row][coord.col] }
|
||||
set(newValue) {
|
||||
self[coord.row][coord.col] = newValue
|
||||
}
|
||||
}
|
||||
|
||||
func fieldDescription(flashed: Set<Coord>) -> String {
|
||||
var desc = ""
|
||||
for row in indices {
|
||||
for col in self[row].indices {
|
||||
let c = flashed.contains(Coord(row: row, col: col)) ? " X" : String(format: "%02d", self[row][col])
|
||||
desc.append("\(c),")
|
||||
}
|
||||
desc.append("\n")
|
||||
}
|
||||
return desc
|
||||
}
|
||||
}
|
12
Sources/11/main.swift
Normal file
12
Sources/11/main.swift
Normal file
@ -0,0 +1,12 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 05.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
//Runner(target: Day11.self, day: "11", isTest: true).run()
|
||||
Runner(target: Day11.self, day: "11", isTest: false).run()
|
155
Sources/12/12.swift
Normal file
155
Sources/12/12.swift
Normal file
@ -0,0 +1,155 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 12.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
import Collections
|
||||
|
||||
class Cave: Hashable, CustomStringConvertible, CustomDebugStringConvertible {
|
||||
static func == (lhs: Cave, rhs: Cave) -> Bool { lhs.name == rhs.name }
|
||||
|
||||
func hash(into hasher: inout Hasher) {
|
||||
hasher.combine(name)
|
||||
}
|
||||
|
||||
var description: String { name }
|
||||
var debugDescription: String { name }
|
||||
|
||||
let name: String
|
||||
var connectedCaves = [Cave]()
|
||||
var isBigCave: Bool
|
||||
var isEnd: Bool
|
||||
var isStart: Bool
|
||||
|
||||
required init(name: String) {
|
||||
self.name = name
|
||||
self.isBigCave = name.first!.isUppercase
|
||||
self.isEnd = name == "end"
|
||||
self.isStart = name == "start"
|
||||
}
|
||||
}
|
||||
|
||||
struct Path: Hashable, CustomStringConvertible {
|
||||
var parts: [Cave]
|
||||
var visitedSmallCaveTwice = false
|
||||
var description: String
|
||||
|
||||
func contains(cave: Cave) -> Bool { parts.contains(cave) }
|
||||
|
||||
func appending(cave: Cave) -> Path {
|
||||
var newParts = parts
|
||||
newParts.append(cave)
|
||||
return Path(
|
||||
parts: newParts,
|
||||
visitedSmallCaveTwice: visitedSmallCaveTwice || !cave.isBigCave && contains(cave: cave))
|
||||
}
|
||||
|
||||
static func == (lhs: Path, rhs: Path) -> Bool { lhs.description == rhs.description }
|
||||
|
||||
func hash(into hasher: inout Hasher) {
|
||||
hasher.combine(description)
|
||||
}
|
||||
|
||||
init(parts: [Cave], visitedSmallCaveTwice: Bool = false) {
|
||||
self.parts = parts
|
||||
self.visitedSmallCaveTwice = visitedSmallCaveTwice
|
||||
self.description = (visitedSmallCaveTwice ? "*" : "") + parts.map {$0.description}.joined(separator: "->")
|
||||
}
|
||||
}
|
||||
|
||||
class Day12: Runnable {
|
||||
let inputPath: String
|
||||
var caves = [String:Cave]()
|
||||
|
||||
required init(inputPath: String) {
|
||||
self.inputPath = inputPath
|
||||
}
|
||||
|
||||
public func run() {
|
||||
let input = try! String(contentsOfFile: inputPath)
|
||||
caves = input
|
||||
.trimmingCharacters(in: .newlines)
|
||||
.components(separatedBy: .newlines)
|
||||
.reduce(into: [String:Cave](), { caves, line in
|
||||
let caveConnection = line.components(separatedBy: "-")
|
||||
let caveFromName = caveConnection.first!
|
||||
let caveToName = caveConnection.last!
|
||||
let from = caves[caveFromName] ?? Cave(name: caveFromName)
|
||||
let to = caves[caveToName] ?? Cave(name: caveToName)
|
||||
from.connectedCaves.append(to)
|
||||
to.connectedCaves.append(from)
|
||||
caves[caveFromName] = from
|
||||
caves[caveToName] = to
|
||||
|
||||
})
|
||||
runA()
|
||||
runB()
|
||||
|
||||
}
|
||||
|
||||
func runA() {
|
||||
var queue = Deque<Path>(minimumCapacity: 10000)
|
||||
var visited = Set<Path>(minimumCapacity: 10000)
|
||||
var numFinished = 0
|
||||
|
||||
var cave: Path? = Path(parts: [caves["start"]!])
|
||||
queue.append(cave!)
|
||||
|
||||
while !queue.isEmpty {
|
||||
cave = queue.popFirst()
|
||||
if visited.contains(cave!) {
|
||||
continue
|
||||
}
|
||||
visited.insert(cave!)
|
||||
|
||||
cave!.parts.last!.connectedCaves
|
||||
.filter { $0.isBigCave || !cave!.contains(cave: $0) }
|
||||
.forEach {
|
||||
if $0.isEnd {
|
||||
numFinished += 1
|
||||
//print("Finished: \(cave!.parts)->end")
|
||||
return
|
||||
}
|
||||
var newParts = cave!.parts
|
||||
newParts.append($0)
|
||||
queue.append(Path(parts: newParts))
|
||||
}
|
||||
}
|
||||
print(numFinished)
|
||||
}
|
||||
|
||||
func runB() {
|
||||
var queue = Deque<Path>(minimumCapacity: 1000000)
|
||||
var visited = Set<Path>(minimumCapacity: 1000000)
|
||||
var numFinished = 0
|
||||
|
||||
var cave: Path? = Path(parts: [caves["start"]!])
|
||||
queue.append(cave!)
|
||||
|
||||
while !queue.isEmpty {
|
||||
cave = queue.popFirst()
|
||||
if visited.contains(cave!) {
|
||||
continue
|
||||
}
|
||||
visited.insert(cave!)
|
||||
cave!.parts.last!.connectedCaves
|
||||
.forEach {
|
||||
if $0.isStart || (cave!.visitedSmallCaveTwice && !$0.isBigCave && cave!.contains(cave: $0)) {
|
||||
return
|
||||
}
|
||||
if $0.isEnd {
|
||||
numFinished += 1
|
||||
return
|
||||
}
|
||||
var newParts = cave!.parts
|
||||
newParts.append($0)
|
||||
queue.append(cave!.appending(cave: $0))
|
||||
}
|
||||
}
|
||||
print(numFinished)
|
||||
}
|
||||
}
|
12
Sources/12/main.swift
Normal file
12
Sources/12/main.swift
Normal file
@ -0,0 +1,12 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 05.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
//Runner(target: Day12.self, day: "12", isTest: true).run()
|
||||
Runner(target: Day12.self, day: "12", isTest: false).run()
|
113
Sources/13/13.swift
Normal file
113
Sources/13/13.swift
Normal file
@ -0,0 +1,113 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 12.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
struct Coord: Hashable {
|
||||
var x: Int
|
||||
var y: Int
|
||||
|
||||
init(x: Int, y: Int) {
|
||||
self.x = x
|
||||
self.y = y
|
||||
}
|
||||
|
||||
init(line: String) {
|
||||
let parts = line.split(separator: ",").map { Int($0)! }
|
||||
x = parts.first!
|
||||
y = parts.last!
|
||||
}
|
||||
|
||||
func foldingUp(by y: Int) -> Coord {
|
||||
guard self.y > y else {
|
||||
return self
|
||||
}
|
||||
return Coord(x: x, y: y - (self.y - y))
|
||||
}
|
||||
|
||||
func foldingLeft(by x: Int) -> Coord {
|
||||
guard self.x > x else {
|
||||
return self
|
||||
}
|
||||
return Coord(x: x - (self.x - x), y: y)
|
||||
}
|
||||
|
||||
func folding(by instruction: FoldingInstruction) -> Coord {
|
||||
switch instruction {
|
||||
case .up(let y):
|
||||
return foldingUp(by: y)
|
||||
case .left(let x):
|
||||
return foldingLeft(by: x)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
enum FoldingInstruction {
|
||||
case up(y: Int)
|
||||
case left(x: Int)
|
||||
|
||||
init?(line: String) {
|
||||
let i = line.split(separator: " ").last!.split(separator: "=")
|
||||
let coord = Int(i.last!)!
|
||||
switch i.first {
|
||||
case "x":
|
||||
self = .left(x: coord)
|
||||
case "y":
|
||||
self = .up(y: coord)
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Day13: Runnable {
|
||||
let inputPath: String
|
||||
|
||||
required init(inputPath: String) {
|
||||
self.inputPath = inputPath
|
||||
}
|
||||
|
||||
public func run() {
|
||||
let input = try! String(contentsOfFile: inputPath)
|
||||
let parts = input
|
||||
.trimmingCharacters(in: .newlines)
|
||||
.components(separatedBy: "\n\n")
|
||||
var dots = parts.first!
|
||||
.components(separatedBy: .newlines)
|
||||
.map(Coord.init)
|
||||
let instructions = parts.last!
|
||||
.components(separatedBy: .newlines)
|
||||
.map { FoldingInstruction(line: $0)! }
|
||||
|
||||
var isFirst = true
|
||||
for instruction in instructions {
|
||||
dots = dots.map { $0.folding(by: instruction) }
|
||||
if isFirst {
|
||||
print(Set(dots).count)
|
||||
isFirst = false
|
||||
}
|
||||
}
|
||||
printDots(dots: dots)
|
||||
}
|
||||
|
||||
func printDots(dots:[Coord]) {
|
||||
let maxX = dots.map {$0.x}.max()!
|
||||
let maxY = dots.map {$0.y}.max()!
|
||||
let uniqueDots = Set(dots)
|
||||
var s = ""
|
||||
for y in 0...maxY {
|
||||
for x in 0...maxX {
|
||||
s += uniqueDots.contains(Coord(x: x, y: y)) ? "#" : " "
|
||||
}
|
||||
s += "\n"
|
||||
}
|
||||
print(s)
|
||||
}
|
||||
}
|
12
Sources/13/main.swift
Normal file
12
Sources/13/main.swift
Normal file
@ -0,0 +1,12 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 05.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
//Runner(target: Day13.self, day: "13", isTest: true).run()
|
||||
Runner(target: Day13.self, day: "13", isTest: false).run()
|
82
Sources/14/14.swift
Normal file
82
Sources/14/14.swift
Normal file
@ -0,0 +1,82 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 14.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
struct Pair: Hashable {
|
||||
let first: String.Element
|
||||
let second: String.Element
|
||||
|
||||
init(_ str: String) {
|
||||
first = str.first!
|
||||
second = str.last!
|
||||
}
|
||||
|
||||
init(first: String.Element, second: String.Element) {
|
||||
self.first = first
|
||||
self.second = second
|
||||
}
|
||||
}
|
||||
|
||||
class Day14: Runnable {
|
||||
let inputPath: String
|
||||
|
||||
required init(inputPath: String) {
|
||||
self.inputPath = inputPath
|
||||
}
|
||||
|
||||
public func run() {
|
||||
let input = try! String(contentsOfFile: inputPath)
|
||||
let parts = input
|
||||
.trimmingCharacters(in: .newlines)
|
||||
.components(separatedBy: "\n\n")
|
||||
let startingPolymer = parts.first!
|
||||
let replacements = parts.last!
|
||||
.components(separatedBy: .newlines)
|
||||
.map {$0.components(separatedBy: " -> ")}
|
||||
.reduce(into: [Pair:String.Element](), {
|
||||
$0[Pair($1.first!)] = $1.last!.first!
|
||||
})
|
||||
|
||||
var pairCounts = [Pair:Int]()
|
||||
var charCount = [String.Element:Int](minimumCapacity: 26)
|
||||
for i in startingPolymer.indices {
|
||||
let firstCharacter = startingPolymer[i]
|
||||
charCount[firstCharacter, default: 0] += 1
|
||||
let next = startingPolymer.index(i, offsetBy: 1)
|
||||
guard next != startingPolymer.endIndex else {
|
||||
continue
|
||||
}
|
||||
pairCounts[Pair(first: firstCharacter, second: startingPolymer[next]), default: 0] += 1
|
||||
}
|
||||
|
||||
for step in 1...40 {
|
||||
let tmpPairCounts = pairCounts
|
||||
tmpPairCounts.forEach { pairCount in
|
||||
let pair = pairCount.key
|
||||
let replacement = replacements[pair]!
|
||||
pairCounts[pair]! -= pairCount.value
|
||||
pairCounts[Pair(first: pair.first, second: replacement), default: 0] += pairCount.value
|
||||
pairCounts[Pair(first: replacement, second: pair.second), default: 0] += pairCount.value
|
||||
charCount[replacement, default: 0] += pairCount.value
|
||||
}
|
||||
if step == 10 {
|
||||
printResult(charCount: charCount)
|
||||
}
|
||||
}
|
||||
printResult(charCount: charCount)
|
||||
}
|
||||
|
||||
func printResult(charCount: [String.Element:Int]) {
|
||||
// Sort instead of min/max so we need to only go through the dict once
|
||||
let sorted = charCount.sorted(by: {$0.value > $1.value })
|
||||
let maxC = sorted.first!
|
||||
let minC = sorted.last!
|
||||
print(maxC.value - minC.value)
|
||||
}
|
||||
}
|
12
Sources/14/main.swift
Normal file
12
Sources/14/main.swift
Normal file
@ -0,0 +1,12 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 14.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
//Runner(target: Day14.self, day: "14", isTest: true).run()
|
||||
Runner(target: Day14.self, day: "14", isTest: false).run()
|
152
Sources/15/15.swift
Normal file
152
Sources/15/15.swift
Normal file
@ -0,0 +1,152 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 15s.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
import Collections
|
||||
|
||||
typealias ThreatLevel = Int
|
||||
|
||||
struct Coord: Hashable, CustomStringConvertible {
|
||||
let row: Int
|
||||
let col: Int
|
||||
|
||||
var description: String { "(\(row), \(col))" }
|
||||
|
||||
func neighbors() -> [Coord] {
|
||||
[
|
||||
Coord(row: row-1, col: col),
|
||||
Coord(row: row, col: col+1),
|
||||
Coord(row: row+1, col: col),
|
||||
Coord(row: row, col: col-1)
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
class Day15: Runnable {
|
||||
let inputPath: String
|
||||
var lastRow: Int = 0
|
||||
var lastCol: Int = 0
|
||||
var parts = [[ThreatLevel]]()
|
||||
var neighbors = [Coord: [Coord]]()
|
||||
|
||||
required init(inputPath: String) {
|
||||
self.inputPath = inputPath
|
||||
}
|
||||
|
||||
private func expandMap() {
|
||||
var tmpParts = parts
|
||||
for (rowNum, row) in tmpParts.enumerated() {
|
||||
let newRow = [Int](0...4).flatMap { cr in
|
||||
row.map { rv in cr + rv }.map { $0 > 9 ? $0 - 9 : $0 }
|
||||
}
|
||||
parts[rowNum] = newRow
|
||||
}
|
||||
|
||||
tmpParts = parts
|
||||
for num in 1...4 {
|
||||
for i in tmpParts.indices {
|
||||
let tr = tmpParts[i]
|
||||
let ntr = tr.map { $0 + num }.map { $0 > 9 ? $0 - 9 : $0 }
|
||||
parts.append(ntr)
|
||||
}
|
||||
}
|
||||
|
||||
lastRow = parts.count - 1
|
||||
lastCol = (parts.first?.count ?? 0) - 1
|
||||
}
|
||||
|
||||
public func run() {
|
||||
let input = try! String(contentsOfFile: inputPath)
|
||||
parts = input
|
||||
.trimmingCharacters(in: .newlines)
|
||||
.components(separatedBy: .newlines)
|
||||
.map { Array($0) }
|
||||
.map { ar in ar.map {c in ThreatLevel(c.description)!} }
|
||||
lastRow = parts.count - 1
|
||||
lastCol = (parts.first?.count ?? 0) - 1
|
||||
|
||||
calculateSafestPath()
|
||||
expandMap()
|
||||
neighbors = [Coord: [Coord]]()
|
||||
calculateSafestPath()
|
||||
}
|
||||
|
||||
private func calculateSafestPath() {
|
||||
// Distances to startNode
|
||||
var totalThreatLevel = [Coord: ThreatLevel]()
|
||||
|
||||
var unvisited = Set(parts.enumerated().flatMap {row in
|
||||
row.element.indices.map { col in
|
||||
Coord(row: row.offset, col: col)
|
||||
}
|
||||
})
|
||||
|
||||
/* Keep a seperate dictionary, to calculate which coordinates have a set threat level
|
||||
* a.k.a total distance to start
|
||||
* This allows to find the next coordinate to check fairly quickly, by just
|
||||
* looking at the minmum key in this.
|
||||
* I initially tried a PriorityQueue, but my implementation was pretty slow and it spent too much time sorting
|
||||
*/
|
||||
var threatLevelDistrubution = [ThreatLevel: Set<Coord>]()
|
||||
let startNode = Coord(row: 0, col: 0)
|
||||
totalThreatLevel[startNode] = 0
|
||||
threatLevelDistrubution[Int.max] = unvisited
|
||||
threatLevelDistrubution[Int.max]!.remove(startNode)
|
||||
threatLevelDistrubution[0] = Set([startNode])
|
||||
|
||||
while let threatLevel = threatLevelDistrubution.keys.min() {
|
||||
let currentNode = threatLevelDistrubution[threatLevel]!.first!
|
||||
unvisited.remove(currentNode)
|
||||
threatLevelDistrubution[threatLevel]!.remove(currentNode)
|
||||
|
||||
// Remove key from dictionary if not coords are left for a specific threat level
|
||||
if threatLevelDistrubution[threatLevel]!.isEmpty {
|
||||
threatLevelDistrubution.removeValue(forKey: threatLevel)
|
||||
}
|
||||
|
||||
if neighbors[currentNode] == nil {
|
||||
neighbors[currentNode] = currentNode
|
||||
.neighbors()
|
||||
.filter {
|
||||
$0.col >= 0 && $0.col <= lastCol && $0.row >= 0 && $0.row <= lastRow
|
||||
}
|
||||
}
|
||||
var adjacent = neighbors[currentNode]!
|
||||
neighbors[currentNode] = adjacent
|
||||
adjacent = adjacent
|
||||
.filter {
|
||||
unvisited.contains($0)
|
||||
}
|
||||
let currentThreatLevel = totalThreatLevel[currentNode, default: Int.max]
|
||||
for a in adjacent {
|
||||
let testCost = parts[a] + currentThreatLevel
|
||||
let currentCost = totalThreatLevel[a, default: Int.max]
|
||||
if currentCost > testCost {
|
||||
totalThreatLevel[a] = testCost
|
||||
threatLevelDistrubution[currentCost]!.remove(a)
|
||||
threatLevelDistrubution[testCost, default: Set<Coord>()].insert(a)
|
||||
|
||||
// Remove key from dictionary if not coords are left for a specific threat leveli
|
||||
if threatLevelDistrubution[currentCost]!.isEmpty {
|
||||
threatLevelDistrubution.removeValue(forKey: currentCost)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
print(totalThreatLevel[Coord(row: lastRow, col: lastCol)]!)
|
||||
}
|
||||
}
|
||||
|
||||
extension Array where Element == Array<Int> {
|
||||
subscript(coord: Coord) -> Int {
|
||||
get { self[coord.row][coord.col] }
|
||||
set(newValue) {
|
||||
self[coord.row][coord.col] = newValue
|
||||
}
|
||||
}
|
||||
}
|
12
Sources/15/main.swift
Normal file
12
Sources/15/main.swift
Normal file
@ -0,0 +1,12 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 15.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
//Runner(target: Day15.self, day: "15", isTest: true).run()
|
||||
Runner(target: Day15.self, day: "15", isTest: false).run()
|
191
Sources/16/16.swift
Normal file
191
Sources/16/16.swift
Normal file
@ -0,0 +1,191 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 15.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
|
||||
enum OperatorType: Int {
|
||||
case sum = 0
|
||||
case product = 1
|
||||
case minimum = 2
|
||||
case maximum = 3
|
||||
case value = 4
|
||||
case greaterThan = 5
|
||||
case lessThan = 6
|
||||
case equal = 7
|
||||
}
|
||||
|
||||
protocol Packet {
|
||||
var version: Int { get }
|
||||
|
||||
func getTotalVersion() -> Int
|
||||
func getValue() -> Int
|
||||
}
|
||||
|
||||
struct ValuePacket: Packet {
|
||||
let version: Int
|
||||
let value: Int
|
||||
|
||||
func getTotalVersion() -> Int { version }
|
||||
func getValue() -> Int { value }
|
||||
}
|
||||
|
||||
struct OperatorPacket: Packet {
|
||||
let type: OperatorType
|
||||
let version: Int
|
||||
let subPackets: [Packet]
|
||||
|
||||
func getTotalVersion() -> Int { version + subPackets.map { $0.getTotalVersion() }.reduce(0, +) }
|
||||
func getValue() -> Int {
|
||||
let spValues = subPackets.map { $0.getValue() }
|
||||
switch type {
|
||||
case .sum:
|
||||
return spValues.reduce(0, +)
|
||||
case .product:
|
||||
return spValues.reduce(1, *)
|
||||
case .minimum:
|
||||
return spValues.min()!
|
||||
case .maximum:
|
||||
return spValues.max()!
|
||||
case .greaterThan:
|
||||
return spValues.first! > spValues.last! ? 1 : 0
|
||||
case .lessThan:
|
||||
return spValues.first! < spValues.last! ? 1 : 0
|
||||
case .equal:
|
||||
return spValues.first! == spValues.last! ? 1 : 0
|
||||
case .value:
|
||||
fatalError()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Day16: Runnable {
|
||||
let inputPath: String
|
||||
|
||||
required init(inputPath: String) {
|
||||
self.inputPath = inputPath
|
||||
}
|
||||
|
||||
public func run() {
|
||||
let input = try! String(contentsOfFile: inputPath)
|
||||
let parts = input
|
||||
.trimmingCharacters(in: .newlines)
|
||||
let bytes = parts.bits().joined()
|
||||
let packets = parsePacket(bytes: bytes)
|
||||
let p: Packet = packets.0
|
||||
print(p.getTotalVersion())
|
||||
print(p.getValue())
|
||||
}
|
||||
|
||||
func parsePacket<S>(bytes: S) -> (Packet, S.SubSequence) where S:StringProtocol {
|
||||
let version = bytes[bytes.startIndex..<bytes.index(bytes.startIndex, offsetBy: 3)].binaryToDecimal()
|
||||
let typeId = bytes[bytes.index(bytes.startIndex, offsetBy: 3)..<bytes.index(bytes.startIndex, offsetBy: 6)].binaryToDecimal()
|
||||
var value: Packet
|
||||
var reminder: S.SubSequence
|
||||
switch typeId {
|
||||
case 4:
|
||||
let (v, r) = parseLiteralPacketValue(bytes: bytes)
|
||||
value = ValuePacket(version: version, value: v)
|
||||
reminder = r
|
||||
default:
|
||||
let (v, r) = parseOperatorPacker(bytes: bytes)
|
||||
value = OperatorPacket(type: OperatorType(rawValue: typeId)!, version: version, subPackets: v)
|
||||
reminder = r
|
||||
}
|
||||
return (value, reminder)
|
||||
}
|
||||
|
||||
func parseOperatorPacker<S>(bytes: S) -> ([Packet], S.SubSequence) where S:StringProtocol {
|
||||
let startNextBitsIndex = bytes.index(bytes.startIndex, offsetBy: 7)
|
||||
let lengthTypeId = bytes[bytes.index(bytes.startIndex, offsetBy: 6)..<startNextBitsIndex].description
|
||||
let isTotalLength = lengthTypeId == "0"
|
||||
|
||||
let nextBitsLength = isTotalLength ? 15 : 11
|
||||
let endNextBitsIndex = bytes.index(startNextBitsIndex, offsetBy: nextBitsLength)
|
||||
let nextBits = bytes[startNextBitsIndex..<endNextBitsIndex]
|
||||
|
||||
var number = nextBits.binaryToDecimal()
|
||||
var reminder = bytes[endNextBitsIndex...]
|
||||
var subPackets = [Packet]()
|
||||
|
||||
while number > 0 {
|
||||
let (p, rem) = parsePacket(bytes: reminder)
|
||||
number -= isTotalLength ? (reminder.count - rem.count) : 1
|
||||
subPackets.append(p)
|
||||
reminder = rem
|
||||
}
|
||||
return (subPackets, reminder)
|
||||
}
|
||||
|
||||
func parseLiteralPacketValue<S>(bytes: S) -> (Int, S.SubSequence) where S:StringProtocol {
|
||||
var index = bytes.index(bytes.startIndex, offsetBy: 6)
|
||||
var ei = index
|
||||
var bits: Substring = ""
|
||||
var reminder: S.SubSequence = ""
|
||||
while true {
|
||||
let si = bytes.index(index, offsetBy: 1)
|
||||
ei = bytes.index(si, offsetBy: 4)
|
||||
bits += bytes[si..<ei]
|
||||
if bytes[index] == "0" {
|
||||
reminder = bytes[ei...]
|
||||
break
|
||||
}
|
||||
index = bytes.index(ei, offsetBy: 0)
|
||||
}
|
||||
return (bits.binaryToDecimal(), reminder)
|
||||
}
|
||||
}
|
||||
|
||||
extension StringProtocol {
|
||||
func bits() -> [String] {
|
||||
self.map { $0.bits }
|
||||
}
|
||||
|
||||
func binaryToDecimal() -> Int { Int(self, radix: 2)! }
|
||||
}
|
||||
|
||||
extension Character {
|
||||
var bits: String {
|
||||
switch self.hexDigitValue! {
|
||||
case 0:
|
||||
return "0000"
|
||||
case 1:
|
||||
return "0001"
|
||||
case 2:
|
||||
return "0010"
|
||||
case 3:
|
||||
return "0011"
|
||||
case 4:
|
||||
return "0100"
|
||||
case 5:
|
||||
return "0101"
|
||||
case 6:
|
||||
return "0110"
|
||||
case 7:
|
||||
return "0111"
|
||||
case 8:
|
||||
return "1000"
|
||||
case 9:
|
||||
return "1001"
|
||||
case 10:
|
||||
return "1010"
|
||||
case 11:
|
||||
return "1011"
|
||||
case 12:
|
||||
return "1100"
|
||||
case 13:
|
||||
return "1101"
|
||||
case 14:
|
||||
return "1110"
|
||||
case 15:
|
||||
return "1111"
|
||||
default:
|
||||
fatalError()
|
||||
}
|
||||
}
|
||||
}
|
12
Sources/16/main.swift
Normal file
12
Sources/16/main.swift
Normal file
@ -0,0 +1,12 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 15.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
//Runner(target: Day16.self, day: "16", isTest: true).run()
|
||||
Runner(target: Day16.self, day: "16", isTest: false).run()
|
95
Sources/17/17.swift
Normal file
95
Sources/17/17.swift
Normal file
@ -0,0 +1,95 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 17.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
import Collections
|
||||
|
||||
struct Point:Hashable {
|
||||
var x: Int
|
||||
var y: Int
|
||||
}
|
||||
|
||||
struct Area {
|
||||
let topLeft: Point
|
||||
let botRight: Point
|
||||
|
||||
init(x: String, y: String) {
|
||||
let xVals = x[x.index(x.startIndex, offsetBy: 2)...].components(separatedBy: "..").map { Int($0)! }
|
||||
let yVals = y[y.index(y.startIndex, offsetBy: 2)...].components(separatedBy: "..").map { Int($0)! }
|
||||
topLeft = Point(x: xVals.first!, y: yVals.last!)
|
||||
botRight = Point(x: xVals.last!, y: yVals.first!)
|
||||
}
|
||||
|
||||
func contains(point: Point) -> Bool {
|
||||
point.x >= topLeft.x && point.x <= botRight.x && point.y <= topLeft.y && point.y >= botRight.y
|
||||
}
|
||||
|
||||
func overshot(point: Point) -> Bool {
|
||||
point.y < botRight.y || point.x > botRight.x
|
||||
}
|
||||
}
|
||||
|
||||
struct Probe {
|
||||
var position = Point(x: 0, y: 0)
|
||||
var velocity: Point
|
||||
|
||||
mutating func move() {
|
||||
position.x += velocity.x
|
||||
position.y += velocity.y
|
||||
if velocity.x < 0 {
|
||||
velocity.x += 1
|
||||
} else if velocity.x > 0 {
|
||||
velocity.x -= 1
|
||||
}
|
||||
velocity.y -= 1
|
||||
}
|
||||
}
|
||||
|
||||
class Day17: Runnable {
|
||||
let inputPath: String
|
||||
|
||||
required init(inputPath: String) {
|
||||
self.inputPath = inputPath
|
||||
}
|
||||
|
||||
public func run() {
|
||||
let input = try! String(contentsOfFile: inputPath)
|
||||
let parts = input
|
||||
.trimmingCharacters(in: .newlines)
|
||||
.components(separatedBy: ": ")
|
||||
.last!
|
||||
.components(separatedBy: ", ")
|
||||
let area = Area(x: parts.first!, y: parts.last!)
|
||||
|
||||
var maxY = Int.min
|
||||
var found = [Point]()
|
||||
found.reserveCapacity(3000)
|
||||
for x in 0...500 {
|
||||
for y in -500...500 {
|
||||
let velocity = Point(x: x, y: y)
|
||||
var probe = Probe(velocity: velocity)
|
||||
var maxYCurrent = Int.min
|
||||
repeat {
|
||||
probe.move()
|
||||
if probe.position.y > maxYCurrent {
|
||||
maxYCurrent = probe.position.y
|
||||
}
|
||||
if area.contains(point: probe.position) {
|
||||
if maxYCurrent > maxY {
|
||||
maxY = maxYCurrent
|
||||
}
|
||||
found.append(velocity)
|
||||
break
|
||||
}
|
||||
} while !area.overshot(point: probe.position)
|
||||
}
|
||||
}
|
||||
print(maxY)
|
||||
print(Set(found).count)
|
||||
}
|
||||
}
|
12
Sources/17/main.swift
Normal file
12
Sources/17/main.swift
Normal file
@ -0,0 +1,12 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 17.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Runner
|
||||
|
||||
//Runner(target: Day17.self, day: "17", isTest: true).run()
|
||||
Runner(target: Day17.self, day: "17", isTest: false).run()
|
1
Sources/Runner/Resources/input/06.txt
Normal file
1
Sources/Runner/Resources/input/06.txt
Normal file
@ -0,0 +1 @@
|
||||
1,2,1,3,2,1,1,5,1,4,1,2,1,4,3,3,5,1,1,3,5,3,4,5,5,4,3,1,1,4,3,1,5,2,5,2,4,1,1,1,1,1,1,1,4,1,4,4,4,1,4,4,1,4,2,1,1,1,1,3,5,4,3,3,5,4,1,3,1,1,2,1,1,1,4,1,2,5,2,3,1,1,1,2,1,5,1,1,1,4,4,4,1,5,1,2,3,2,2,2,1,1,4,3,1,4,4,2,1,1,5,1,1,1,3,1,2,1,1,1,1,4,5,5,2,3,4,2,1,1,1,2,1,1,5,5,3,5,4,3,1,3,1,1,5,1,1,4,2,1,3,1,1,4,3,1,5,1,1,3,4,2,2,1,1,2,1,1,2,1,3,2,3,1,4,5,1,1,4,3,3,1,1,2,2,1,5,2,1,3,4,5,4,5,5,4,3,1,5,1,1,1,4,4,3,2,5,2,1,4,3,5,1,3,5,1,3,3,1,1,1,2,5,3,1,1,3,1,1,1,2,1,5,1,5,1,3,1,1,5,4,3,3,2,2,1,1,3,4,1,1,1,1,4,1,3,1,5,1,1,3,1,1,1,1,2,2,4,4,4,1,2,5,5,2,2,4,1,1,4,2,1,1,5,1,5,3,5,4,5,3,1,1,1,2,3,1,2,1,1
|
1
Sources/Runner/Resources/input/06_test.txt
Normal file
1
Sources/Runner/Resources/input/06_test.txt
Normal file
@ -0,0 +1 @@
|
||||
3,4,3,1,2
|
1
Sources/Runner/Resources/input/07.txt
Normal file
1
Sources/Runner/Resources/input/07.txt
Normal file
@ -0,0 +1 @@
|
||||
1101,1,29,67,1102,0,1,65,1008,65,35,66,1005,66,28,1,67,65,20,4,0,1001,65,1,65,1106,0,8,99,35,67,101,99,105,32,110,39,101,115,116,32,112,97,115,32,117,110,101,32,105,110,116,99,111,100,101,32,112,114,111,103,114,97,109,10,602,216,979,1851,549,9,38,931,28,9,303,933,1262,265,81,291,1447,737,379,456,1236,604,393,438,260,242,421,549,390,372,366,717,927,94,146,603,557,676,1729,4,1027,26,671,213,286,948,142,97,1087,210,72,949,947,1251,414,968,1300,42,814,1036,610,214,1536,210,108,545,375,1248,647,233,406,1502,433,243,13,836,815,73,525,129,323,912,671,270,635,501,110,128,113,147,534,894,883,318,205,453,264,259,1039,759,439,918,1647,493,1,422,503,583,1591,254,267,1213,604,145,242,795,278,181,12,236,1122,1002,235,965,73,228,755,562,91,4,205,1669,25,297,744,36,861,19,875,878,118,147,397,171,199,1286,72,942,200,991,8,496,631,214,668,79,1582,426,240,146,1153,88,1582,204,1254,527,19,358,444,944,84,1573,466,532,118,285,293,126,43,1348,837,326,154,412,153,861,1378,138,730,484,157,42,17,43,553,468,1668,16,301,612,65,293,383,95,260,1219,13,29,322,1043,1303,43,1147,1505,816,836,43,339,825,703,371,289,290,1060,492,661,667,818,178,114,1042,244,383,127,280,500,291,141,2,806,911,252,282,38,348,155,84,138,563,11,304,1216,1312,560,266,328,1570,1330,136,292,25,414,75,1172,387,291,279,12,405,169,661,102,24,66,1149,83,161,120,310,1041,686,149,328,345,1143,190,111,155,183,1210,619,40,431,9,470,731,453,1195,415,641,393,81,234,157,42,911,1365,292,163,388,204,1160,971,13,980,535,285,1504,454,461,518,242,974,798,93,80,720,234,378,1355,351,160,228,407,494,1650,629,621,965,686,341,273,252,66,189,526,15,273,389,1033,126,89,731,1254,1109,83,1660,682,700,712,140,105,929,62,623,476,918,15,568,406,346,720,402,1421,468,702,1090,159,794,14,59,863,393,540,1367,785,824,1016,857,488,515,539,109,12,53,371,13,483,930,112,666,30,664,768,699,1247,449,6,132,61,688,356,46,42,375,1320,606,62,14,233,161,497,150,1084,517,7,128,379,412,264,826,962,101,909,9,1624,77,307,485,106,103,4,1239,173,711,1533,99,762,100,382,876,26,305,218,27,41,1126,11,477,60,1187,201,541,102,571,227,60,118,1561,269,388,233,828,382,195,186,199,1552,444,605,22,78,159,386,1076,813,160,355,860,675,1139,437,71,1605,1,450,163,125,1245,778,10,375,348,18,174,223,367,342,697,257,317,454,242,99,1243,876,719,641,1097,538,444,280,33,99,0,492,194,458,983,42,651,454,1171,621,198,1152,31,410,3,247,977,338,220,830,580,1021,1238,401,536,124,1605,1461,1785,644,837,492,473,1073,1166,78,565,1018,155,156,948,942,368,1140,893,1059,501,46,383,752,373,236,1138,1279,450,104,502,229,783,241,186,46,919,514,371,18,578,428,1205,317,945,71,741,125,1155,680,1081,436,525,1396,171,942,225,403,564,365,372,167,599,955,1442,1672,258,717,922,219,1044,216,224,417,149,510,332,236,533,28,391,39,857,842,601,1216,151,538,900,481,39,363,400,78,1006,384,957,626,1503,269,429,259,755,1140,537,45,1,243,194,815,346,376,304,1167,423,822,166,282,20,200,133,892,140,1073,639,409,1644,105,828,881,1155,41,1590,647,449,89,845,554,411,260,837,237,377,154,49,36,687,62,230,14,11,26,853,497,48,130,17,1817,131,433,106,414,1034,146,977,565,670,581,999,4,164,706,58,212,554,101,64,123,219,154,28,531,626,64,782,505,364,281,1084,1414,27,226,736,507,837,142,434,319,409,819,48,23,820,454,1080,567,783,201,53,1153,404,187,814,28,898,309,380,295,437,366,1226,861,100,550,119,8,233,1452,30,753,381,365,683,474,227,155,1795,1093,208,159,121,1547,942,194,139,325,838,901,597,805,486,1499,597,405,1042,41,222,740,478,884,165,62,547,15,20,309,454,132,5,136,972,45,65,267,463,581,244,51,981,1120,75,410,1310,991,607,1801,950,913,98,769,81,322,19,459,1210,617,48,1163,1243,332,92,1713,120,269,20,246,323,1365,80,1165,1344,236,750,269,62,375,143,163,1444,172,789,521,105,369,1,40,341,625,674,1073,1376,108,391,277,122,181,134,78,1058,103,300,30,848,708,59,93,204,263,32,951,1884,23,488,258,1156,838,72,310,29,209,908,39,119,119,352,70,139,3,884,86,57,541,1553,5,105,710,29,335,1197,1152,144,696,685,948,563
|
1
Sources/Runner/Resources/input/07_test.txt
Normal file
1
Sources/Runner/Resources/input/07_test.txt
Normal file
@ -0,0 +1 @@
|
||||
16,1,2,0,4,2,7,1,2,14
|
200
Sources/Runner/Resources/input/08.txt
Normal file
200
Sources/Runner/Resources/input/08.txt
Normal file
@ -0,0 +1,200 @@
|
||||
bgeacd dbfag bcadegf agdce dgfbce bgc bdgca aedcgf bc abec | gcdfbe cbea bc gbc
|
||||
bdeag gdbaec cd dgc abcfg ebcd dgfabe cdfeag cgadb bdagfce | becd acfgde bgcaed eadgbc
|
||||
acbfg bcf ebacg fb fcbgea cbdfge cgeabd agcfd aebf bdaefgc | fbcdeg cfb ebgca bf
|
||||
bfcde dfgb gecbdf fdc fdcega fd ebdca gfcaedb gcfbe cbagef | dbfec gbfd bcdfe dfc
|
||||
dbgeaf bad acdfbe ab agbdf bgcdf fdgae fcgbdea fgecda egab | ba dab abd gbae
|
||||
feagcb cdfagb egda bdg dg fdcagbe ebcga bedfc bgecd dbcgea | eafgbc bcdfage dg egad
|
||||
bacfedg afbgc dbcgaf afgecd acd bfagce bgda ad adfbc ecbdf | dca dca abdg dcbef
|
||||
eagfb efcdba faceg gfdce cea afbcegd ac afdegb gafcbe gbac | fegcd geafc edbcaf bcag
|
||||
cfb bgfce ebgdf fc gdfeab acdbfeg cgeab ecfd badfcg ebcfgd | ecgab eagcb efbacdg fc
|
||||
adfec ebdcgf bfced bec fagcdeb gbcd cb fbgde deagbf afecgb | bce cb fdgeb bc
|
||||
bgfaec dcfga ed acedgfb fdebgc dec fdeb gedcba gfced cebfg | cde agcbde gfaecb cde
|
||||
bgefc cfgbea dfgaecb dg dbcg dcefa dfbegc dgfce afgedb fgd | cfged gdf fbgdea gafecb
|
||||
fcbade dagbe gacb gaedfc bdaecfg bgfde dbaec baegcd ga dga | ag gad gcab ga
|
||||
cfgdeb cbfade fac badfc ca gafdce gfdebac bfadg fbdce aceb | ebdcf deagfc ac ebfcd
|
||||
debfcg fgde cfaedgb ecbag cbeadf gf gbf fdceb fcebg dfagbc | gbfec gf agbce bfcagd
|
||||
fdcebag cbeagd gafed dfbgc cgedfa beg be edgafb edbfg eabf | gbcfd acgefd cfdageb afged
|
||||
bgad efdbcg aecfdgb fgebca ga cgade acbedg adfce aeg cgdeb | gdecfb fgdceb adceg ga
|
||||
acefd efdb cgabfe be fegcbda gbacd cagefd eab acebfd acbed | be debf feacgb becad
|
||||
edbcag dgefcab ce fgdcb eafc afgceb gfbae cbe degafb bfgce | fcgbd ec dbaegc efgdba
|
||||
bfcdge gfcbda aegfcdb dg cdgbe dbfce dgb fged cdefba caebg | dbg bgd gdfe dg
|
||||
bfeadc dbfcgea bgdaf decfg efdabg cgba fbdagc ca fca gdcfa | cafdg gacb bdfeag ac
|
||||
edbcfg cdgfae gedaf egcfd beagfc fga bcfdgae cgda debfa ag | defgc efabgc fcegadb fegda
|
||||
gafcb fcgadb gdca gbadf ad fbegd befcag fda ebgdcaf fbaecd | agcbf dbafcg dgafb abgfcd
|
||||
cga gafce gecbfda dbacgf defac febcg cfbdeg afegcb bgae ga | cdbgef ebdagcf caefg geba
|
||||
gfebcda ab dfabg abcfgd gdbfc abgc becgdf bcedfa adfge fab | abf fab ba agbc
|
||||
fagce ceabfgd cdea cbfaeg dgafce egcdf bfaegd gbcdf fde ed | de aedgbf fecagd fcebga
|
||||
fcbad fe afge ebagd fde fbdegac fgbced fdgeba fabed edcgba | debga bdgae bafdc efag
|
||||
adbfg ba dbcfga abgdecf gfedb agfdc gcdeaf adfebc bda bacg | befdac ebdafc abd gdbafce
|
||||
begfd dgfbac dgbac ce bedgac dafceg dgbce ecfdgab ceg ecab | gadfcb gefdb gdeafcb fgcdab
|
||||
dcfagbe dgbefa gdbcea faebgc fade efabg dge cfdbg fbgde ed | de efbacg dfea dfea
|
||||
dcfeag bgefcad dcgfe afedb cb bfgaec dcgb bec fcdbe gbecdf | bec agfebc ecb edfba
|
||||
acdbgfe ebcag fgc feagcb bafc gfceb fc gfadce gcbead dbgef | bceagd fcab gfdceba cfebg
|
||||
bdegf abgefd fgba dgceab dabcef badfegc egb fadeb gb fdgce | gafb efdba gb dbfage
|
||||
bfdca cfgb agdfec caf bgcfda becad gbdaf fc ebgfcad bagedf | gefdab cebad cf bgfc
|
||||
dfbcge bedgaf bgefd cgebda efcb gcfad degfbca bgc fcdbg cb | ecbadg gbfdc bgdfe fcbe
|
||||
dfeagc bfacge abfc fcegb bdecg bef acfeg bf bcgaedf gedfba | bf ebf fb cfadegb
|
||||
fbgdc fcbgead egaf acebgd gacdf fad gdaec bfecad fa gcedaf | eafdgc fda degacf geadbc
|
||||
fcdea gcdbaf cgedbf bd bgde cdb acfgeb efcbg fdecb fedbacg | aebgcf febdc dcb bgdefc
|
||||
bfdeg dbcefa bdaegf cegdf agdb fdaeb bge gb beacfg edbcafg | gefdb edcfg acbgef egb
|
||||
afgedbc caebg gef fbec egcdba dfgabe gafcd bfacge agcfe ef | fge eafbdg cgbae cgaefb
|
||||
cbagfed dceba efgcb bcafde gacedb fdca caebf egfabd fa aef | adegbc cbgfade adcf deabc
|
||||
gcbd bcegad eagdb fedabc acebdgf gcbea gaebdf gacef bc bce | dbaegc cgfea bcdg ebc
|
||||
cbfdeag agfbce cagef cbdefg gb gefab gcedfa gfb fdeba abcg | bfg afegb gbf cgab
|
||||
dea fadgbec dcabe abcdeg cfbad gdec agecb gdefab fbgaec de | dbgfae cdfegab dbgcae beadcg
|
||||
gabcd aebdgc gcaefbd edac gbfad cebag efcbga dc dcegbf cdb | cbdag agebc afcebg faegcb
|
||||
gacdbe cdabefg fecgab fe gef cbdgef dcfe gdfeb cbegd dagfb | egf fe efg decgb
|
||||
cbfea bcgf adcfe ecbgad bf gfebad feb bfagce afdcgbe abgce | cadef bcfg bf dbfcage
|
||||
fabeg cfeab ebgfcad ebfgad eg edag dfbag feg defcbg fbdcga | efbga fdcegb gbafd gdbecf
|
||||
cdgfba bga geabdc dacge beadf ebgc agcfde bg gbacdef bgead | cebg fbdae gbec dagfce
|
||||
fbgdace deafcb ead caedg da decgba aefcg bedcg gdbecf badg | ebfdcg gbad ecagbd egdcb
|
||||
faebg fg gfca eafbd cgbaef baecdfg cedbgf eabcg efg dgceba | edcgfab feg gf efg
|
||||
adbec dbcaf ecga dea eabfdg cdbge bafdcge bgdcae ae fedcgb | ead cabdgfe agce egcfbd
|
||||
gdcef agfb bfgade cebdaf debcagf dbafe egbfd cdageb geb bg | egadbc gcdfe afgb egb
|
||||
gfcbe cgfabe cdagb debgcf de bdef gde dbgcefa dfecag edcgb | fcegb fdcagbe fcbge edgcbf
|
||||
gaedcf cfedba dgacb cgbeaf fbge ecafg bfdgace gfacb bfa bf | gcadb decafg adgfec baf
|
||||
eadg gfadbc eagbcd agbcd cea bdafgce cdfaeb ae gcfbe geacb | ea cdeagb debgacf egad
|
||||
afecgbd eafd adbgf egfdbc cbeag bgfead egafb fe gdacbf efg | egcab gef dbagfe abgecdf
|
||||
gafbde geab efdcab badef cfdeg gfa egcdafb fdeag ag abfcdg | fcgde ebfad bgae ebdfa
|
||||
adbef adbcfg fbgace eac ec egcb afcgb cfeab faedgc dgfebca | gbadfc eca ecgb cgbe
|
||||
fb efadcb fab gbfeca gfcab baecgd fadgc gfedabc gbef cgaeb | beagdc cabfg bacge gbfe
|
||||
dfabcg bcdg dagbf aegcbfd db fbd gcbaf gefad feabdc gcbeaf | fagdb bacfdg gabdfc dcgb
|
||||
ecagbdf dgfac cefag geacdb dcefgb df bdcgfa afbd abdcg fcd | dfc defbcg df afbd
|
||||
bfadc bcgad acegd bg ceagdfb bag cdaefb fcgb cgadfb gdebfa | cfbadge efbdcag fcdab dcbaf
|
||||
bdcefa gc cgb egdc ecdbf cfdgba agfbe dfgebc cdgaefb gbfce | cbegf begfc ebcdgf fabge
|
||||
caedgf egf dcebg cfbeg edgafbc bgdf ebdfcg eacdgb gf eafbc | bgfd efgcb fg afbcegd
|
||||
gbfae cdabfe degc edb cbdfg ed ebdgf dbfgce baecgdf agdfcb | adcefb ed de cfbgde
|
||||
fdbcge defabcg fgead befda gacedf ag gdca gea cgeafb fdegc | ga fecgd ga dfegc
|
||||
ed efcgab edacg adcgbe acgefdb deba fcbedg agfdc bgace ecd | afdcg bceag de gcdeab
|
||||
facdbe dagec bfcea bcd dfcgbe cbdae bd abdf bgcefda cbegaf | dcb aecbd befac ecfdab
|
||||
fa fea gafc gfebd dcabge dfbaegc gacfeb abgfe baefcd bcgea | befdg gecfab cafebg agceb
|
||||
cebad ebdgca bd fbedacg gaefdc gadce becaf gebd cfbagd cbd | dcgfea abcgdf cdb bd
|
||||
cfbgdae cgfdb cabgef df bdfa bgfac gcadef dfc fcgadb egbdc | df faedgc dcegb dcgbf
|
||||
cbfg gecfa adfbge gfbcdea eabfcd fg bgfeca acedg fga bafce | efbgac dcfabe cebafd decag
|
||||
gdcbef dcfage acgde fgbea gedbac bc bgace gdaefbc ecb dacb | abdc bfgea ebfgcd adcbge
|
||||
gafe cfbad aedcfbg adbgce cebgfa agcbe gf gbedcf gcabf gcf | bcega begcfa gafbc feagbcd
|
||||
cabefg ce ecfb dcebagf gface afged fbcga afcdbg eca cegdab | aec ec gafecdb bdgcaf
|
||||
bgdcae cedga bdgaecf cd afegd dbac dgc efagcb gefdcb cegba | efbgca bdecgaf caegbd dgc
|
||||
aebgd cfageb ecdagb beagc bcfdeag dfgab de ebfdcg dge adec | ed gfebca de fdcegab
|
||||
ebcdagf fcga gfbaed gf dgfaec ecfad adcbef gdcef gbdce feg | dfcae fge feg fbegcda
|
||||
fba cegadbf fa deaf deabg fedbag dgcbf agebdc gafbd bgfeac | bfa bfa fgcbead fbedgca
|
||||
cdgef dgbcaf gadcb edacgb agfdc adbfce gaebcfd fa abgf dfa | gbfdac acfgd gfcda fegdc
|
||||
dcagbf cfda fcdbge cf bafcg bdgace adbcg agebf bcgedaf gcf | dcbegf bgdac gafcbd cgbda
|
||||
degfac eafcb dfacg gbcaedf gb dfbg afbgc bag bcgeda gfbdac | dgcefa dgbf bga fcgad
|
||||
deg fgdb feabd dg gefac fedbca eacgfbd ebacgd abedgf dfaeg | egfda gadfe edg dfbae
|
||||
degf fcagde cgdebaf cgf cafgd gf fadce cgfeba gcbda fcaebd | cdbag bdcag egdf dacgb
|
||||
fdgb bagfdc dbcaf fb abdceg fba fbeacgd geafcb afdce bgadc | bf fba dbafc gadcb
|
||||
aegdb fdagceb bafce fad dgabfe df cagbed fdeg aefdb gfacdb | becgad adfbe afd badfe
|
||||
fdbg gfabc fcabd fd abcegf gadbcfe ebcad dcf dcfbga fagdec | bagcfe gfacbe fd cagebf
|
||||
cgfd egdca fdaceb abegd egabcf eacfg ecbfgda dca fdcage dc | egcaf ecbdgfa abcfed dcgf
|
||||
efdgba cgfeda ac gabecdf efagd adcef fac cefbd gcea dagbfc | afebcdg ca bcfed ca
|
||||
acbfeg bg fecbgd fgdeac acebgfd gbe bagc afecg fbead begfa | agcbdfe bg fegba badegfc
|
||||
eadbgc edfba bfecdg acfb egfad ba bea dfceb dcaebf beagdcf | ab eafbd abe adcfgbe
|
||||
fbega afdce gd agcebf becgad bgdeaf fbgd gde ebgfdca efgad | cegdab cefbga fbgd geadf
|
||||
cag agfce gfacde gbcdaf ag gead fbgec cdefa bdafcge bdefac | cfead gca adge bdagcf
|
||||
dc cebfa egacfdb dcf edbfc cbdgfa fdebg gefdba cged fdecbg | dcf eafbc bgacdf dc
|
||||
edbfg fdacge dcgae baegcd bacfgd ecaf geabdfc ecdfg fgc cf | defcag dbfgca ebfdcga cebdga
|
||||
fdgec gd gfd efcbd fdagbc bedg fabedgc gaefc becadf fdbecg | gacfbd fbdcag dgbe edcbf
|
||||
fec dgebf fbdc efbdcga afegcd befagd fdcgeb fc egcfb cgeab | bdefgc dfegba degabfc fc
|
||||
cdb gdfc dc cbdega eadbf egfacb gfcebad cgbfda acbdf bagfc | dgaecb cd bafed dcb
|
||||
dcbga ag cgdaef fgbdeac daebc fbag cag fgcdb ebfgcd fbcgad | ag faegcdb acgdfe dfgcba
|
||||
dabef fa ebacfd dfa bdfec fbgdca cbfegd dbcegaf bgaed efca | gdaeb afd eadbf fa
|
||||
bed dgab gfced afgbedc dfbge geafb efadbc febdga cafgeb db | fgeba gdba aegfcb gfecd
|
||||
da gbacf becdaf ebcfgad ecad cgfbde fedgab dbfca fecbd abd | ad egbfdc bad fcbag
|
||||
efc bgfceda dfbcag ecbg efagd acbgf fbagec aecfg ce bfeacd | egfac ec afecgb fbeacgd
|
||||
aedfbc gaced fabg ab bdgfc gefbcd adb gdbac acdegbf gcfbad | ba bcgdf ebfcda bafegcd
|
||||
cdgfb abegdc fgeacbd feba ecafgd gebfda ef efd dbfeg bdeag | dfe egfdb agefdb bedga
|
||||
cagfb ef fcdgae cfe cgafdb bcedg fbdgcae bcegf feba acgfeb | gefdac egfacd cgebd feadbgc
|
||||
bfgedca cabfgd gbac ebdfa ag abgfd dga egfdac bdcgf gbcefd | cafged bgadf ceafgd ag
|
||||
gebda bc eagdbfc ebdcg cdbgfa cgb ecdgfa cefb gfdec fbgecd | dfgbac cebf dgbecf fcbgade
|
||||
dfbcag dafgc bfd fdgcae gebda ecafbd gfadb gfcb fb dacgbef | gbdfa dagcf dagfc fbaced
|
||||
cd dfebg fcdgb cadb gdeacf eafcbgd gfceab cdg abgcf dgbfca | dc fbadcg cd adbc
|
||||
becafd dbfa feb fb abgcef adgefc cefda bgced edcfb bedgfac | fcdabe bf feb dfab
|
||||
gbadfe fdcage acgef fed ed decg abgfce adcef gebfadc fabcd | ecdg afbcd afdgce fde
|
||||
fcaedb dgbca fdcg efgbdca fbgca befag caf bagfdc dbaegc fc | fca gfacb bgceda fc
|
||||
cabed fbed fd cfd fagecd bfdca bfcdaeg acfgb bedcaf dcgbea | aebfdc ebfd bdcaf fcdgea
|
||||
agdbfc fagbc fgdc dgacebf bcgaef fda ceabd bdfca fbgead fd | fda fdcegab bgafc edbafg
|
||||
cbgfa bfdgea bfdgc ga fga aecbdf gcae egbcaf bcfgdea cefab | ga fcabe fgbdc gfbac
|
||||
cgafe cbagdfe afbce afegdb efgda gebcda gc gdcf cag eagdcf | befca gafed eadbcg gca
|
||||
agfce edgcba egbac gcbf fagbde gdacebf agf cdaef gbeacf gf | fecag bgace gdfbaec bgcfdea
|
||||
be gaeb gdeaf fcdab cbegfd fgeacd efdab fbe cgebfda dagebf | feb dfgacbe faedcg egfbad
|
||||
dfcba cgfdbae gda afedcb bgca bagcfd ga gbdef eadcfg bgafd | bgfad gfebd ag efabdc
|
||||
edgafb dgef agbedc gf abfgec fcdgeba adfbg abdeg fga cfbda | dafecbg badfg bcagdef fag
|
||||
fgc cgfbe ebgaf cbfa cgedbfa cf bgced gecfab defbag fgdcae | gfc cgf gbdfea fcg
|
||||
cga bcadfge aefdgc edgca dafc gdafbe aefcbg agefd ca cdegb | debcg faecgb cga gac
|
||||
dbcaf gcadebf eafcgb dbcefa gbdf cbfdga bcg adbcg gb edacg | afecbg cbg bfcad cabfdg
|
||||
fd dgaeb def fgecb fdebac feadbg eabdgc dfgeb becfdga gafd | fbgce egadb bdgea fagd
|
||||
cedbgf dbcgf febcad dgeafcb efcagd bfge cfg bdcga dbcfe fg | gcf cbgda gcf cadfegb
|
||||
gfabc agc degbaf fgaecb gaefb ca cefa bedgac fedgbca gcfbd | begdca gbdcf cag eacf
|
||||
ebfa be fgbcd afcegd cbe febcd faced egfdcba dbface aecbgd | ceb ceb cbfadeg feab
|
||||
gbfad cdeabgf bdeag de afcdge ade cdbe ebacg geafbc adcbeg | cbdefga gaceb ed bdce
|
||||
fcedbag adfeg fadebg cbgda fdeb fba bf egdcfa gfadb cfbgae | bf fegad gabdf dgcba
|
||||
abde debfgca acfegd ae fgcbe dabgc gbadfc cgeba cgeabd aeg | eag bcfgdae gfebc aegbc
|
||||
afdeb caegfd dcgb bcafge egabfcd fgd cgfbad dgbaf fcgab gd | aebdfgc bcdg agfebcd fdabg
|
||||
ecbafg acdbfe bfge cfaeb cedga cfega dafgbc afg gf bcfgaed | cbdfga fg efagc geacf
|
||||
ecafbg adgfecb fdeac agbd cbgdf cfgbda agf ag bedcgf agcdf | ga ga fag cfdbg
|
||||
gcdbe cbadefg cdf dfea df gfaebc facbed cfbae bagcdf ebfdc | afde aecfb cbfdea caedfgb
|
||||
gcfb beafgd fdg deagc cfbed fg gacdfeb gdcbef fcebad gedfc | cdbef dgf dfg bcfdgea
|
||||
dgebfac eacdbf bdc abgdc adbeg cadgf cbfg cegfad gcbfda cb | cafdeg fdacge facgd bcd
|
||||
cdeag becf fgdbac fc gbfaced edgfc dgebaf gbfdec edgfb cgf | gafdeb daegc bcdfge egdfab
|
||||
aegd cgd abfcd cabgde fdegbc dg ecagb dagfbec cbegfa badcg | ecagbfd debcgf agde bacfd
|
||||
cfdge gb abfed bdg cbge gfedb bgfcdae cbdagf begcdf fcdega | cgbe bgd cfbgda fcedg
|
||||
egdfca eafdcb ecdag dbgfac gefa ag bcfadge agc gcbed dacfe | ebafcdg acefd fdcae agc
|
||||
afbgec edgb dafeg fegab agfdc de eda fbdgcea dfaecb fdegab | ead aed cfebad bceafg
|
||||
dbgc gbeaf acfebd agd afecbgd fabdc ceagfd gbfda cbfagd dg | gcdb efdacb gfdbca gbdc
|
||||
afcedg gbad dgecb gcefb acdbeg dg abedc dcg dabcef gbdcfea | cgdeaf beacfd cbade cgdbe
|
||||
ea egfdba dgceaf daec cfgbe eag befgdac fegca cadfg fabgdc | fgceb adfgc abcfgde gaefcd
|
||||
agdebfc dbgca egb egfd abfde agdfbe fcbade fgeabc dgbea ge | bdgca debaf aedgb fegacb
|
||||
efcbd ecgd fbecgd adgbf egacbf bfcgdae ebg fdebg ge dcebfa | gfceba cbdfeg eg fgceadb
|
||||
dc befgac cdb aced gcbfead dcgefb adfbg acgbd cabeg eacdbg | edcabg bdc dgcaeb acbgefd
|
||||
afgbc dbaf ebcfg ba ecfgdab adcfg bca fcaegd cgabdf gcabed | bfgce egadbc cbgaf acdbefg
|
||||
cagbd adg cegafd acfgebd bdaec gbfd gd gbafdc bgacf faegcb | gebacf dg gda agdbc
|
||||
bc cdgba adfcg ebadg cfbdae ebfgad dgbfcea cba bgec gbdace | bc cb dafgeb cab
|
||||
gae bfegc edfac gdca ga begdaf cgeaf edafcg bafedc cfbedga | adfcge ecdfag fabcde aecfdb
|
||||
cdfge db eabcf fdb bade cbfed cbfdaeg gfbdca dcbefa cgfabe | dbf cbagdef db abed
|
||||
efa facg beadcg gacfde cbfed dcefbag adceg fa gedbfa cfdea | agecd gcbaed afcde eacdg
|
||||
dbgca dfbeg fcg adbcgf bafgce fdca cgbdf gabdcfe dbecga cf | gacefb cabdg dfca fcg
|
||||
dbfcae gc decg ebadc cga abegf cbfaegd cbage gabfcd agdebc | edbcga gebca cebda baegdc
|
||||
becagd gefcdba bgaef gfadcb fgd fadc bdacg dfagb fd ecdbgf | dgf fgaeb cdaf fd
|
||||
egfcab dcfgea caebg ag cbeafd edfabgc gfba bcdeg acg ecafb | cfbaeg gac acgfed eabcg
|
||||
gbc gfbad fgbac beadgf cg fbeac gdfbce dbgcaf bgcfead cgda | gacd edfgbc cbg gafbed
|
||||
fgdba begcad fg gfd fdacb debfag egdba adfcbge fgbedc afeg | afdbg bdaeg badfg eagcdb
|
||||
cefgdb fdecga beafg agd acbd badge cgfdeba cebdg ad dacbeg | cabd cedafg cfedag fgaeb
|
||||
fgc cdefb beafcg dcfbg adbgfe cgad acefbgd adbfg cg afdgcb | fegcdab bagfecd gfdcb gcad
|
||||
cbagfe cbedgaf bfgde cfdeab gfeba df fgda dcbeg afebgd bfd | fd adfg ebgcd fcabge
|
||||
ebgaf ad ebacgd adfgb cadf abfdcg badgecf cdgfb bad ebcgfd | bdegcfa cfda fbaeg gbcfad
|
||||
adfcg dabecg gaebfcd ecfbag bgacf gdc bgdf cbfagd eadcf gd | dg cfgab fcgab agbfce
|
||||
ecfgdb dcgbfa fdage ecda ad ebfag dfa bfadecg fadecg cegfd | ad dgefc cdae bgdecf
|
||||
agcfed eabdfcg aec ce gacbd gadec geafd cefd bagdef cgafbe | ce aefbdgc egcbfa gaecfd
|
||||
gdace fe bdgafc efa dbafecg fgeb bdafce beadfg egdfa dgfab | ecgda fe fbgad fedabg
|
||||
fg bdgcefa gabed defga fbeacd bdcafg cfeg gfd edcfga fdeac | agfde fg fcbade dfgea
|
||||
dcgfbe egdfc gcbd dc geafd becdaf gcabfe cde efbcg gedbfca | dc fgead dgcef gdcb
|
||||
gdefa efadbc cfdebga adfebg eaf ebag ea adfbg cfdeg acgfdb | fgdbaec cabgfed dgafe efa
|
||||
fecb fcegbda dgeaf eagdbc eb dbegfc cfgbad beg gbedf fbgdc | bcef dfegb gbdfca dgcbafe
|
||||
befg bafde afgdc degfa cdeafbg edafbc dge eagcdb gdbafe eg | dge efbad becgda aegdbf
|
||||
ac adfgc cedfg bedgac cda ecfagd degbcf fecabdg afec badfg | gdfab dcgaf fgced cegafdb
|
||||
cda badcg edcgb geca ca bdaegc dbfaec decgbf agfbd ecdgfab | ac bdfag ca edgbfc
|
||||
fgac febgca fg ebacf bgfecd gfb gbcfdea badeg bfage bedfca | gbefcda fg bdfceg gcfa
|
||||
bcgfade ce fcge dbgcfa cdafe badgec acgfd gceadf befad edc | bagcfed ecfda fcgad dce
|
||||
ebacfg efbad fcbaedg age dfagc adefg cdge eacgfd ge dgfabc | geabfc cdfagb eafdgc gae
|
||||
abd cgbde da gdcaeb cagd baecd faceb afdebg ceagbdf egfdbc | agdc gadc gedbcaf bcafe
|
||||
eg bdfgec dcfbe facebg efg gabcedf dcgfe cedfab afgcd debg | ecgdf cgefbd cdgef feg
|
||||
eagf efbdgc dga dcefg cdgfea bcdea cdgfab ga gdeafbc ecdga | gcdae aedgc ga ecdab
|
||||
ga cbedg eacfdg acg eabdcf ebafgc adgf cfeda egadc dacefbg | dfag fbcage bafgce acgde
|
||||
gfea cgdfeb efabc agfedcb gfc afegbc gf cdfbae abgfc dcbag | caebdf beafcd caebgf baecf
|
||||
efd gefa gedcab dcfab cfdea ecdgafb fbdceg egdfac ef agcde | gafcde ef aefg cadfb
|
||||
bafecdg deafbg fadeg bga deagbc gebfc bafd efbag ba dcgeaf | gedaf ba dgbaecf ba
|
||||
ag dga geabfd becadf gbaecd abecd aceg bagcd cfgdb cebdgaf | egfbad aegbcfd cgae dacbe
|
||||
bcdgeaf gbfda afcged gfebd fa dgfcbe efab agf bdcga dafgbe | gafedb efbgda ecagfd fgdbe
|
||||
degafc feba fgbcde bafegcd bge adegb be dfega efadgb cgbda | dbegcfa acbgd faeb acefdg
|
||||
gdcfeb ea fceab fgbca adfbeg eadc cdebafg cebdf aef fecabd | cefba fae dcea efa
|
||||
agfde dbega fg dcfg ecadfb cegbaf adfec adecgf adebgcf agf | dgfc gcfade afbecg dcfage
|
||||
fbade caebg becadf fgdb gfa dafgbec fg afgeb fbeagd gaedfc | eacfbd bgeafcd fg efbad
|
||||
gbdacf aefd ed geadcf cegfd fcgeadb dbeacg cadgf ecgfb dge | gbacfd beacgd ecgadf cgfbda
|
||||
adebgf gdf cefgdba fd gcfba efad dbgeca agebd afgbd fdegbc | deaf gfbdea df dbaeg
|
||||
adgbf cbfg fagde facebgd gbd acdbf badegc baecdf gbfdac gb | bdagfc gcfabed fdcab cdfab
|
||||
dbgace cbdfg ab dfagb abef abgfde gaedf bad ecdafg gcdbeaf | ba cbaedg ba dfbga
|
||||
bgcade acbedgf gbef cef cdbfa ef cbefd afgecd bgdce fbcgde | ef ef fce dgecfba
|
||||
gbfced abegc cde acbde fcgaeb cd gebacd agcd gfabdec abdef | gdca gacd dcbae bdegafc
|
||||
gb facdb fedcab fgb gadebf aegfc dgcb cabdgf gbcfa eafcgdb | fegbad adfcb dafgbe fdcba
|
||||
gfbaed fcabde gdbfc bdeafgc dgb agfcdb cgda fcdab gfbec gd | becadf facdeb dg agbdcf
|
10
Sources/Runner/Resources/input/08_test.txt
Normal file
10
Sources/Runner/Resources/input/08_test.txt
Normal file
@ -0,0 +1,10 @@
|
||||
be cfbegad cbdgef fgaecd cgeb fdcge agebfd fecdb fabcd edb | fdgacbe cefdb cefbgd gcbe
|
||||
edbfga begcd cbg gc gcadebf fbgde acbgfd abcde gfcbed gfec | fcgedb cgb dgebacf gc
|
||||
fgaebd cg bdaec gdafb agbcfd gdcbef bgcad gfac gcb cdgabef | cg cg fdcagb cbg
|
||||
fbegcd cbd adcefb dageb afcb bc aefdc ecdab fgdeca fcdbega | efabcd cedba gadfec cb
|
||||
aecbfdg fbg gf bafeg dbefa fcge gcbea fcaegb dgceab fcbdga | gecf egdcabf bgf bfgea
|
||||
fgeab ca afcebg bdacfeg cfaedg gcfdb baec bfadeg bafgc acf | gebdcfa ecba ca fadegcb
|
||||
dbcfg fgd bdegcaf fgec aegbdf ecdfab fbedc dacgb gdcebf gf | cefg dcbef fcge gbcadfe
|
||||
bdfegc cbegaf gecbf dfcage bdacg ed bedf ced adcbefg gebcd | ed bcgafe cdgba cbgef
|
||||
egadfb cdbfeg cegd fecab cgb gbdefca cg fgcdab egfdb bfceg | gbdfcae bgc cg cgb
|
||||
gcafb gcf dcaebfg ecagb gf abcdeg gaef cafbge fdbac fegbdc | fgae cfgab fg bagce
|
100
Sources/Runner/Resources/input/09.txt
Normal file
100
Sources/Runner/Resources/input/09.txt
Normal file
@ -0,0 +1,100 @@
|
||||
4323999434356678989012399854245901359876432101298901239876569892012345896567996545678912345689998921
|
||||
6319898921234589878923987653129892349989949212347892398765498765423456789469884326789923468998997890
|
||||
5498767892945678967899876543256789998999898943456789987654329878534567994398765434567894579997876789
|
||||
7598756789896789656799988654347897897898787899969894198969210989675679865789987645678965989986845678
|
||||
9987642356789995345789999767658966956987676987898943019898921299789789989898998759789996899895434567
|
||||
8765421234597893234567899878979654645696545545787892198797993459895995797967439867899989998756523456
|
||||
9873210123456789145978967989989743234985432123456953987676889567994379976543123978969878987643212677
|
||||
8654321234599891059899656196899820189876541034567999876545678978989457898991034989454569899876543467
|
||||
8765432346789932129789543245698721278987632175679789985434899299879768909989549994323798789997654578
|
||||
9876543459999943398656959366797632368999543286789679876545789349768979219978998943212345695498765679
|
||||
8987654567899854987847898997987543456987655399896598987656999998657894398769876543101456789329876789
|
||||
7998766678998769876236987789998787567898867899989467898789679876546796987654989654212567893210989894
|
||||
6879878789439898765134896578999898678999978999876347999892498765435689996543498765323989964348994943
|
||||
5667989894323949873256789459899969989799989298765276789901999976523499989432369878554899979767893212
|
||||
4456998976210239954367892365797654395689990198754345890199898765434678978943458987675789989989989103
|
||||
3347897654321298765458921234998753234567891259869656789989729879656789567954667898789895698794567924
|
||||
2256998985434349999567890147899432145678942345998969999877610998789893457895978989899924997643457895
|
||||
0197899876579569878998921356987553269789653496987898998765431239898921238989989876968999876432346796
|
||||
1989921989698998767889432387898769998997654989976767999865432378997632345678998765656789997321245989
|
||||
9879899998997897658978943499949898787898769878765657892976543456796543458989987654245894395460349878
|
||||
8768778987986986546569765678934987656789898765454345991097694567987654567999998742134589987651298766
|
||||
7656567996765987432458979899929876545689997654343234789198989798998785688958999821023678987542987654
|
||||
8543457895454599543567898987898965432398789543210123678999978989109898799767898762124589998963499763
|
||||
7432568976323987654678987896587898751987678954621234567899868878998969899878987654355678999654598754
|
||||
6563678996454598785789876543456789899896567976542545689988759767897653978989698776456789498775679876
|
||||
7674569987887679899899998954587893998765456897678766789977648956789792368994569897568992349896789987
|
||||
8789678998998799987978989899998941987654347998989877899866537845678989457893556998989641239987896599
|
||||
9996989469239899976567976798889432398743257789995989999654326534989878968942445989899932398998965456
|
||||
9765794345999998655456985697778943469854345679954197898765410129798956899321239876787899497899999999
|
||||
7654654239878899543257894986567954567965466789893246799987654397657645965490399865676798976789987878
|
||||
6543210198768789954145993214456895699876587898789345678998766498543237896989988754545987545698986767
|
||||
7659323498756567893239872102345696989987679987678956989999987987632126789879876543234985434767895456
|
||||
8798944987643476789398765213456989878998793236567897899897899876543245998765987656129876323456789346
|
||||
9997955698652345679459854323469878767899892105478898998766976987654346789654598761034987654979893234
|
||||
9986896789821239896567967469598765457894999212345789999845275698766457896543469878236798899897992123
|
||||
8875989899843345798999897578999854346795698923458897898732154569899598987674878989345899988756789634
|
||||
7654678998764466989987789989899965234896987894567976987621013456987699698765999999456999879645899546
|
||||
8463567899876577978996578898659894365689876789678965496434154789998789549896899898767898766434578957
|
||||
4322456799988789467986459789548789456790245678989654398645865699899899932987998789998999654323467898
|
||||
3210345989999891239874345678937578968921576789998763219856776789799999891098997656569998765634678959
|
||||
4421299876789999498763234589425467899432347999899865498987887895679998789129986543467949976545689646
|
||||
5542989665678998987654345678912348997543598998799986597898998954598987679298765432599234987898795431
|
||||
6743976564567796598765466789323556789954689898678999986569899323987896567999877653789345698939894310
|
||||
7769865433475689439876578895434667899899797654589998777476789012396543457899998789898959899323965621
|
||||
9898764321234678912987889976545978998798976543478997654365692126597632349789109898967898989459875432
|
||||
6969875430345799323498998797667899457657897652367898743234589987698721234589299987654987678998998745
|
||||
5456989561256789534679967698799954312445679721458999892123678999899830145678989976543498899897897656
|
||||
3237898762347897645789854549899543101239998932369898989294569767998764234889679885432459998786789767
|
||||
6545679654456798789999753234997653212398887893456797679989678955349854345796598754101345987675679878
|
||||
7656799765767899899899875123989964329987676799569986568678989844239965566897399543212659976564568999
|
||||
8767949879878999956798765234567895498766565688998765454567897632198987677979987674353598989323656789
|
||||
9878933989999997345987654347978987987657474567899864323456789543987798789657898765674987643212347898
|
||||
2989212399899976499899765456789598999843323456798543412345897689976579896546989978786799532101234567
|
||||
1099923456789897988769896567893459988732012347987632101276889798865456965435678989897899744312345678
|
||||
2989894569898789876553987878932349876543123457898543242345678997655329876323468996998998765423456899
|
||||
9878789678987678965432398989321956987654234567998765953456889896543212965414567895469999876536567893
|
||||
8767679789876569896543459999939897899776876678929878767967996795432109876525678994356987987897678954
|
||||
7654568998965456789654597899898789999897898789213989879979645689643234987987989789249876598998989865
|
||||
6543457976434345678969986789787678989969959892102398998796534679865359898998995678998765459789999986
|
||||
7532369865421237789998995897678459876553345943234567895679845989877899789999434567897654345678998987
|
||||
8643456976510175893987654589541234985432237899765678954598759992989987678985326789999543256899987799
|
||||
9754567984323234992199867678920349894321018989887899943698767921399976569876434697698954387929876545
|
||||
9965678999654345689023978789321298765732147678998999892349878992349989678998556789567895998934984334
|
||||
9896789698765456795434989897632349876654234567899998789759989789498798789987667898488976789949893213
|
||||
8789996539876568976765699976543456987769645778998987698998795678997629899998979987569987899898789323
|
||||
8678789623987878989876789987656567898998756789987654597899654578987510949879989097698998987678678934
|
||||
6577678910198989099987899999878978999459867897898769986898943139995421234569992198987989766534567965
|
||||
5464569923239099198798978987989989989234978976789898765567892098986532345678943469876878954323588976
|
||||
6323467894549198999659767896590195678949899965878987653467894987987645456799654979765767893212789987
|
||||
7467878995698987888943656987321234789998799894569876542345695986799656777898769898954456794325678999
|
||||
9878989789987656567892346895499995894987676789678984321237989875678967888959998767893345689634789343
|
||||
9989795678976545456789498976987889963298545798789995452345678964569898999543989656921239796545895212
|
||||
8799654345987432367898569299876978954987656789896976563456789543456789212959876967892398987656954101
|
||||
5698743239874321298987694398765767896799767899965698754689897632345898909899765898993987898787893212
|
||||
8789842198765453456998789987654656789899879999854569869793998943458967898798654789989796789898965337
|
||||
9898651019976764567899899876553234899999998999763579878892349894967898987698765678979655679929598656
|
||||
8999532124987989678921999765454123689998987688932389989921498789898999876549876799768443458913459767
|
||||
7987693535698998799210198754321014599997698567893499995210988679789498765434987897654312367904599898
|
||||
6298989545679129898921239895932135679876542348954569874329876565699349954323698998766423778912989989
|
||||
5129878996989098987892398989893234598765430567895678965498765434598998766464569239976534567899878879
|
||||
4298767789998997645789997868689395987654321789989789876989954323457979887575698999988785678998767656
|
||||
9987656679987673234669876546578989998865439896578999989879765545568967998786987989999876799987654343
|
||||
8764346567895432123456987432446678969976546965456789998769877696678957899899876878913987891098765212
|
||||
9843213457897641012349996551234569655987697892347999879656989987889345679999985467899999942139876909
|
||||
9874326567999973253598987767897678934598788901256789765345699898998956798798754376788987659245989898
|
||||
8765534567899654345696598988969789012479999432346789654236987649567897897649654234567898798967998767
|
||||
9876645678958987656985459199459892123467987656759896543129876533456789986539867545678989987899879756
|
||||
1989856789767898769874321012389943234568998767867987321013976512356899876621998656789679876789769845
|
||||
0198967899878959998765453125678974345899459898978998534123497301245798765433498767896567965398654976
|
||||
1987698901999239879876875234569865456789345949989987643294989212398999879754699878965459876797743988
|
||||
9876569892999398767987864345678976567899276932994398784989978934567891989876789999894323987896532399
|
||||
8765456789878999856998875457899987679998999899875999899876867897678910199997890123789412398965321246
|
||||
9984345898768897645879987568999998793467989799989899988965456998989329988998943235694325499984210123
|
||||
9765457987656789734567898979998879912399865689998789877652347899395498977899876545789434989875331234
|
||||
9876569876545678923456789989987762101987754679987698768341236789219987656789998756789649878989445678
|
||||
8997699997656789212345898795496543212976763567896549854210145678997697545899989867899998767898986789
|
||||
7698989698767892101256987656398654323965432356789430969321234567976543234878978998999894854567997891
|
||||
3569876569898976412345896546239876579876321245695321298763367898965432123458965459998763213458998942
|
||||
2345965412969994324456789634123998689988432357976763497654456999976543234567898567987654101556789543
|
||||
0156976323456789534567994321014569795499543568987954698767767894397654545798987678996543232345678954
|
5
Sources/Runner/Resources/input/09_test.txt
Normal file
5
Sources/Runner/Resources/input/09_test.txt
Normal file
@ -0,0 +1,5 @@
|
||||
2199943210
|
||||
3987894921
|
||||
9856789892
|
||||
8767896789
|
||||
9899965678
|
90
Sources/Runner/Resources/input/10.txt
Normal file
90
Sources/Runner/Resources/input/10.txt
Normal file
@ -0,0 +1,90 @@
|
||||
([<([{{<<(<<{[<><>)}<([][])<<>{}>>>{[{(){}}(()[])]<{()()}<()()>>}>([<<{}<>>(<><>)><[{}[]](<>())>][
|
||||
({{<<(<<<<{{[({}{})<[]()>]<([]{}){[]<>}>}{([{}[]]}}}>({(((()()))<{<>()}[<>()]>)[{(<>{})(()[])}[{[]
|
||||
[{{[([<({[([<{[]}({}<>)>]{(([]())[()[]]){<[]<>>[<><>]}}>{<[(()<>){[]<>}][[<>{}]<()()>]>[[[<>[]][()
|
||||
{(<<{([([<(<{(<>[])<()<>>}>){[[<<>()>[<>[]]]{[{}{}]{[]<>}}]{<{{}<>}{{}()}>{[()()]<[]<>>})}>[{({[{}
|
||||
<{<<<<<{{{({<<[][]>[()[]]><<(){}>([]{})>}{{<[]{}><{}[]>}{<{}{}>({}<>)}}){([(()[]){[]()}][<[]()><[]{}>])
|
||||
<{({{<{{{<(({(<>)({}[])}{<()>{(){}}})[[(<><>)[[]]]<[{}[]]{<>()}>])>{<<([{}()]{[][]})({{}{}}{()})><
|
||||
<([[<<[{[{({{({}<>)[(){}]}{[{}<>]{[]{}}}}({[()()]<<><>>}(<{}[]><[]{}>)))}<({<<[]<>>({}[])>
|
||||
[[{<{{[{<{<[{[()[]]<()()>}][<(<>[]){<>()}>[{<><>}(<>())]]><[{{{}<>}<{}{}>}{[{}[]][[][]]}]<[([]<>){[]{}}]<(
|
||||
[({[<([[{<[{{(()[])<[]{}>}<[{}<>>{[][]}>}(<<[]{}>([]<>)>[([]){()[]}])]<[[[[]()][<>{}]]<(<>{})((
|
||||
<{[[{{{[([([{[<>()]{[]{}}}<{[][]}[<>()]>](<<<><>>{()()}>))<<{{<><>}[{}()]}{(<><>)[<>{}]}>>])]{[<<[<([]
|
||||
[[(<<<({[(((([<>()]([]{}))((<>){[]()})})[[<[[]<>]<{}<>>>[<()()>[()<>]]][[[<>{}]{[][]}]]])<<(({{}[
|
||||
{{{[[<<{{[{<[[{}()]]>[{[<>[]]([][])}<{{}()}{{}[]}>]}([[{()}{(){}}]([<>{}]<{}<>>)][{{[]<>}}[{{}{}}[{
|
||||
{[{[(<{{([{<<<[][]><()<>>>[{{}()}{[]<>}]>({<{}()>[()[]]}<<()[]>([][])>)}{[([[]{}][<><>]){{{}[]}<
|
||||
{[({<{[<{{[(({()<>}({}[]))([()]{<>[]}))({{[]{}}<<>[]>>)]{((<()[]>{(){}})[{[]<>}])}}}<[[<<<(){}><()
|
||||
[[[[[{{[{<<[<<{}<>>>{<()()><{}[]>}]>(<([()<>}<<>[]>)(((){})<()[]>)><({{}{}}<[]()>)<{{}<>}(
|
||||
{{<<[<{(<[([(<{}<>>[[][]])[(()())]]{[([][])({}<>)]<(<>{}){[][]}>})([{(<>{})<()<>>}])]>(([[[(<>{})](<[]
|
||||
<<([{<(<{({<{({}<>)<()()>}{<<>[]>[{}{}]}>(<((){})>(<[]()>[<><>]))}<<(([])[()])<([][])(()<>)>>>)([{([<>{}]([]<
|
||||
{[[{{[[({{[([{<>[]}[{}[]]]){(<[]{}>[()()]){[<>{}][<>]>}]}{<{<<{}()>({}())>}{[[<>[]]{<>{}}]<[{}[]]{{}{}}>}
|
||||
{<[[{({<{<[<(<(){}><<>{}>)>{[[(){}]]{({}())({}[])}}]{[{{(){}}}]}>}(<{{{([]{})[{}<>]}(<<>{}>)}(
|
||||
<[[<(<([[({(<{<>()}([][])><(<>[])[<>{}]>)((<<>()>[[]()])<{()<>}<()()>>)}>[[({{{}<>}[[]<>]}
|
||||
<{([{({[[({([[{}()]<()()>][<()[]>[[]<>]]}([<(){}>{<><>}][<{}<>><<>{}>])}[(([<>[]][<>[]])){
|
||||
<{[<(<(<[[[{[{<>{}}]((())({}()))}][(([{}<>]{{}{}}))[{[[]()]((){})}<[<>[]]([][])>]]]][[((({
|
||||
({[<<([[[<[[<(<>{}){{}[]}>[((){})[<><>]]][{{<>{}}{(){}}}(<[]{}}({}<>))]]{((<{}[]>({}<>))<<<>{}>[[]{}]>)[((
|
||||
{[<<[([[([{<<[{}{}]({}[])><<{}<>)(<>[])>>[([()()]{<><>}){[[]{}]{(){}}}]}{<([<>]([]())){<(){}>{()<>}}><<{
|
||||
[<[[[[({{([{{(<>[])<<><>>}<{[]{}}<<>>>}(<{[]{}}<<>()>>)][{(<<><>><()[]>){[{}()]>}<[{{}{}}{<>[]}]>]
|
||||
{<{[<(([{{({[<<>[]><{}[]>]<{<>{}}{()()}>}([<{}{}>{[]<>}]{<{}<>><[]>}))<([([]<>){[]{}}]<{[]<>}
|
||||
[<<(({<<[{[([[<>]<()[]>]{[[]<>]{()<>}}){{<<><>>{[]<>]}[({}<>){()<>}]}](<{{()[]}}({{}[]}<{}[
|
||||
({(<{<{<([([[((){})<{}<>>]<[{}[]](<>{})>])])<<[{<<<>[]>>}<[(<><>){<>{}}][(()[])(<>{})]>]<(<{<>{}}
|
||||
([<{<<[([({<<<()()>(())><[[]<>]{<>[]}>>([(()())]{[[]()]<{}<>>})})[<[[(()<>){<>{}}]][<(<><>){<>[]}>]><<([{}
|
||||
([[<[[[({[<<[[{}()](()<>)]<{()[]}>>{<[{}<>]<()[]>><<[][]>>}>]<(<<[{}<>){<>}>{<[]()>[[][]]}>)>}({
|
||||
(<[(<[([<{<{<[(){}][<>()]><(<>())(()<>)>}{{[{}>([]<>)}[<<>{}>(()())]}>[{([<><>]<()()>)}{([()]{()<
|
||||
({{{{<[{{<{<<(()[])>{[(){}]{[]{}}}>}{{([<><>][<><>])<(()<>)[[][]]>}<<(()<>)><{<>()}>>}>}}][(<{(<[{<><>}[{}[
|
||||
<{[{((([({{({<()()>(())}){([()<>]((){}))<(()<>)[(){}]>}}{[{([]())((){})}[{[]<>>{<>{}}]]<<<()[]><()<>>>((()()
|
||||
{([({[(<[<([{[<>[]][()<>]}{[(){}]{{}<>}}][<<{}()>>[<<>()>[()}]])<((({}{})[[]<>]))<{[[]{}]([]<>)}>>><{
|
||||
([[[{<[<([{(<<<>()>({}<>)><[<>{}]>)[[<<><>><()[]>](<()<>>(<>[]))]}([({()()}([]())){<[]{}>[[]<>]}][<
|
||||
<<((<({{(<((<({}[])(<>())>{({}[])({}<>)}))<<<([]<>)[()[]]>{<()<>>[[]<>]}>>)({(<[<>{}]((){})><{()()}[{}(
|
||||
{({([(({{<{{{<[]()>{{}[]})[[(){}](()<>)]}(([[]{}]{()<>}))}>{(<[{()()}]{[<>[]][()()]}>{{<()()
|
||||
{[(<{<[<<[{<<<<>{}>>[[[]{}]<<>()>]>((<[]{}>{{}()}))}{({[{}()](()<>)}<<[][]>[{}<>]>)({[{}[]]}<<{}[]
|
||||
{{{<{<{[[{([{{[]()}}({()[]}(<>))]<((<><>)({}{}))>)}]]{[({<(<{}[]>{<>{}})((()<>)([]()))>})[<[[{<>{}}<<><>>]<{<
|
||||
[[<{<<[(<<<([<{}()>[{}()]](<{}[]>[{}()]))[([[]<>][{}{}])[<[]()><[]()>]]><[[[[]<>]({}{})][{[]}{<>[]}]][<[<>
|
||||
(<<<<(<<[<[(({[]()}[[]<>]))({(())(()[])}[<<>[]>{()[]}])]{<({{}{}}(<>{}))><[[<>[]]<[]()>]>}>{({{(<>()){
|
||||
<<(<[(<<<{({[<()>{()()}][([]{})([][])]}{({{}}{<>{}})<(())[{}()]>})}[[{<[[][]]{()}){[{}<>]<{}(
|
||||
<<{<{{[<[(({({[][]}<<><>>)}<((<><>)[{}[]])<<[]<>>>>)[{{[()[]][[]<>]}{({}())<(){}>}}])({[([[]<>](<><>))<
|
||||
<<{<[(<(<([[{{()()}{<>()}}(<<>()>({}[]))]<<{{}{}}{()<>}>(({})(()()))>])[[([(<>[])(<>)](<(){
|
||||
({[((({[([<{[{<><>}[()[]]][{[][]}{(){}}]>>(<{{[]{}}<()[]>}<{()<>}<[]()>>>[{({}<>)<{}()>}])])]<(<{{{<[]()
|
||||
<[{<<{<<{<(({[<><>]{{}<>}})){<[{<>[]}({}{})]([{}()]{<>()})>[<{<><>}<<>{}>}([<>[]]<[]()>)]}>(
|
||||
(<<(({<<(<(({[<>[]]<[][]>}({<>()}[[]()])){((<>[])){([]{}){[][]}}}){{[[[]{}][{}[]]][<{}[]>([]<>)]}[(({
|
||||
<(<(<<<[<{({([<>()])[[[][]]{<>[]}]}[<[()]<{}<>>><[(){}]<()()>>])((<(()[])<{}{})>)((([][]))))}>]<[<([[<<>()
|
||||
{{<[<<<{((([[([]{})][[<>[]]]])(<[[(){}]<<>[]>]>{[({}())([]<>)][<<>{}><[]()>]}))){{<[[[[][]
|
||||
{([<{[<<[{({({<>{}}[[][]])[{(){}}{{}()}]}[[[{}()]<()()>]])({<[{}{}]>({{}{}}[[]{}])}{{({}())<()()>}{{<><>}<[]
|
||||
[<{[{<{{<{<[{{{}{}}[[]()]}([{}[]]<{}()>)](<{()()}{<>[]}><(<>[])>)>}{{{((()<>)[<><>])[[()()]
|
||||
([{[<[({([<<<([][])<{}{}>>[[()<>](<>{})]>{{({}<>)}([<><>]<()<>>)}>](<(<<[]<>>({}[])>[<<>{}>[()()]])(<<()[]>((
|
||||
(<[{<({<([<({<<>()><{}()>}(<[]{}>({}<>)))[([[]()][<><>>){[<>[]]{{}<>}}]>({[{[]{}}({}[])]<{[
|
||||
<<[<(<({<(<({<()><[]()>})>{[{[[]()]<{}>}<(()<>)(<>())>)(((()())[<><>])([(){}]))})([(<{<>()}([]())>{[{}{
|
||||
[{<{<{<[<((({[()[]]{{}}}[[<><>]<<>{}>])<({[][]}{()[]})<([]())([]{})>>))((<([{}<>]{(){}})>[
|
||||
[[[[([<{[[(<{{{}[]}[<>()]}<{[]}{<><>}>><{({}<>){()<>}}[{[]{}}{<>[]}]>)[([({}<>}([]<>)]{{{}{}
|
||||
<{{[[<{[(({({<{}>[(){}]}(<[]()>))}<<<[{}{}]>(<[]{}>(<>[]))>([{{}<>}(()())]<{<><>}{<>()}>)>)<[<<
|
||||
{[{{{(<<([([((()[])[[]<>])({{}{}}({}<>))]<({{}[]}{[][]})<{[][]}>>){<<({})[[]<>]>(<[][]>(<>{}))>}]<[
|
||||
<[<(<{<[([[[{[()[]][<>{}]}[{(){}}{<><>}]]{<([]{}){()<>}>[({}<>)<<>[]>]}][<[({}[]){()[]}][<<>{}><()<>>]>]]<(
|
||||
([<{(([[<<{([([]{})([]())]<{(){}}{[]<>}>)([<<>{}>[()()]]{[[]{}]<[]<>>})}[({{()()}<<>{}>>){[<()
|
||||
([({{{[[[([{<{<><>}{()()}>(<[]())[<>])}{([<><>]<(){}>){(<>())[{}()]}}]<{[[<><>]{{}[]}]([{}<>]{[]()
|
||||
[[<<<{{({[{[({{}{}}<(){}>)<[[]{}]({}<>)>]}][(<{<<>{}>}{{[]{}}{()[]}}>[{[<>{}]<[][]>}<{<><>
|
||||
[([{(([{(([{[{[]()}[{}]][[[]<>]{<>{}}]}{[<{}{}>({}[])][<<><>>(()<>)]}]{<({[]{}}{<>{}}}>}){
|
||||
(<<<<<[{<{({({[]{}}({}())){([][])[{}{}]}}([{<><>}{{}{}}][[{}[]]({}{})]))[[[{{}()}[<>{}]][{{}<>}{()}]
|
||||
(([{<(<[(<{{{[[]<>](<>[])}{[()<>]<()()>}}}>)<{{({<{}<>>[{}{}]}({<>[]}[()()]))}([([<>[]][[]{}])(<<><>
|
||||
((<{[(([{{([<[<>()]<<>[]>>{((){})([])}][<{[]()}<<>()>>(<{}()>(<>))])}[{{{{[]()}}{(<>[])[()<
|
||||
<[[{{[<<({[<<{(){}}{(){}}>>(<{[]<>}<<>()>>({()<>}{{}<>}))]{[([[][]][{}<>])][((<>{})(()[]))[<()[]>{<>()}]]}
|
||||
{<{<<[{[([{{{{{}()}<()<>>}<[()[]]>}<[<[]<>><()<>>](({}())<{}>)>}<<({[]()}(()()))({{}<>}{{}<>
|
||||
{{[<{[<{[[{{({[]<>}<{}[]>)((<>{})({}{}))}([[[]{}]<{}[]>]<({}()){()<>}>)}[<([{}<>}<<><>>)><{[()[]][<>[]]}{
|
||||
([{{{[{(<<<[<{<>[]}{()[]}>(([]())<<>{}>)]>[[(<{}()><[]<>>)][{[[][]]<(){}>}<<()()>({}[])>)]>>)<<[[(<(<>())((
|
||||
<({[{{(({(<<<{[]()}(<>{})>{(()<>)[[]<>]}><[[<>()]]{([]{})[[]()]}>>)})({[{<(<[]<>>{{}[]])[<<>{}>[(){}]]><(({}(
|
||||
((<(([{([{<[{<[]()>(()[])}<({})[<>[]]>]>}]{[<<{[[]()]<<>()>)<<{}[]>{<><>}>>>[[([(){}](<>[]))]{{<
|
||||
[([<<([(<[<<([[]{}]<(){}>)([()[]][{}{}])>([([]<>)<(){}>]([[][]]{[]<>}))>{{[{[]<>}[{}[]]]{([]
|
||||
[<{<[[<{<({<[<()<>><[]<>>][<{}<>><<>()>]><{((){})(()())}>}{[([{}<>]({}{})){(<>{})}]([[<><>](<>)])})><{<{
|
||||
[(<[[<({{<<([<(){}><<><>}]<<{}()>({}<>)>){[(<>())[(){}]]<<<><>>[{}<>]>}><{[{(){}}][<{}{}>[()(
|
||||
<[<{[{{<([{<[{()<>}{()<>}]]{<[{}<>](<>{})>([{}<>]{{}()})}}<[([(){}](()[]))<{{}{}}>]{{{<>}<[
|
||||
(<{[[{[[{[[(<[[][]][<>{}]>(<()<>>(<>{})))[{([]{}}<{}[]>}[[[]{}]{()()}]]]{<[<<>{}>(()<>)]<{{}<>}<[
|
||||
(<<<[[(<{<({{(<>())<(){}>}<(()())<()[]>>}<[({}{})[()[]]]>)>}{<{[<[()<>][<>[]]>[([]{})(()())]][({{}{}}
|
||||
({({[[[(<<[{<<<>[]][{}()]>(({}())([]()))}]{<{[()[]]({}())}>({<()[]><[]{}>}[{<>()}<[]{}>])}>>)]]]}[({[[{({(((
|
||||
((([[<{[(<({<{<><>}[[]]>[{(){}}>}((<()<>>{()()})<<<>()>({}())>))((([<>()]{[][]})[[(){}]<{}
|
||||
<[{([(<[({[[([{}()]({}{}))([<><>]({}()))](({(){}}{()[]}><[[]()]<<><>>>)](<([(){}][{}{}])[{
|
||||
{<((({<((<[[<{()[]}<{}{}>>](<<[]>{<>}><[[]{}]({})>)]<<{[{}{}]}[{<>{}}}>>><(([<<>>(()())]<(
|
||||
{[[[<<(<{(<(<[{}<>]<[]()>>[{{}{}}{()<>}])[<{{}()}{{}{}}><{[]<>}({}())>]>)<<(<<()<>><<><>>>)>>}[(
|
||||
[<{<[([({([[[{{}()}{{}()}]([[]()])]])}<<<[<<<>{}>[<><>)><{[]<>}(()<>)>](({{}<>}[()<>]){{<>[]}((){})})>({(
|
||||
([[{{[[[<(<({(()())<{}[]>}<({}<>){[][]}>)[<{()()}[[]<>]>]>)([[({<>[]}[()()])[{[]<>}[{}{}]]][[<
|
||||
({[(<<<{((<{<[()()][[]<>]>{<{}<>><()()>}}<{[()[]]([]<>)}<<{}()><{}{}>>>>[<<{(){}}[()[]]>[([]<
|
||||
([({{{<[{[{{[([]{})<[]{}>][<<>[]>[{}[]]]}}[{[<<><>>{[][]}]((<>()){<>{}})}]]]][[(<({[[]()][[]{}]
|
||||
(((<{{<<<([[{(<><>)<{}>}<{{}{}}[{}<>]>]{[(()())[{}<>}]}]{<(<[]()>)>([<()[]>{{}()}]<({}()){(){}}>)})<[({(<>()
|
||||
[{(([[<(<<(<{<[]()>(<>{})}[{()[]}[()()]]><[<[]()>[[]<>]]>)<{<[[]<>]<()<>>>{[()[]]<{}[]>}}>>([((<[][
|
||||
{<{<{[([(<<[{<()<>>(<>[])}[(<><>)[[]<>]]]<<<[]<>><(){}>>{{{}<>}<<><>>}>>(<{{<>()}[()<>]}><[
|
10
Sources/Runner/Resources/input/10_test.txt
Normal file
10
Sources/Runner/Resources/input/10_test.txt
Normal file
@ -0,0 +1,10 @@
|
||||
[({(<(())[]>[[{[]{<()<>>
|
||||
[(()[<>])]({[<{<<[]>>(
|
||||
{([(<{}[<>[]}>{[]{[(<()>
|
||||
(((({<>}<{<{<>}{[]{[]{}
|
||||
[[<[([]))<([[{}[[()]]]
|
||||
[{[{({}]{}}([{[{{{}}([]
|
||||
{<[[]]>}<{[{[{[]{()[[[]
|
||||
[<(<(<(<{}))><([]([]()
|
||||
<{([([[(<>()){}]>(<<{{
|
||||
<{([{{}}[<[[[<>{}]]]>[]]
|
10
Sources/Runner/Resources/input/11.txt
Normal file
10
Sources/Runner/Resources/input/11.txt
Normal file
@ -0,0 +1,10 @@
|
||||
5251578181
|
||||
6158452313
|
||||
1818578571
|
||||
3844615143
|
||||
6857251244
|
||||
2375817613
|
||||
8883514435
|
||||
2321265735
|
||||
2857275182
|
||||
4821156644
|
10
Sources/Runner/Resources/input/11_test.txt
Normal file
10
Sources/Runner/Resources/input/11_test.txt
Normal file
@ -0,0 +1,10 @@
|
||||
5483143223
|
||||
2745854711
|
||||
5264556173
|
||||
6141336146
|
||||
6357385478
|
||||
4167524645
|
||||
2176841721
|
||||
6882881134
|
||||
4846848554
|
||||
5283751526
|
25
Sources/Runner/Resources/input/12.txt
Normal file
25
Sources/Runner/Resources/input/12.txt
Normal file
@ -0,0 +1,25 @@
|
||||
start-kc
|
||||
pd-NV
|
||||
start-zw
|
||||
UI-pd
|
||||
HK-end
|
||||
UI-kc
|
||||
pd-ih
|
||||
ih-end
|
||||
start-UI
|
||||
kc-zw
|
||||
end-ks
|
||||
MF-mq
|
||||
HK-zw
|
||||
LF-ks
|
||||
HK-kc
|
||||
ih-HK
|
||||
kc-pd
|
||||
ks-pd
|
||||
MF-pd
|
||||
UI-zw
|
||||
ih-NV
|
||||
ks-HK
|
||||
MF-kc
|
||||
zw-NV
|
||||
NV-ks
|
7
Sources/Runner/Resources/input/12_test.txt
Normal file
7
Sources/Runner/Resources/input/12_test.txt
Normal file
@ -0,0 +1,7 @@
|
||||
start-A
|
||||
start-b
|
||||
A-c
|
||||
A-b
|
||||
b-d
|
||||
A-end
|
||||
b-end
|
812
Sources/Runner/Resources/input/13.txt
Normal file
812
Sources/Runner/Resources/input/13.txt
Normal file
@ -0,0 +1,812 @@
|
||||
726,774
|
||||
246,695
|
||||
579,249
|
||||
691,724
|
||||
246,820
|
||||
738,887
|
||||
1088,75
|
||||
264,887
|
||||
704,775
|
||||
907,625
|
||||
676,117
|
||||
507,658
|
||||
1009,24
|
||||
547,735
|
||||
157,126
|
||||
599,113
|
||||
445,226
|
||||
363,691
|
||||
918,794
|
||||
927,113
|
||||
999,400
|
||||
443,305
|
||||
654,729
|
||||
408,767
|
||||
1066,863
|
||||
1148,473
|
||||
321,35
|
||||
1093,803
|
||||
1044,718
|
||||
202,889
|
||||
262,164
|
||||
378,541
|
||||
619,662
|
||||
1034,849
|
||||
432,595
|
||||
1145,656
|
||||
1295,668
|
||||
1125,705
|
||||
1161,529
|
||||
759,619
|
||||
1170,147
|
||||
688,742
|
||||
328,729
|
||||
718,439
|
||||
935,701
|
||||
246,647
|
||||
594,110
|
||||
845,495
|
||||
160,189
|
||||
1225,315
|
||||
580,486
|
||||
469,481
|
||||
440,401
|
||||
584,774
|
||||
897,719
|
||||
1007,516
|
||||
547,159
|
||||
112,117
|
||||
982,645
|
||||
62,439
|
||||
192,441
|
||||
631,211
|
||||
654,16
|
||||
113,698
|
||||
378,865
|
||||
373,19
|
||||
441,777
|
||||
390,7
|
||||
1263,312
|
||||
1121,610
|
||||
509,582
|
||||
893,352
|
||||
44,131
|
||||
1092,19
|
||||
592,719
|
||||
918,100
|
||||
326,820
|
||||
62,719
|
||||
520,889
|
||||
718,103
|
||||
571,579
|
||||
1165,267
|
||||
1208,334
|
||||
525,415
|
||||
268,588
|
||||
769,464
|
||||
596,716
|
||||
734,436
|
||||
1283,747
|
||||
35,457
|
||||
982,94
|
||||
1235,849
|
||||
932,752
|
||||
1265,243
|
||||
262,752
|
||||
99,704
|
||||
547,732
|
||||
1096,829
|
||||
791,329
|
||||
1222,320
|
||||
199,568
|
||||
671,494
|
||||
1079,93
|
||||
569,315
|
||||
129,415
|
||||
868,878
|
||||
788,803
|
||||
1175,889
|
||||
965,676
|
||||
904,660
|
||||
552,560
|
||||
619,484
|
||||
507,236
|
||||
566,768
|
||||
1215,30
|
||||
45,410
|
||||
885,441
|
||||
478,336
|
||||
945,397
|
||||
596,306
|
||||
1145,686
|
||||
189,495
|
||||
1153,126
|
||||
79,444
|
||||
719,403
|
||||
903,91
|
||||
27,105
|
||||
441,329
|
||||
768,565
|
||||
671,400
|
||||
507,205
|
||||
224,390
|
||||
867,753
|
||||
425,441
|
||||
1123,67
|
||||
833,14
|
||||
793,278
|
||||
1237,724
|
||||
238,808
|
||||
1099,32
|
||||
411,243
|
||||
1,574
|
||||
726,120
|
||||
862,441
|
||||
212,94
|
||||
80,199
|
||||
1047,312
|
||||
164,389
|
||||
440,773
|
||||
185,189
|
||||
412,114
|
||||
537,792
|
||||
403,697
|
||||
1208,768
|
||||
408,527
|
||||
1135,831
|
||||
746,826
|
||||
1064,110
|
||||
15,226
|
||||
102,574
|
||||
1001,442
|
||||
769,16
|
||||
1236,408
|
||||
440,121
|
||||
1309,131
|
||||
771,473
|
||||
1064,527
|
||||
189,284
|
||||
427,704
|
||||
276,865
|
||||
986,593
|
||||
1009,870
|
||||
745,276
|
||||
965,291
|
||||
1190,5
|
||||
1084,768
|
||||
313,750
|
||||
976,544
|
||||
1222,658
|
||||
223,619
|
||||
718,791
|
||||
976,574
|
||||
705,822
|
||||
785,863
|
||||
388,390
|
||||
1235,716
|
||||
579,645
|
||||
90,378
|
||||
497,849
|
||||
1308,145
|
||||
658,301
|
||||
648,94
|
||||
1150,189
|
||||
231,129
|
||||
408,639
|
||||
390,119
|
||||
132,556
|
||||
639,220
|
||||
885,453
|
||||
413,651
|
||||
639,68
|
||||
177,544
|
||||
552,782
|
||||
239,130
|
||||
867,645
|
||||
187,67
|
||||
1163,494
|
||||
1227,19
|
||||
249,658
|
||||
132,270
|
||||
740,82
|
||||
73,206
|
||||
1166,525
|
||||
262,506
|
||||
1092,875
|
||||
923,509
|
||||
967,400
|
||||
813,849
|
||||
734,364
|
||||
604,541
|
||||
566,758
|
||||
90,852
|
||||
190,831
|
||||
1047,65
|
||||
313,144
|
||||
542,157
|
||||
720,304
|
||||
129,863
|
||||
1280,149
|
||||
448,441
|
||||
947,484
|
||||
1048,506
|
||||
408,863
|
||||
657,803
|
||||
480,834
|
||||
201,369
|
||||
489,208
|
||||
1275,36
|
||||
1064,784
|
||||
781,845
|
||||
1071,152
|
||||
1251,61
|
||||
455,500
|
||||
564,68
|
||||
758,798
|
||||
922,390
|
||||
443,421
|
||||
505,792
|
||||
60,784
|
||||
1059,645
|
||||
741,315
|
||||
89,164
|
||||
142,637
|
||||
348,705
|
||||
763,735
|
||||
165,686
|
||||
711,781
|
||||
1220,852
|
||||
455,120
|
||||
1205,859
|
||||
1208,413
|
||||
1098,240
|
||||
33,505
|
||||
821,208
|
||||
35,289
|
||||
1251,833
|
||||
1131,226
|
||||
745,730
|
||||
75,625
|
||||
905,75
|
||||
738,7
|
||||
1223,316
|
||||
923,395
|
||||
7,884
|
||||
1153,299
|
||||
552,96
|
||||
1047,134
|
||||
642,266
|
||||
537,698
|
||||
1211,190
|
||||
959,235
|
||||
1235,625
|
||||
711,614
|
||||
510,798
|
||||
73,306
|
||||
47,582
|
||||
657,875
|
||||
468,75
|
||||
638,346
|
||||
144,525
|
||||
612,665
|
||||
917,57
|
||||
1235,402
|
||||
211,249
|
||||
831,63
|
||||
1197,250
|
||||
493,686
|
||||
887,801
|
||||
85,315
|
||||
263,65
|
||||
924,306
|
||||
140,595
|
||||
997,141
|
||||
657,173
|
||||
579,850
|
||||
489,686
|
||||
448,5
|
||||
572,7
|
||||
1248,103
|
||||
445,674
|
||||
711,113
|
||||
1232,884
|
||||
1121,278
|
||||
845,732
|
||||
786,630
|
||||
114,712
|
||||
691,662
|
||||
140,147
|
||||
1088,299
|
||||
408,191
|
||||
897,691
|
||||
92,662
|
||||
904,754
|
||||
1309,621
|
||||
102,768
|
||||
7,10
|
||||
33,429
|
||||
903,803
|
||||
2,749
|
||||
1083,704
|
||||
157,819
|
||||
325,91
|
||||
830,386
|
||||
763,284
|
||||
175,63
|
||||
902,199
|
||||
887,129
|
||||
1285,297
|
||||
1287,683
|
||||
590,304
|
||||
714,716
|
||||
6,686
|
||||
1136,834
|
||||
452,889
|
||||
653,315
|
||||
135,145
|
||||
683,329
|
||||
251,473
|
||||
1110,455
|
||||
959,516
|
||||
1091,838
|
||||
407,220
|
||||
654,800
|
||||
549,239
|
||||
765,355
|
||||
113,250
|
||||
771,93
|
||||
194,270
|
||||
864,803
|
||||
517,417
|
||||
345,291
|
||||
253,724
|
||||
365,145
|
||||
522,624
|
||||
692,495
|
||||
830,834
|
||||
1021,301
|
||||
825,595
|
||||
145,890
|
||||
1125,481
|
||||
48,119
|
||||
82,7
|
||||
965,666
|
||||
540,630
|
||||
542,121
|
||||
731,290
|
||||
85,763
|
||||
957,297
|
||||
1277,617
|
||||
1089,239
|
||||
619,612
|
||||
62,175
|
||||
427,190
|
||||
401,724
|
||||
1133,798
|
||||
475,882
|
||||
1062,140
|
||||
246,784
|
||||
1001,515
|
||||
244,31
|
||||
759,171
|
||||
1246,282
|
||||
249,236
|
||||
919,816
|
||||
907,25
|
||||
755,403
|
||||
557,725
|
||||
15,332
|
||||
840,861
|
||||
1031,760
|
||||
965,218
|
||||
813,45
|
||||
440,829
|
||||
885,457
|
||||
45,243
|
||||
351,435
|
||||
191,565
|
||||
984,820
|
||||
715,275
|
||||
689,641
|
||||
289,845
|
||||
575,892
|
||||
605,822
|
||||
1136,508
|
||||
137,278
|
||||
870,513
|
||||
59,621
|
||||
79,539
|
||||
89,276
|
||||
1,621
|
||||
753,725
|
||||
1119,301
|
||||
1,763
|
||||
1159,539
|
||||
1059,25
|
||||
267,843
|
||||
1072,236
|
||||
1203,607
|
||||
425,453
|
||||
62,551
|
||||
788,624
|
||||
576,884
|
||||
326,430
|
||||
345,452
|
||||
539,473
|
||||
1195,337
|
||||
981,432
|
||||
23,683
|
||||
455,394
|
||||
1098,654
|
||||
1118,441
|
||||
1277,429
|
||||
567,625
|
||||
773,698
|
||||
23,459
|
||||
441,464
|
||||
870,488
|
||||
567,269
|
||||
517,399
|
||||
935,302
|
||||
436,875
|
||||
309,442
|
||||
900,191
|
||||
1277,277
|
||||
1310,165
|
||||
383,781
|
||||
149,792
|
||||
492,578
|
||||
88,658
|
||||
736,500
|
||||
103,275
|
||||
731,44
|
||||
720,794
|
||||
1278,600
|
||||
981,462
|
||||
1020,623
|
||||
329,462
|
||||
333,483
|
||||
977,880
|
||||
1181,863
|
||||
509,890
|
||||
846,831
|
||||
246,527
|
||||
570,754
|
||||
841,481
|
||||
78,884
|
||||
1231,355
|
||||
618,47
|
||||
413,719
|
||||
850,786
|
||||
174,386
|
||||
364,175
|
||||
1193,196
|
||||
162,421
|
||||
221,239
|
||||
373,875
|
||||
718,7
|
||||
1231,539
|
||||
1218,662
|
||||
333,868
|
||||
885,9
|
||||
30,149
|
||||
1299,511
|
||||
227,190
|
||||
1197,698
|
||||
1150,705
|
||||
657,238
|
||||
783,717
|
||||
1159,383
|
||||
212,688
|
||||
241,719
|
||||
618,495
|
||||
1232,458
|
||||
985,432
|
||||
27,75
|
||||
918,506
|
||||
328,800
|
||||
145,582
|
||||
387,395
|
||||
90,516
|
||||
1019,773
|
||||
334,574
|
||||
1285,149
|
||||
716,558
|
||||
413,236
|
||||
353,477
|
||||
607,193
|
||||
845,844
|
||||
874,875
|
||||
1099,648
|
||||
264,63
|
||||
99,491
|
||||
263,312
|
||||
303,67
|
||||
463,565
|
||||
433,239
|
||||
902,527
|
||||
132,355
|
||||
1300,550
|
||||
606,119
|
||||
291,849
|
||||
25,86
|
||||
301,865
|
||||
1046,831
|
||||
805,102
|
||||
408,598
|
||||
1101,693
|
||||
1215,864
|
||||
947,691
|
||||
64,730
|
||||
1237,170
|
||||
970,628
|
||||
1136,60
|
||||
947,730
|
||||
334,544
|
||||
1149,686
|
||||
1009,198
|
||||
691,282
|
||||
691,457
|
||||
378,142
|
||||
599,614
|
||||
648,320
|
||||
507,400
|
||||
1178,803
|
||||
478,558
|
||||
267,51
|
||||
279,701
|
||||
965,452
|
||||
691,232
|
||||
401,170
|
||||
219,838
|
||||
1292,413
|
||||
296,373
|
||||
246,127
|
||||
446,91
|
||||
894,86
|
||||
115,480
|
||||
1287,155
|
||||
433,655
|
||||
263,134
|
||||
87,630
|
||||
965,403
|
||||
107,623
|
||||
189,610
|
||||
330,749
|
||||
1121,271
|
||||
965,603
|
||||
135,749
|
||||
1059,473
|
||||
328,165
|
||||
27,147
|
||||
443,134
|
||||
1210,320
|
||||
1211,470
|
||||
415,824
|
||||
835,882
|
||||
405,819
|
||||
957,870
|
||||
493,721
|
||||
1246,164
|
||||
935,591
|
||||
895,824
|
||||
264,455
|
||||
99,470
|
||||
408,296
|
||||
803,400
|
||||
1084,126
|
||||
1135,63
|
||||
835,46
|
||||
830,60
|
||||
653,721
|
||||
1104,453
|
||||
525,863
|
||||
102,334
|
||||
1235,45
|
||||
870,121
|
||||
375,591
|
||||
60,336
|
||||
348,880
|
||||
895,600
|
||||
517,477
|
||||
427,526
|
||||
100,551
|
||||
37,301
|
||||
477,880
|
||||
0,94
|
||||
383,390
|
||||
266,718
|
||||
212,240
|
||||
634,329
|
||||
291,493
|
||||
976,320
|
||||
751,30
|
||||
1119,593
|
||||
443,753
|
||||
1099,645
|
||||
79,450
|
||||
189,278
|
||||
358,745
|
||||
870,355
|
||||
1064,820
|
||||
353,597
|
||||
770,630
|
||||
157,75
|
||||
22,371
|
||||
214,493
|
||||
465,726
|
||||
1205,655
|
||||
740,469
|
||||
125,49
|
||||
1019,849
|
||||
735,556
|
||||
1148,421
|
||||
832,336
|
||||
803,338
|
||||
848,441
|
||||
946,175
|
||||
301,149
|
||||
115,305
|
||||
528,215
|
||||
6,208
|
||||
6,320
|
||||
691,410
|
||||
238,658
|
||||
16,346
|
||||
735,892
|
||||
689,725
|
||||
661,320
|
||||
1136,386
|
||||
1153,810
|
||||
363,730
|
||||
326,464
|
||||
321,819
|
||||
885,885
|
||||
1048,388
|
||||
425,9
|
||||
127,809
|
||||
656,16
|
||||
599,280
|
||||
74,408
|
||||
387,509
|
||||
73,724
|
||||
293,877
|
||||
557,687
|
||||
656,878
|
||||
1304,320
|
||||
1034,865
|
||||
704,119
|
||||
126,663
|
||||
141,656
|
||||
914,859
|
||||
1230,647
|
||||
340,266
|
||||
33,501
|
||||
1262,352
|
||||
505,344
|
||||
1283,105
|
||||
1198,289
|
||||
855,500
|
||||
574,871
|
||||
540,598
|
||||
465,844
|
||||
1210,343
|
||||
825,96
|
||||
290,623
|
||||
174,508
|
||||
132,539
|
||||
867,93
|
||||
1101,201
|
||||
392,142
|
||||
472,126
|
||||
552,320
|
||||
631,739
|
||||
867,473
|
||||
763,758
|
||||
467,67
|
||||
251,269
|
||||
1273,301
|
||||
619,282
|
||||
1148,130
|
||||
801,4
|
||||
566,136
|
||||
1098,94
|
||||
1274,47
|
||||
333,411
|
||||
401,82
|
||||
48,352
|
||||
1230,522
|
||||
907,269
|
||||
870,829
|
||||
631,683
|
||||
406,660
|
||||
440,488
|
||||
800,798
|
||||
244,765
|
||||
657,768
|
||||
662,94
|
||||
33,465
|
||||
785,415
|
||||
83,450
|
||||
1159,355
|
||||
653,686
|
||||
392,730
|
||||
417,352
|
||||
691,829
|
||||
902,598
|
||||
947,282
|
||||
242,469
|
||||
135,301
|
||||
174,834
|
||||
816,189
|
||||
914,894
|
||||
671,562
|
||||
460,786
|
||||
1079,765
|
||||
125,525
|
||||
213,430
|
||||
480,60
|
||||
1086,390
|
||||
1111,809
|
||||
375,302
|
||||
1227,390
|
||||
1072,684
|
||||
343,494
|
||||
443,473
|
||||
904,234
|
||||
485,45
|
||||
1285,86
|
||||
977,299
|
||||
758,782
|
||||
242,425
|
||||
460,718
|
||||
37,593
|
||||
730,486
|
||||
559,877
|
||||
505,102
|
||||
401,812
|
||||
231,254
|
||||
403,269
|
||||
493,238
|
||||
1181,479
|
||||
189,29
|
||||
545,355
|
||||
264,439
|
||||
547,60
|
||||
900,695
|
||||
689,393
|
||||
1079,254
|
||||
408,199
|
||||
846,383
|
||||
1223,630
|
||||
1121,284
|
||||
345,666
|
||||
441,117
|
||||
237,800
|
||||
191,525
|
||||
1066,255
|
||||
552,768
|
||||
639,494
|
||||
798,705
|
||||
1004,189
|
||||
1169,861
|
||||
686,745
|
||||
1121,29
|
||||
554,126
|
||||
1277,465
|
||||
977,432
|
||||
711,399
|
||||
12,628
|
||||
|
||||
fold along x=655
|
||||
fold along y=447
|
||||
fold along x=327
|
||||
fold along y=223
|
||||
fold along x=163
|
||||
fold along y=111
|
||||
fold along x=81
|
||||
fold along y=55
|
||||
fold along x=40
|
||||
fold along y=27
|
||||
fold along y=13
|
||||
fold along y=6
|
21
Sources/Runner/Resources/input/13_test.txt
Normal file
21
Sources/Runner/Resources/input/13_test.txt
Normal file
@ -0,0 +1,21 @@
|
||||
6,10
|
||||
0,14
|
||||
9,10
|
||||
0,3
|
||||
10,4
|
||||
4,11
|
||||
6,0
|
||||
6,12
|
||||
4,1
|
||||
0,13
|
||||
10,12
|
||||
3,4
|
||||
3,0
|
||||
8,4
|
||||
1,10
|
||||
2,14
|
||||
8,10
|
||||
9,0
|
||||
|
||||
fold along y=7
|
||||
fold along x=5
|
102
Sources/Runner/Resources/input/14.txt
Normal file
102
Sources/Runner/Resources/input/14.txt
Normal file
@ -0,0 +1,102 @@
|
||||
FNFPPNKPPHSOKFFHOFOC
|
||||
|
||||
VS -> B
|
||||
SV -> C
|
||||
PP -> N
|
||||
NS -> N
|
||||
BC -> N
|
||||
PB -> F
|
||||
BK -> P
|
||||
NV -> V
|
||||
KF -> C
|
||||
KS -> C
|
||||
PV -> N
|
||||
NF -> S
|
||||
PK -> F
|
||||
SC -> F
|
||||
KN -> K
|
||||
PN -> K
|
||||
OH -> F
|
||||
PS -> P
|
||||
FN -> O
|
||||
OP -> B
|
||||
FO -> C
|
||||
HS -> F
|
||||
VO -> C
|
||||
OS -> B
|
||||
PF -> V
|
||||
SB -> V
|
||||
KO -> O
|
||||
SK -> N
|
||||
KB -> F
|
||||
KH -> C
|
||||
CC -> B
|
||||
CS -> C
|
||||
OF -> C
|
||||
FS -> B
|
||||
FP -> H
|
||||
VN -> O
|
||||
NB -> N
|
||||
BS -> H
|
||||
PC -> H
|
||||
OO -> F
|
||||
BF -> O
|
||||
HC -> P
|
||||
BH -> S
|
||||
NP -> P
|
||||
FB -> C
|
||||
CB -> H
|
||||
BO -> C
|
||||
NN -> V
|
||||
SF -> N
|
||||
FC -> F
|
||||
KK -> C
|
||||
CN -> N
|
||||
BV -> F
|
||||
FK -> C
|
||||
CF -> F
|
||||
VV -> B
|
||||
VF -> S
|
||||
CK -> C
|
||||
OV -> P
|
||||
NC -> N
|
||||
SS -> F
|
||||
NK -> V
|
||||
HN -> O
|
||||
ON -> P
|
||||
FH -> O
|
||||
OB -> H
|
||||
SH -> H
|
||||
NH -> V
|
||||
FF -> B
|
||||
HP -> B
|
||||
PO -> P
|
||||
HB -> H
|
||||
CH -> N
|
||||
SN -> P
|
||||
HK -> P
|
||||
FV -> H
|
||||
SO -> O
|
||||
VH -> V
|
||||
BP -> V
|
||||
CV -> P
|
||||
KP -> K
|
||||
VB -> N
|
||||
HV -> K
|
||||
SP -> N
|
||||
HO -> P
|
||||
CP -> H
|
||||
VC -> N
|
||||
CO -> S
|
||||
BN -> H
|
||||
NO -> B
|
||||
HF -> O
|
||||
VP -> K
|
||||
KV -> H
|
||||
KC -> F
|
||||
HH -> C
|
||||
BB -> K
|
||||
VK -> P
|
||||
OK -> C
|
||||
OC -> C
|
||||
PH -> H
|
18
Sources/Runner/Resources/input/14_test.txt
Normal file
18
Sources/Runner/Resources/input/14_test.txt
Normal file
@ -0,0 +1,18 @@
|
||||
NNCB
|
||||
|
||||
CH -> B
|
||||
HH -> N
|
||||
CB -> H
|
||||
NH -> C
|
||||
HB -> C
|
||||
HC -> B
|
||||
HN -> C
|
||||
NN -> C
|
||||
BH -> H
|
||||
NC -> B
|
||||
NB -> B
|
||||
BN -> B
|
||||
BB -> N
|
||||
BC -> B
|
||||
CC -> N
|
||||
CN -> C
|
100
Sources/Runner/Resources/input/15.txt
Normal file
100
Sources/Runner/Resources/input/15.txt
Normal file
@ -0,0 +1,100 @@
|
||||
4644191171337732143712186124233573969322319997149343221542323211321212169142231235619969739483792471
|
||||
2221293392911371411593639962951141752813313921357129613938931533621918583683134152965492646642538116
|
||||
2795791297555313411382761825567331471819212315341825911232943151936415218119321513121916912261697597
|
||||
1214537613992125712382233916937264885938549131332876391646112221213144242126287714516436119191917362
|
||||
1412811515321221111439182464221331329974283623974241113548427128422112192118983384463232121843121141
|
||||
3245255675412351991191259591561111991221265214221291175137165299373379821323142951719393624496355173
|
||||
7821636439137114454815234184431131151885565811162122141111291739141236111319913333811111656913241523
|
||||
1418191421242372241523343828141122624329116111754397113548982293191411111144261229944124833111847376
|
||||
1415223811928588114168213319591148928517427169381184991691112118229218263638951854741122722159931213
|
||||
1185112211216296846141231621592158511243111111346117648971911331811279689234291837116151264761299521
|
||||
2157175132842918592376386235452686111324627214122733298544113111534712212591393262313832165437912113
|
||||
1116112493319299432145649149992697711725421154424224312213396977142985512232427326338299642149836196
|
||||
6549229499212395113283291496151231611431251843344129142294319947252811251219755391642553173113821296
|
||||
4113393621316222283852914519968238256112711138455548538191592324236277743141198979959471862712168221
|
||||
1741128134354414241419176117119212641541117881955126161946213118193312324857619874348283423325548598
|
||||
3751141123712163925113282172764932353534116546231281293118591422522113149152261498874515989313554314
|
||||
4514551971341761251629465312511329291978512148461991612957411327621224192111126296379215871233811481
|
||||
3293217144136116298991343111524616863893234462111723531219141172273261192421911186619159615299151135
|
||||
7774221151285219996117174373446146141833811666627831912921211686311331622326641123291596353856612959
|
||||
1351122214751889195351764143332617127231529144667721221129811142151686112447161472232912114911498432
|
||||
7225121617125257598871963211815844737221578124248727132498851251391513323133165922818784851344161916
|
||||
1112187345141297179198141512813725433119213925696911577227241222816471151855194112221672612468122119
|
||||
1121991355992132552111213132191442529433379222141737721118515814411171128371158391185211772681121151
|
||||
3611317119849285611931216381814841117111553118123151123429121933733781431918246438319192543378241244
|
||||
2216973154335197135211535821482816136121216777138722357726122631253431191217262219637112927427564151
|
||||
5191998411823118893385217392312149124881216981988142455391121911741599925291712131939112984622594162
|
||||
9512532169823462117945393432541745813525811441272984121112552932917817923383181475411441151349226821
|
||||
3411874821911569271324123211326163841991128122341482721111115399651299314699266658849911711231323912
|
||||
7694685861132348951471861817731787685615352753172139744392721512255361251492221911127122613845334296
|
||||
1113697413329171211439739511931411924968888839312278319759419239814972811121854533399269742318264862
|
||||
3261667141191721233392311941113633191795822122212119221174142635691755551245192319949176814814316991
|
||||
2128111325114212336337636612529217112293426976253814989893331386522713418281571915911922457712133131
|
||||
8388911376618344994992583184752685539238543959953246364821659122425889299729352751111921721511272199
|
||||
2122155921932542114611151421752127825727141198197413114255419142717265333392684821477226612894862559
|
||||
1951121655921881375819253119554413525181757211271911799915211551299921612352952113953924955851737855
|
||||
8195214285611188396611335793711117151312316188149873422613973825989185924514991359346339783843843334
|
||||
5456833919619253912174733996922156217884375932117373542943268995816113232121789731392898427391181116
|
||||
4777217181611414812166144323146981138677578415811253842294432341423919922422381614691619319263292673
|
||||
1871985126952132273312531611829113511331968253631512251863889446196571436982662319393312117814312223
|
||||
4144118646856288731789179912621365532752715112255935546128459221171311137762973879129462196861223341
|
||||
5331743126787154471212425952845476245991112234222998154272399175132112413123715171136641911131729182
|
||||
6459321122282315131822523312117117212329381828311268157731316333126392285181951389374121861573611883
|
||||
1129519121932136168211173395152156158311198521161721877242125629612171323591229332881655592295117452
|
||||
4341822521595939622189164981116331219261274132118781411796193741169311918311822217877764111699911254
|
||||
4194536129171715722286327511111124828745972271325116713569374751324429292311753151131516413241834449
|
||||
2654142945631129956123367481172912142744199122191626922239395112592217148883514168932621184272178615
|
||||
4157713294921232144519182476441189526311311114777342965936356951743225131121191824416924178512318511
|
||||
6912411821531292292181267613662222516132574199134177394148798111514136319121566731314235317164439911
|
||||
1437321155329217229142678137571111359263414123211224312882335825119927798139832929124119648129273158
|
||||
1732391818138229589491914619358266961163398213919395213291514999415122435132113734813288381419819249
|
||||
4113346921421917866111857654393412952122411689932611554121571489921198684193331141319469559362897418
|
||||
3936181514241719511931294342174121311321234132821683441143221627121222912219121123417289754991212193
|
||||
5231211979311961116116212251613682828181291627731949883315367221227411122625338116897436595199253162
|
||||
2316316823133527186851941188913312213143341419114417621723676119643866413111512137248492799272283874
|
||||
3119192116842719272523136623911313937534137524214481191735181477319325633146114939176412112636323417
|
||||
2492714192521612141248169319193626151911919321234131296181642619511212191466114432116195132659299995
|
||||
8479281136811514162331236428357598113492342253565417152872842112725149934866538744331141447117166111
|
||||
8119623422439216225228196551954272643443171919589198617821835123212386869188415911424183945151334241
|
||||
2441131613411116653297822116736662114797231228699315262527411234919279976921765231169112216112919848
|
||||
3831541198992925558534136856443141276992238182251969817995131132423277612211112197312711991832328931
|
||||
4857223123934311294131922752993114976915557976818181275728832322272499252323121313288171744324765443
|
||||
6288391134124416473924343716745649381453218212143281127971317811511748813199842175114288225452114924
|
||||
2198193117421166796123194192539312141215519112972453238891813111365441112114115347214113916577619519
|
||||
4829218134763351139297321322168924116121484533211291255719399319238352153167888261311881156385931422
|
||||
1128131518795612511811698671411951513233914459321461852952978173818789621743591166392521464181816178
|
||||
1238497511773695513118432223193651911824333381942211111917892631655191328368558712842618374164192141
|
||||
5197814252643194532182168116535512142118911412974122512425237539834313411221165712489961923581131921
|
||||
5911812939579518465461451173198646171335111185511687173891229811734589488111952535421341871929712588
|
||||
1671651526181764772599923144212312319733142231365158737371635371423522142829181192112264525227179493
|
||||
7421112826829293192119831269314941212923232123538851869151292117144743917691154582417433994491521943
|
||||
9191346716972561945245244324428371279373282126116111451618129133112293262414113689369614111711445421
|
||||
2316166312199999129455391528271939493421961982164811491114318795721435615291362213311318321186121151
|
||||
9931241122891924292311432346646113846761512131981437311511562199358147246719196723818191337753291332
|
||||
1222114361952914555221222296169622784558836751121518966219244215831746229685414172141737963133114493
|
||||
5218313115227314139655246183769219129243229111742851151185617522413973822128342227812919165581163524
|
||||
9291132423113289278354324575153169229992171127124135461837121234526253159331631693469211222922141974
|
||||
8452363325897641925169932431428139199613218111915136812112119111995795222511113131372723121212711118
|
||||
2197227213274819481124191141229711865192112947469114147211523239645218213151193132942921122111792371
|
||||
9275351123144952331922211614314212365538513531132558123126944517881183166133275219943389521111173193
|
||||
1676123311913129662665831191951759436541912564748652528469419649571161712679147469912553225741913996
|
||||
3191353128953131423711131716711282864474834951441111829112836519349724223297611712534725619191814221
|
||||
4173761111187311916392959649155953281454675178259425336991997957211941375122951384157137917823346849
|
||||
6231866821187632943121892433531142499383519821114756411214331534451221651412644522124791217848229112
|
||||
4218513612717224329629361592483513734819131413112231512426831431594336223618413472242122315818213821
|
||||
1672513521112672575721281934545322131861691451188212512246411624946313848511278356324319145934746199
|
||||
7277435215413485681311177121429997231927125112162783124381311646223581365917794813269411132811948118
|
||||
1171256993195581123322244392112531112921826117456633951228891118213977135113912128736772927396511155
|
||||
7513423614827252911431224428129419471913857316347921811289615226221512981231328492565212872149824422
|
||||
4172392667172923414112281271468455913321542234539111143311488844993986926526232111912899467919673129
|
||||
2266423275271832192191927133161851111718244711617612592821169634215492721212529519332171925375214519
|
||||
2961251383676393331912784833198316856114611437958511134729539811313332428111416135419161136827381511
|
||||
2191313432414523594719493126599684313513119243281212311968932355513797175111911888954498999447129422
|
||||
4116222439791495331225415853138639142821696183279788473226912132161296116634441352242287514831641639
|
||||
2456122986411166492928291613291461786611191281413582887271831192125366139197116411714187313721143319
|
||||
3137321286181773323297599141911589613214333724715721771326962716833251289731121417114311929432923141
|
||||
4471591643429412532212412921891262226734323514259112982727616315933911299142522382749595219893774213
|
||||
8361434437271446111531163739832741723991191369215895121472249713859411711382822931149329516384858813
|
||||
7162151376995138977914242232912263921431263824116411237115179847816871745736216484215173821453691814
|
||||
1221412352976445211311141195476196991326389881615412212286967548955857131279126264116711124668334891
|
||||
6982434645865366398413542122219772368658463742631121963313814929811193197282524243293233246445611618
|
10
Sources/Runner/Resources/input/15_test.txt
Normal file
10
Sources/Runner/Resources/input/15_test.txt
Normal file
@ -0,0 +1,10 @@
|
||||
1163751742
|
||||
1381373672
|
||||
2136511328
|
||||
3694931569
|
||||
7463417111
|
||||
1319128137
|
||||
1359912421
|
||||
3125421639
|
||||
1293138521
|
||||
2311944581
|
1
Sources/Runner/Resources/input/16.txt
Normal file
1
Sources/Runner/Resources/input/16.txt
Normal file
@ -0,0 +1 @@
|
||||
020D708041258C0B4C683E61F674A1401595CC3DE669AC4FB7BEFEE840182CDF033401296F44367F938371802D2CC9801A980021304609C431007239C2C860400F7C36B005E446A44662A2805925FF96CBCE0033C5736D13D9CFCDC001C89BF57505799C0D1802D2639801A900021105A3A43C1007A1EC368A72D86130057401782F25B9054B94B003013EDF34133218A00D4A6F1985624B331FE359C354F7EB64A8524027D4DEB785CA00D540010D8E9132270803F1CA1D416200FDAC01697DCEB43D9DC5F6B7239CCA7557200986C013912598FF0BE4DFCC012C0091E7EFFA6E44123CE74624FBA01001328C01C8FF06E0A9803D1FA3343E3007A1641684C600B47DE009024ED7DD9564ED7DD940C017A00AF26654F76B5C62C65295B1B4ED8C1804DD979E2B13A97029CFCB3F1F96F28CE43318560F8400E2CAA5D80270FA1C90099D3D41BE00DD00010B893132108002131662342D91AFCA6330001073EA2E0054BC098804B5C00CC667B79727FF646267FA9E3971C96E71E8C00D911A9C738EC401A6CBEA33BC09B8015697BB7CD746E4A9FD4BB5613004BC01598EEE96EF755149B9A049D80480230C0041E514A51467D226E692801F049F73287F7AC29CB453E4B1FDE1F624100203368B3670200C46E93D13CAD11A6673B63A42600C00021119E304271006A30C3B844200E45F8A306C8037C9CA6FF850B004A459672B5C4E66A80090CC4F31E1D80193E60068801EC056498012804C58011BEC0414A00EF46005880162006800A3460073007B620070801E801073002B2C0055CEE9BC801DC9F5B913587D2C90600E4D93CE1A4DB51007E7399B066802339EEC65F519CF7632FAB900A45398C4A45B401AB8803506A2E4300004262AC13866401434D984CA4490ACA81CC0FB008B93764F9A8AE4F7ABED6B293330D46B7969998021C9EEF67C97BAC122822017C1C9FA0745B930D9C480
|
1
Sources/Runner/Resources/input/16_test.txt
Normal file
1
Sources/Runner/Resources/input/16_test.txt
Normal file
@ -0,0 +1 @@
|
||||
38006F45291200
|
1
Sources/Runner/Resources/input/17.txt
Normal file
1
Sources/Runner/Resources/input/17.txt
Normal file
@ -0,0 +1 @@
|
||||
target area: x=128..160, y=-142..-88
|
1
Sources/Runner/Resources/input/17_test.txt
Normal file
1
Sources/Runner/Resources/input/17_test.txt
Normal file
@ -0,0 +1 @@
|
||||
target area: x=20..30, y=-10..-5
|
38
Sources/Runner/Runner.swift
Normal file
38
Sources/Runner/Runner.swift
Normal file
@ -0,0 +1,38 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Max Nuding on 05.12.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public protocol Runnable {
|
||||
init(inputPath: String)
|
||||
func run()
|
||||
}
|
||||
|
||||
public struct Runner {
|
||||
let target: Runnable.Type
|
||||
let inputPath: String
|
||||
let day: String
|
||||
|
||||
public init(target: Runnable.Type, day: String, isTest: Bool = false) {
|
||||
let inputPath = isTest ? "\(day)_test" : day
|
||||
let input = Bundle.module.path(forResource: inputPath, ofType: ".txt")!
|
||||
self.inputPath = input
|
||||
self.target = target
|
||||
self.day = day
|
||||
}
|
||||
|
||||
public func run() {
|
||||
print("Starting day \(day)")
|
||||
let start = CFAbsoluteTimeGetCurrent()
|
||||
let runnable = target.init(inputPath: inputPath)
|
||||
runnable.run()
|
||||
let end = CFAbsoluteTimeGetCurrent()
|
||||
let execTimeMs = round((end - start) * 1000.0 * 100.0) / 100.0
|
||||
print("Finished in \(execTimeMs)ms")
|
||||
|
||||
}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
import Foundation
|
||||
//import Collections
|
||||
/*
|
||||
print("Starting day 01")
|
||||
let input01 = Bundle.module.path(forResource: "01", ofType: ".txt")!
|
||||
let start = CFAbsoluteTimeGetCurrent()
|
||||
Day01(inputPath: input01).run()
|
||||
let end = CFAbsoluteTimeGetCurrent()
|
||||
let execTimeMs = round((end - start) * 1000.0 * 100.0) / 100.0
|
||||
print("Finished in \(execTimeMs)ms")
|
||||
*/
|
||||
|
||||
/*
|
||||
print("Starting day 02")
|
||||
let input02 = Bundle.module.path(forResource: "02", ofType: ".txt")!
|
||||
let start = CFAbsoluteTimeGetCurrent()
|
||||
Day02(inputPath: input02).run()
|
||||
let end = CFAbsoluteTimeGetCurrent()
|
||||
let execTimeMs = round((end - start) * 1000.0 * 100.0) / 100.0
|
||||
print("Finished in \(execTimeMs)ms")
|
||||
*/
|
||||
|
||||
/*
|
||||
print("Starting day 03")
|
||||
let input03 = Bundle.module.path(forResource: "03", ofType: ".txt")!
|
||||
let start = CFAbsoluteTimeGetCurrent()
|
||||
Day03(inputPath: input03).run()
|
||||
let end = CFAbsoluteTimeGetCurrent()
|
||||
let execTimeMs = round((end - start) * 1000.0 * 100.0) / 100.0
|
||||
print("Finished in \(execTimeMs)ms")
|
||||
*/
|
||||
|
||||
/*
|
||||
print("Starting day 04")
|
||||
let input03 = Bundle.module.path(forResource: "04", ofType: ".txt")!
|
||||
let start = CFAbsoluteTimeGetCurrent()
|
||||
Day04(inputPath: input03).run()
|
||||
let end = CFAbsoluteTimeGetCurrent()
|
||||
let execTimeMs = round((end - start) * 1000.0 * 100.0) / 100.0
|
||||
print("Finished in \(execTimeMs)ms")
|
||||
*/
|
||||
|
||||
print("Starting day 05")
|
||||
let input03 = Bundle.module.path(forResource: "05", ofType: ".txt")!
|
||||
let start = CFAbsoluteTimeGetCurrent()
|
||||
Day05(inputPath: input03).run()
|
||||
let end = CFAbsoluteTimeGetCurrent()
|
||||
let execTimeMs = round((end - start) * 1000.0 * 100.0) / 100.0
|
||||
print("Finished in \(execTimeMs)ms")
|
||||
|
Reference in New Issue
Block a user