🎄Advent of Code - Day 2 part 1

This commit is contained in:
Denis-Cosmin Nutiu 2023-12-02 12:18:46 +02:00
parent ca0ac85c40
commit c58688c25c
7 changed files with 32 additions and 9 deletions

View file

@ -1,4 +1,4 @@
package adventOfCode
package AdventOfCode
interface Puzzle {

View file

@ -1,6 +1,6 @@
package adventOfCode2023.day1
package AdventOfCode2023.day1
import adventOfCode.Puzzle
import AdventOfCode.Puzzle
class Trebuchet : Puzzle {
override fun partOne() {

View file

@ -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.")
}
}

View file

@ -1,3 +1,3 @@
package adventOfCode2023.day2
package AdventOfCode2023.day2
data class Game(var id: Int, var gameData: List<String>?)

View file

@ -1,4 +1,4 @@
import adventOfCode2023.day2.CubeConundrum
import AdventOfCode2023.day2.CubeConundrum
fun main(args: Array<String>) {
val t = CubeConundrum()