1
|
|
package com.adventofcode.day15 |
2
|
|
|
3
|
|
typealias StartingNumber = Int |
4
|
|
class MemoryGame(private val startingNumbers: List<StartingNumber>) { |
5
|
|
|
6
|
|
fun spokeNumberAtTurn(nthTurn: Int): Int { |
7
|
|
|
8
|
2
1. spokeNumberAtTurn : Replaced integer addition with subtraction → SURVIVED
2. spokeNumberAtTurn : Replaced integer addition with subtraction → KILLED
|
val spokenNumbers = startingNumbers.mapIndexed {index, it -> it to Pair(index+1,index+1) }.toMap().toMutableMap() |
9
|
|
|
10
|
5
1. spokeNumberAtTurn : changed conditional boundary → KILLED
2. spokeNumberAtTurn : Replaced integer addition with subtraction → KILLED
3. spokeNumberAtTurn : Replaced integer subtraction with addition → KILLED
4. spokeNumberAtTurn : negated conditional → KILLED
5. spokeNumberAtTurn : replaced int return with 0 for com/adventofcode/day15/MemoryGame::spokeNumberAtTurn → KILLED
|
if(nthTurn < startingNumbers.size +1) return startingNumbers[nthTurn-1] |
11
|
|
|
12
|
|
val firstNonStartingNumber=0 |
13
|
2
1. spokeNumberAtTurn : Replaced integer addition with subtraction → SURVIVED
2. spokeNumberAtTurn : negated conditional → KILLED
|
if(nthTurn == startingNumbers.size +1) { |
14
|
1
1. spokeNumberAtTurn : replaced int return with 0 for com/adventofcode/day15/MemoryGame::spokeNumberAtTurn → SURVIVED
|
return firstNonStartingNumber |
15
|
|
} |
16
|
|
|
17
|
2
1. spokeNumberAtTurn : Replaced integer addition with subtraction → KILLED
2. spokeNumberAtTurn : removed call to com/adventofcode/day15/MemoryGame::updateSpokenNumber → KILLED
|
updateSpokenNumber(spokenNumbers, firstNonStartingNumber, startingNumbers.size +1) |
18
|
|
|
19
|
|
var previousSpokenNumber=firstNonStartingNumber |
20
|
|
|
21
|
1
1. spokeNumberAtTurn : Replaced integer addition with subtraction → KILLED
|
(startingNumbers.size +2).rangeTo(nthTurn) |
22
|
|
.forEach{thisTurn -> |
23
|
|
|
24
|
|
val data= spokenNumbers[previousSpokenNumber]!! |
25
|
1
1. spokeNumberAtTurn : Replaced integer subtraction with addition → KILLED
|
val spokenNumber = data.second - data.first |
26
|
1
1. spokeNumberAtTurn : removed call to com/adventofcode/day15/MemoryGame::updateSpokenNumber → KILLED
|
updateSpokenNumber(spokenNumbers, spokenNumber, thisTurn) |
27
|
|
previousSpokenNumber=spokenNumber |
28
|
|
} |
29
|
|
|
30
|
|
|
31
|
1
1. spokeNumberAtTurn : replaced int return with 0 for com/adventofcode/day15/MemoryGame::spokeNumberAtTurn → KILLED
|
return previousSpokenNumber |
32
|
|
} |
33
|
|
|
34
|
|
private fun updateSpokenNumber(spokenNumbers: MutableMap<StartingNumber, Pair<Int, Int>>, spokenNumber: Int, thisTurn: Int) { |
35
|
1
1. updateSpokenNumber : negated conditional → KILLED
|
if (spokenNumbers.containsKey(spokenNumber)) { |
36
|
|
spokenNumbers[spokenNumber] = spokenNumbers[spokenNumber]!!.copy(first = spokenNumbers[spokenNumber]!!.second, second = thisTurn) |
37
|
|
} else { |
38
|
|
spokenNumbers[spokenNumber] = Pair(thisTurn, thisTurn) |
39
|
|
} |
40
|
|
} |
41
|
|
|
42
|
|
} |
| | Mutations |
8 |
|
1.1 Location : spokeNumberAtTurn Killed by : none Replaced integer addition with subtraction → SURVIVED 2.2 Location : spokeNumberAtTurn Killed by : com.adventofcode.day15.MemoryGameTest.[engine:junit-jupiter]/[class:com.adventofcode.day15.MemoryGameTest]/[test-factory:shouldFoundSpokenNumberAccordingTOPreviousUsageOfTheNumber()]/[dynamic-test:#6] Replaced integer addition with subtraction → KILLED
|
10 |
|
1.1 Location : spokeNumberAtTurn Killed by : com.adventofcode.day15.MemoryGameTest.[engine:junit-jupiter]/[class:com.adventofcode.day15.MemoryGameTest]/[test-factory:shouldFoundSpokenNumberAccordingTOPreviousUsageOfTheNumber()]/[dynamic-test:#4] changed conditional boundary → KILLED 2.2 Location : spokeNumberAtTurn Killed by : com.adventofcode.day15.MemoryGameTest.[engine:junit-jupiter]/[class:com.adventofcode.day15.MemoryGameTest]/[test-factory:shouldFoundSpokenNumberAccordingTOPreviousUsageOfTheNumber()]/[dynamic-test:#3] Replaced integer addition with subtraction → KILLED 3.3 Location : spokeNumberAtTurn Killed by : com.adventofcode.day15.MemoryGameTest.[engine:junit-jupiter]/[class:com.adventofcode.day15.MemoryGameTest]/[test-factory:shouldFoundSpokenNumberAccordingTOPreviousUsageOfTheNumber()]/[dynamic-test:#1] Replaced integer subtraction with addition → KILLED 4.4 Location : spokeNumberAtTurn Killed by : com.adventofcode.day15.MemoryGameTest.[engine:junit-jupiter]/[class:com.adventofcode.day15.MemoryGameTest]/[test-factory:shouldFoundSpokenNumberAccordingTOPreviousUsageOfTheNumber()]/[dynamic-test:#3] negated conditional → KILLED 5.5 Location : spokeNumberAtTurn Killed by : com.adventofcode.day15.MemoryGameTest.[engine:junit-jupiter]/[class:com.adventofcode.day15.MemoryGameTest]/[test-factory:shouldFoundSpokenNumberAccordingTOPreviousUsageOfTheNumber()]/[dynamic-test:#3] replaced int return with 0 for com/adventofcode/day15/MemoryGame::spokeNumberAtTurn → KILLED
|
13 |
|
1.1 Location : spokeNumberAtTurn Killed by : none Replaced integer addition with subtraction → SURVIVED 2.2 Location : spokeNumberAtTurn Killed by : com.adventofcode.day15.MemoryGameTest.[engine:junit-jupiter]/[class:com.adventofcode.day15.MemoryGameTest]/[test-factory:shouldFoundSpokenNumberAccordingTOPreviousUsageOfTheNumber()]/[dynamic-test:#6] negated conditional → KILLED
|
14 |
|
1.1 Location : spokeNumberAtTurn Killed by : none replaced int return with 0 for com/adventofcode/day15/MemoryGame::spokeNumberAtTurn → SURVIVED
|
17 |
|
1.1 Location : spokeNumberAtTurn Killed by : com.adventofcode.day15.MemoryGameTest.[engine:junit-jupiter]/[class:com.adventofcode.day15.MemoryGameTest]/[test-factory:shouldFoundSpokenNumberAccordingTOPreviousUsageOfTheNumber()]/[dynamic-test:#6] Replaced integer addition with subtraction → KILLED 2.2 Location : spokeNumberAtTurn Killed by : com.adventofcode.day15.MemoryGameTest.[engine:junit-jupiter]/[class:com.adventofcode.day15.MemoryGameTest]/[test-factory:shouldFoundSpokenNumberAccordingTOPreviousUsageOfTheNumber()]/[dynamic-test:#6] removed call to com/adventofcode/day15/MemoryGame::updateSpokenNumber → KILLED
|
21 |
|
1.1 Location : spokeNumberAtTurn Killed by : com.adventofcode.day15.MemoryGameTest.[engine:junit-jupiter]/[class:com.adventofcode.day15.MemoryGameTest]/[test-factory:shouldFoundSpokenNumberAccordingTOPreviousUsageOfTheNumber()]/[dynamic-test:#6] Replaced integer addition with subtraction → KILLED
|
25 |
|
1.1 Location : spokeNumberAtTurn Killed by : com.adventofcode.day15.MemoryGameTest.[engine:junit-jupiter]/[class:com.adventofcode.day15.MemoryGameTest]/[test-factory:shouldFoundSpokenNumberAccordingTOPreviousUsageOfTheNumber()]/[dynamic-test:#6] Replaced integer subtraction with addition → KILLED
|
26 |
|
1.1 Location : spokeNumberAtTurn Killed by : com.adventofcode.day15.MemoryGameTest.[engine:junit-jupiter]/[class:com.adventofcode.day15.MemoryGameTest]/[test-factory:shouldFoundSpokenNumberAccordingTOPreviousUsageOfTheNumber()]/[dynamic-test:#6] removed call to com/adventofcode/day15/MemoryGame::updateSpokenNumber → KILLED
|
31 |
|
1.1 Location : spokeNumberAtTurn Killed by : com.adventofcode.day15.MemoryGameTest.[engine:junit-jupiter]/[class:com.adventofcode.day15.MemoryGameTest]/[test-factory:shouldFoundSpokenNumberAccordingTOPreviousUsageOfTheNumber()]/[dynamic-test:#6] replaced int return with 0 for com/adventofcode/day15/MemoryGame::spokeNumberAtTurn → KILLED
|
35 |
|
1.1 Location : updateSpokenNumber Killed by : com.adventofcode.day15.MemoryGameTest.[engine:junit-jupiter]/[class:com.adventofcode.day15.MemoryGameTest]/[test-factory:shouldFoundSpokenNumberAccordingTOPreviousUsageOfTheNumber()]/[dynamic-test:#6] negated conditional → KILLED
|
47 |
|
1.1 Location : spokeNumberAtTurn Killed by : com.adventofcode.day15.MemoryGameTest.[engine:junit-jupiter]/[class:com.adventofcode.day15.MemoryGameTest]/[test-factory:shouldFoundSpokenNumberAccordingTOPreviousUsageOfTheNumber()]/[dynamic-test:#1] changed conditional boundary → KILLED 2.2 Location : spokeNumberAtTurn Killed by : com.adventofcode.day15.MemoryGameTest.[engine:junit-jupiter]/[class:com.adventofcode.day15.MemoryGameTest]/[test-factory:shouldFoundSpokenNumberAccordingTOPreviousUsageOfTheNumber()]/[dynamic-test:#1] Changed increment from 1 to -1 → KILLED 3.3 Location : spokeNumberAtTurn Killed by : com.adventofcode.day15.MemoryGameTest.[engine:junit-jupiter]/[class:com.adventofcode.day15.MemoryGameTest]/[test-factory:shouldFoundSpokenNumberAccordingTOPreviousUsageOfTheNumber()]/[dynamic-test:#1] negated conditional → KILLED 4.4 Location : spokeNumberAtTurn Killed by : none removed call to kotlin/collections/CollectionsKt::throwIndexOverflow → NO_COVERAGE
|