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