🎄Advent of Code - Day 2 ✨ part 1
This commit is contained in:
parent
ca0ac85c40
commit
c58688c25c
7 changed files with 32 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
|||
package adventOfCode
|
||||
package AdventOfCode
|
||||
|
||||
interface Puzzle {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package adventOfCode2023.day1
|
||||
package AdventOfCode2023.day1
|
||||
|
||||
import adventOfCode.Puzzle
|
||||
import AdventOfCode.Puzzle
|
||||
|
||||
class Trebuchet : Puzzle {
|
||||
override fun partOne() {
|
|
@ -1,6 +1,6 @@
|
|||
package adventOfCode2023.day2
|
||||
package AdventOfCode2023.day2
|
||||
|
||||
import adventOfCode.Puzzle
|
||||
import AdventOfCode.Puzzle
|
||||
import java.util.Scanner
|
||||
|
||||
class CubeConundrum : Puzzle {
|
||||
|
@ -54,6 +54,29 @@ class CubeConundrum : Puzzle {
|
|||
}
|
||||
|
||||
override fun partTwo() {
|
||||
TODO("Not yet implemented")
|
||||
/*
|
||||
For each game, find the minimum set of cubes that must have been present.
|
||||
What is the sum of the power of these sets?
|
||||
*/
|
||||
val games = getGameList();
|
||||
var gamePower = 0
|
||||
val gameMaxConstraints = mapOf(
|
||||
"red" to 12,
|
||||
"green" to 13,
|
||||
"blue" to 14
|
||||
)
|
||||
games.forEach {
|
||||
|
||||
it.gameData?.forEach { gameData ->
|
||||
val cubes = gameData.split(",")
|
||||
cubes.forEach cubeForEach@ { cubeSet ->
|
||||
val cubeData = cubeSet.trim().split(" ")
|
||||
println()
|
||||
}
|
||||
}
|
||||
|
||||
gamePower = 0
|
||||
}
|
||||
println("The sum of the game ids is $gamePower.")
|
||||
}
|
||||
}
|
|
@ -1,3 +1,3 @@
|
|||
package adventOfCode2023.day2
|
||||
package AdventOfCode2023.day2
|
||||
|
||||
data class Game(var id: Int, var gameData: List<String>?)
|
|
@ -1,7 +1,7 @@
|
|||
import adventOfCode2023.day2.CubeConundrum
|
||||
import AdventOfCode2023.day2.CubeConundrum
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val t = CubeConundrum()
|
||||
t.partOne()
|
||||
// t.partTwo()
|
||||
// t.partTwo()
|
||||
}
|
Loading…
Reference in a new issue