1
|
|
package com.adventofcode.day12 |
2
|
|
|
3
|
|
class SmartyPantsFerry( |
4
|
1
1. getPositionEastWest : replaced long return with 0 for com/adventofcode/day12/SmartyPantsFerry::getPositionEastWest → KILLED
|
override var positionEastWest: Long = 0L, |
5
|
1
1. getPositionNorthSouth : replaced long return with 0 for com/adventofcode/day12/SmartyPantsFerry::getPositionNorthSouth → KILLED
|
override var positionNorthSouth: Long = 0L) : Ferry { |
6
|
|
override var facing: Orientation = Orientation.E |
7
|
|
|
8
|
1
1. getWayPointEastWest : replaced long return with 0 for com/adventofcode/day12/SmartyPantsFerry::getWayPointEastWest → KILLED
|
var wayPointEastWest = 10L |
9
|
1
1. getWayPointNorthSouth : replaced long return with 0 for com/adventofcode/day12/SmartyPantsFerry::getWayPointNorthSouth → KILLED
|
var wayPointNorthSouth = 1L |
10
|
|
|
11
|
|
override fun followInstruction(instruction: String): Ferry { |
12
|
|
val action = instruction.take(1) |
13
|
|
val value = instruction.removeRange(0, 1).toLong() |
14
|
|
when (action) { |
15
|
1
1. followInstruction : Replaced long addition with subtraction → KILLED
|
"N" -> wayPointNorthSouth += value |
16
|
2
1. followInstruction : removed negation → KILLED
2. followInstruction : Replaced long addition with subtraction → KILLED
|
"S" -> wayPointNorthSouth += -value |
17
|
1
1. followInstruction : Replaced long addition with subtraction → KILLED
|
"E" -> wayPointEastWest += value |
18
|
2
1. followInstruction : removed negation → KILLED
2. followInstruction : Replaced long addition with subtraction → KILLED
|
"W" -> wayPointEastWest += -value |
19
|
1
1. followInstruction : removed call to com/adventofcode/day12/SmartyPantsFerry::turnRight → KILLED
|
"R" -> turnRight(value) |
20
|
1
1. followInstruction : removed call to com/adventofcode/day12/SmartyPantsFerry::turnLeft → KILLED
|
"L" -> turnLeft(value) |
21
|
1
1. followInstruction : removed call to com/adventofcode/day12/SmartyPantsFerry::goForward → KILLED
|
"F" -> goForward(value) |
22
|
|
} |
23
|
|
return this |
24
|
|
} |
25
|
|
|
26
|
|
override fun goForward(value: Long) { |
27
|
3
1. goForward : Replaced long multiplication with division → KILLED
2. goForward : Replaced long addition with subtraction → KILLED
3. goForward : removed call to com/adventofcode/day12/SmartyPantsFerry::setPositionNorthSouth → KILLED
|
positionNorthSouth += wayPointNorthSouth.times(value) |
28
|
3
1. goForward : Replaced long multiplication with division → KILLED
2. goForward : Replaced long addition with subtraction → KILLED
3. goForward : removed call to com/adventofcode/day12/SmartyPantsFerry::setPositionEastWest → KILLED
|
positionEastWest += wayPointEastWest.times(value) |
29
|
|
} |
30
|
|
|
31
|
|
override fun turnRight(value: Long) { |
32
|
1
1. turnRight : Replaced long division with multiplication → KILLED
|
val nbStep = Math.abs(value) / 90L |
33
|
|
|
34
|
|
val actualWayPoint = Pair(wayPointEastWest, wayPointNorthSouth) |
35
|
|
when (nbStep) { |
36
|
3
1. turnRight : removed negation → KILLED
2. turnRight : negated conditional → KILLED
3. turnRight : removed call to com/adventofcode/day12/SmartyPantsFerry::setWayPointTo → KILLED
|
1L -> setWayPointTo(actualWayPoint.second, actualWayPoint.first.unaryMinus()) |
37
|
4
1. turnRight : removed negation → KILLED
2. turnRight : removed negation → KILLED
3. turnRight : negated conditional → KILLED
4. turnRight : removed call to com/adventofcode/day12/SmartyPantsFerry::setWayPointTo → KILLED
|
2L -> setWayPointTo(actualWayPoint.first.unaryMinus(), actualWayPoint.second.unaryMinus()) |
38
|
3
1. turnRight : removed negation → KILLED
2. turnRight : negated conditional → KILLED
3. turnRight : removed call to com/adventofcode/day12/SmartyPantsFerry::setWayPointTo → KILLED
|
3L -> setWayPointTo(actualWayPoint.second.unaryMinus(), actualWayPoint.first) |
39
|
|
} |
40
|
|
} |
41
|
|
|
42
|
|
private fun setWayPointTo(positionEastWest: Long, positionNorthSouth: Long) { |
43
|
|
wayPointEastWest = positionEastWest |
44
|
|
wayPointNorthSouth = positionNorthSouth |
45
|
|
} |
46
|
|
|
47
|
|
override fun turnLeft(value: Long) { |
48
|
1
1. turnLeft : Replaced long division with multiplication → KILLED
|
val nbStep = Math.abs(value) / 90L |
49
|
|
when (nbStep) { |
50
|
2
1. turnLeft : negated conditional → KILLED
2. turnLeft : removed call to com/adventofcode/day12/SmartyPantsFerry::turnRight → KILLED
|
1L -> turnRight(270) |
51
|
2
1. turnLeft : negated conditional → KILLED
2. turnLeft : removed call to com/adventofcode/day12/SmartyPantsFerry::turnRight → KILLED
|
2L -> turnRight(180) |
52
|
2
1. turnLeft : negated conditional → KILLED
2. turnLeft : removed call to com/adventofcode/day12/SmartyPantsFerry::turnRight → KILLED
|
3L -> turnRight(90) |
53
|
|
} |
54
|
|
} |
55
|
|
|
56
|
|
override fun followInstructions(instructions: List<String>): Ferry { |
57
|
|
instructions.forEach { followInstruction(it) } |
58
|
|
return this |
59
|
|
} |
60
|
|
|
61
|
|
override fun distance(): Long = |
62
|
2
1. distance : Replaced long addition with subtraction → KILLED
2. distance : replaced long return with 0 for com/adventofcode/day12/SmartyPantsFerry::distance → KILLED
|
Math.abs(positionEastWest).plus(Math.abs(positionNorthSouth)) |
63
|
|
|
64
|
|
} |
| | Mutations |
4 |
|
1.1 Location : getPositionEastWest Killed by : com.adventofcode.day12.SmartyPantsTest.[engine:junit-jupiter]/[class:com.adventofcode.day12.SmartyPantsTest]/[method:shouldGiveThaManatthanDistance()] replaced long return with 0 for com/adventofcode/day12/SmartyPantsFerry::getPositionEastWest → KILLED
|
5 |
|
1.1 Location : getPositionNorthSouth Killed by : com.adventofcode.day12.SmartyPantsTest.[engine:junit-jupiter]/[class:com.adventofcode.day12.SmartyPantsTest]/[method:shouldGiveThaManatthanDistance()] replaced long return with 0 for com/adventofcode/day12/SmartyPantsFerry::getPositionNorthSouth → KILLED
|
8 |
|
1.1 Location : getWayPointEastWest Killed by : com.adventofcode.day12.SmartyPantsTest.[engine:junit-jupiter]/[class:com.adventofcode.day12.SmartyPantsTest]/[method:shouldStartFacingEastWithGivenWaypoint()] replaced long return with 0 for com/adventofcode/day12/SmartyPantsFerry::getWayPointEastWest → KILLED
|
9 |
|
1.1 Location : getWayPointNorthSouth Killed by : com.adventofcode.day12.SmartyPantsTest.[engine:junit-jupiter]/[class:com.adventofcode.day12.SmartyPantsTest]/[method:shouldStartFacingEastWithGivenWaypoint()] replaced long return with 0 for com/adventofcode/day12/SmartyPantsFerry::getWayPointNorthSouth → KILLED
|
15 |
|
1.1 Location : followInstruction Killed by : com.adventofcode.day12.SmartyPantsTest.[engine:junit-jupiter]/[class:com.adventofcode.day12.SmartyPantsTest]/[method:shouldGiveThaManatthanDistance()] Replaced long addition with subtraction → KILLED
|
16 |
|
1.1 Location : followInstruction Killed by : com.adventofcode.day12.Day12Test.[engine:junit-jupiter]/[class:com.adventofcode.day12.Day12Test]/[method:shouldComputePart02()] removed negation → KILLED 2.2 Location : followInstruction Killed by : com.adventofcode.day12.Day12Test.[engine:junit-jupiter]/[class:com.adventofcode.day12.Day12Test]/[method:shouldComputePart02()] Replaced long addition with subtraction → KILLED
|
17 |
|
1.1 Location : followInstruction Killed by : com.adventofcode.day12.Day12Test.[engine:junit-jupiter]/[class:com.adventofcode.day12.Day12Test]/[method:shouldComputePart02()] Replaced long addition with subtraction → KILLED
|
18 |
|
1.1 Location : followInstruction Killed by : com.adventofcode.day12.Day12Test.[engine:junit-jupiter]/[class:com.adventofcode.day12.Day12Test]/[method:shouldComputePart02()] removed negation → KILLED 2.2 Location : followInstruction Killed by : com.adventofcode.day12.Day12Test.[engine:junit-jupiter]/[class:com.adventofcode.day12.Day12Test]/[method:shouldComputePart02()] Replaced long addition with subtraction → KILLED
|
19 |
|
1.1 Location : followInstruction Killed by : com.adventofcode.day12.SmartyPantsTest.[engine:junit-jupiter]/[class:com.adventofcode.day12.SmartyPantsTest]/[method:shouldGiveThaManatthanDistance()] removed call to com/adventofcode/day12/SmartyPantsFerry::turnRight → KILLED
|
20 |
|
1.1 Location : followInstruction Killed by : com.adventofcode.day12.Day12Test.[engine:junit-jupiter]/[class:com.adventofcode.day12.Day12Test]/[method:shouldComputePart02()] removed call to com/adventofcode/day12/SmartyPantsFerry::turnLeft → KILLED
|
21 |
|
1.1 Location : followInstruction Killed by : com.adventofcode.day12.SmartyPantsTest.[engine:junit-jupiter]/[class:com.adventofcode.day12.SmartyPantsTest]/[method:shouldGiveThaManatthanDistance()] removed call to com/adventofcode/day12/SmartyPantsFerry::goForward → KILLED
|
27 |
|
1.1 Location : goForward Killed by : com.adventofcode.day12.SmartyPantsTest.[engine:junit-jupiter]/[class:com.adventofcode.day12.SmartyPantsTest]/[method:shouldGiveThaManatthanDistance()] Replaced long multiplication with division → KILLED 2.2 Location : goForward Killed by : com.adventofcode.day12.SmartyPantsTest.[engine:junit-jupiter]/[class:com.adventofcode.day12.SmartyPantsTest]/[method:shouldGiveThaManatthanDistance()] Replaced long addition with subtraction → KILLED 3.3 Location : goForward Killed by : com.adventofcode.day12.SmartyPantsTest.[engine:junit-jupiter]/[class:com.adventofcode.day12.SmartyPantsTest]/[method:shouldGiveThaManatthanDistance()] removed call to com/adventofcode/day12/SmartyPantsFerry::setPositionNorthSouth → KILLED
|
28 |
|
1.1 Location : goForward Killed by : com.adventofcode.day12.SmartyPantsTest.[engine:junit-jupiter]/[class:com.adventofcode.day12.SmartyPantsTest]/[method:shouldGiveThaManatthanDistance()] Replaced long multiplication with division → KILLED 2.2 Location : goForward Killed by : com.adventofcode.day12.SmartyPantsTest.[engine:junit-jupiter]/[class:com.adventofcode.day12.SmartyPantsTest]/[method:shouldGiveThaManatthanDistance()] Replaced long addition with subtraction → KILLED 3.3 Location : goForward Killed by : com.adventofcode.day12.SmartyPantsTest.[engine:junit-jupiter]/[class:com.adventofcode.day12.SmartyPantsTest]/[method:shouldGiveThaManatthanDistance()] removed call to com/adventofcode/day12/SmartyPantsFerry::setPositionEastWest → KILLED
|
32 |
|
1.1 Location : turnRight Killed by : com.adventofcode.day12.SmartyPantsTest.[engine:junit-jupiter]/[class:com.adventofcode.day12.SmartyPantsTest]/[method:shouldGiveThaManatthanDistance()] Replaced long division with multiplication → KILLED
|
36 |
|
1.1 Location : turnRight Killed by : com.adventofcode.day12.SmartyPantsTest.[engine:junit-jupiter]/[class:com.adventofcode.day12.SmartyPantsTest]/[method:shouldGiveThaManatthanDistance()] removed negation → KILLED 2.2 Location : turnRight Killed by : com.adventofcode.day12.SmartyPantsTest.[engine:junit-jupiter]/[class:com.adventofcode.day12.SmartyPantsTest]/[method:shouldGiveThaManatthanDistance()] negated conditional → KILLED 3.3 Location : turnRight Killed by : com.adventofcode.day12.SmartyPantsTest.[engine:junit-jupiter]/[class:com.adventofcode.day12.SmartyPantsTest]/[method:shouldGiveThaManatthanDistance()] removed call to com/adventofcode/day12/SmartyPantsFerry::setWayPointTo → KILLED
|
37 |
|
1.1 Location : turnRight Killed by : com.adventofcode.day12.Day12Test.[engine:junit-jupiter]/[class:com.adventofcode.day12.Day12Test]/[method:shouldComputePart02()] removed negation → KILLED 2.2 Location : turnRight Killed by : com.adventofcode.day12.Day12Test.[engine:junit-jupiter]/[class:com.adventofcode.day12.Day12Test]/[method:shouldComputePart02()] removed negation → KILLED 3.3 Location : turnRight Killed by : com.adventofcode.day12.Day12Test.[engine:junit-jupiter]/[class:com.adventofcode.day12.Day12Test]/[method:shouldComputePart02()] negated conditional → KILLED 4.4 Location : turnRight Killed by : com.adventofcode.day12.Day12Test.[engine:junit-jupiter]/[class:com.adventofcode.day12.Day12Test]/[method:shouldComputePart02()] removed call to com/adventofcode/day12/SmartyPantsFerry::setWayPointTo → KILLED
|
38 |
|
1.1 Location : turnRight Killed by : com.adventofcode.day12.Day12Test.[engine:junit-jupiter]/[class:com.adventofcode.day12.Day12Test]/[method:shouldComputePart02()] removed negation → KILLED 2.2 Location : turnRight Killed by : com.adventofcode.day12.Day12Test.[engine:junit-jupiter]/[class:com.adventofcode.day12.Day12Test]/[method:shouldComputePart02()] negated conditional → KILLED 3.3 Location : turnRight Killed by : com.adventofcode.day12.Day12Test.[engine:junit-jupiter]/[class:com.adventofcode.day12.Day12Test]/[method:shouldComputePart02()] removed call to com/adventofcode/day12/SmartyPantsFerry::setWayPointTo → KILLED
|
48 |
|
1.1 Location : turnLeft Killed by : com.adventofcode.day12.Day12Test.[engine:junit-jupiter]/[class:com.adventofcode.day12.Day12Test]/[method:shouldComputePart02()] Replaced long division with multiplication → KILLED
|
50 |
|
1.1 Location : turnLeft Killed by : com.adventofcode.day12.Day12Test.[engine:junit-jupiter]/[class:com.adventofcode.day12.Day12Test]/[method:shouldComputePart02()] negated conditional → KILLED 2.2 Location : turnLeft Killed by : com.adventofcode.day12.Day12Test.[engine:junit-jupiter]/[class:com.adventofcode.day12.Day12Test]/[method:shouldComputePart02()] removed call to com/adventofcode/day12/SmartyPantsFerry::turnRight → KILLED
|
51 |
|
1.1 Location : turnLeft Killed by : com.adventofcode.day12.Day12Test.[engine:junit-jupiter]/[class:com.adventofcode.day12.Day12Test]/[method:shouldComputePart02()] negated conditional → KILLED 2.2 Location : turnLeft Killed by : com.adventofcode.day12.Day12Test.[engine:junit-jupiter]/[class:com.adventofcode.day12.Day12Test]/[method:shouldComputePart02()] removed call to com/adventofcode/day12/SmartyPantsFerry::turnRight → KILLED
|
52 |
|
1.1 Location : turnLeft Killed by : com.adventofcode.day12.Day12Test.[engine:junit-jupiter]/[class:com.adventofcode.day12.Day12Test]/[method:shouldComputePart02()] negated conditional → KILLED 2.2 Location : turnLeft Killed by : com.adventofcode.day12.Day12Test.[engine:junit-jupiter]/[class:com.adventofcode.day12.Day12Test]/[method:shouldComputePart02()] removed call to com/adventofcode/day12/SmartyPantsFerry::turnRight → KILLED
|
62 |
|
1.1 Location : distance Killed by : com.adventofcode.day12.SmartyPantsTest.[engine:junit-jupiter]/[class:com.adventofcode.day12.SmartyPantsTest]/[method:shouldGiveThaManatthanDistance()] Replaced long addition with subtraction → KILLED 2.2 Location : distance Killed by : com.adventofcode.day12.SmartyPantsTest.[engine:junit-jupiter]/[class:com.adventofcode.day12.SmartyPantsTest]/[method:shouldGiveThaManatthanDistance()] replaced long return with 0 for com/adventofcode/day12/SmartyPantsFerry::distance → KILLED
|