This commit is contained in:
parent
f16258eae7
commit
0f2b85f2ad
@ -2,7 +2,7 @@
|
|||||||
import java.util.Scanner
|
import java.util.Scanner
|
||||||
|
|
||||||
|
|
||||||
class TrailHead(private val x: Int, private val y: Int, private val map: Map) {
|
class TrailHead(private val x: Int, private val y: Int, private val map: Map) {
|
||||||
private val peaks = mutableMapOf<Pair<Int, Int>, Int>()
|
private val peaks = mutableMapOf<Pair<Int, Int>, Int>()
|
||||||
fun getScore(): Int {
|
fun getScore(): Int {
|
||||||
if (this.peaks.isEmpty()) {
|
if (this.peaks.isEmpty()) {
|
||||||
@ -28,9 +28,9 @@ import java.util.Scanner
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Map(private val grid: List<List<Int>>) {
|
class Map(private val grid: List<List<Int>>) {
|
||||||
private val trailHeads = mutableListOf<TrailHead>()
|
private val trailHeads = mutableListOf<TrailHead>()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@ -66,7 +66,7 @@ import java.util.Scanner
|
|||||||
fun getGetRating(): Int {
|
fun getGetRating(): Int {
|
||||||
return trailHeads.fold(0) { acc, trailHead -> acc + trailHead.getGetRating() }
|
return trailHeads.fold(0) { acc, trailHead -> acc + trailHead.getGetRating() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
val scanner = Scanner(System.`in`)
|
val scanner = Scanner(System.`in`)
|
||||||
|
Loading…
Reference in New Issue
Block a user