Archived
Compare commits
4
Commits
2136bc59e4
...
cf1fe949f6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf1fe949f6 | ||
|
|
44055b2260 | ||
|
|
7570da8191 | ||
|
|
aba4b17e18 |
+2
-2
@@ -12,8 +12,8 @@ import (
|
||||
func Run() {
|
||||
draws, boards := readInput()
|
||||
|
||||
fmt.Printf("1st winning board: %d\n", calculateWinningBoard(findFirstWinningBoard(boards, createPlayboards(boards), draws)))
|
||||
fmt.Printf("2nd winning board: %d\n", calculateWinningBoard(findLastWinningBoard(boards, createPlayboards(boards), draws)))
|
||||
fmt.Printf("1st winning board 🥇: %d\n", calculateWinningBoard(findFirstWinningBoard(boards, createPlayboards(boards), draws)))
|
||||
fmt.Printf("2nd winning board 🥈: %d\n", calculateWinningBoard(findLastWinningBoard(boards, createPlayboards(boards), draws)))
|
||||
}
|
||||
|
||||
func calculateWinningBoard(board [][]int, playboard [][]bool, draw int) int {
|
||||
|
||||
+2
-2
@@ -9,8 +9,8 @@ import (
|
||||
)
|
||||
|
||||
func Run() {
|
||||
fmt.Printf("1st solution: %d\n", solveFirst())
|
||||
fmt.Printf("2nd solution: %d\n", solveSecond())
|
||||
fmt.Printf("1st solution 🔊: %d\n", solveFirst())
|
||||
fmt.Printf("2nd solution 🔊: %d\n", solveSecond())
|
||||
}
|
||||
|
||||
func readInput() []int {
|
||||
|
||||
+2
-2
@@ -12,8 +12,8 @@ import (
|
||||
func Run() {
|
||||
values := readInput()
|
||||
heatmap := createHeatmap(values)
|
||||
fmt.Printf("power: %d\n", calcPower(calcGamma(heatmap, len(values)), calcEpsilon(heatmap, len(values))))
|
||||
fmt.Printf("oxygen * co2 (life support): %d\n", calcOxygen(values)*calcCO2(values))
|
||||
fmt.Printf("power 🔋: %d\n", calcPower(calcGamma(heatmap, len(values)), calcEpsilon(heatmap, len(values))))
|
||||
fmt.Printf("life support 🌱 (oxygen * co2): %d\n", calcOxygen(values)*calcCO2(values))
|
||||
}
|
||||
|
||||
func calcOxygen(values [][]int) int {
|
||||
|
||||
+2
-2
@@ -11,8 +11,8 @@ import (
|
||||
|
||||
func Run() {
|
||||
commands := readInput()
|
||||
fmt.Printf("1st final position: %d\n", solve(commands, false))
|
||||
fmt.Printf("2nd final position: %d\n", solve(commands, true))
|
||||
fmt.Printf("1st final position 🛰️: %d\n", solve(commands, false))
|
||||
fmt.Printf("2nd final position 🛰️: %d\n", solve(commands, true))
|
||||
}
|
||||
|
||||
func solve(commands []string, alt bool) int {
|
||||
|
||||
Reference in New Issue
Block a user