File tree Expand file tree Collapse file tree 2 files changed +2
-28
lines changed
aoc17/src/main/kotlin/de/havox_design/aoc2022/day17 Expand file tree Collapse file tree 2 files changed +2
-28
lines changed Original file line number Diff line number Diff line change @@ -16,37 +16,11 @@ class Chamber(var width: Long = 7L) {
1616 }
1717
1818 fun addRockToObstaclesIfItCollides (rock : Rock , position : Position , direction : Jet ): Boolean {
19- var realDirection = direction
2019 val rockBlockers = rock
2120 .getBlockedPositions()
2221 .map { pos -> pos + position }
2322 .toList()
24-
25- // We cannot be blown out of the tunnel
26- if (
27- (
28- direction == Jet .LEFT
29- && (
30- rockBlockers
31- .any { pos -> pos.x == 0L }
32- || rockBlockers
33- .map { pos -> pos + Position .getPositionForJet(Jet .LEFT ) }
34- .any { pos -> obstacles.contains(pos) }
35- )
36- )
37- || (
38- direction == Jet .RIGHT
39- && (
40- rockBlockers
41- .any { pos -> pos.x == width - 1 }
42- || rockBlockers
43- .map { pos -> pos + Position .getPositionForJet(Jet .RIGHT ) }
44- .any { pos -> obstacles.contains(pos) }
45- )
46- )
47- ) {
48- realDirection = Jet .UNKNOWN
49- }
23+ val realDirection = getRealDirection(rock, position, direction)
5024
5125 // Do we collide with floor or another stone?
5226 if (
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ plugins {
44
55// project meta data
66group ' de.havox_design.aoc2022'
7- version ' 0.17.7 '
7+ version ' 0.17.8 '
88
99// Switch to gradle "all" distribution.
1010wrapper {
You can’t perform that action at this time.
0 commit comments