| 1 | package com.takenoko.bot.unitary; | |
| 2 | ||
| 3 | import com.takenoko.actions.actors.MoveGardenerAction; | |
| 4 | import com.takenoko.actions.bamboo.GrowBambooAction; | |
| 5 | import com.takenoko.bot.PriorityBot; | |
| 6 | import com.takenoko.bot.utils.pathfinding.gardener.GardenerPathfinding; | |
| 7 | import com.takenoko.engine.Board; | |
| 8 | import com.takenoko.engine.BotState; | |
| 9 | import com.takenoko.engine.History; | |
| 10 | import com.takenoko.objective.MultipleGardenerObjective; | |
| 11 | import com.takenoko.objective.Objective; | |
| 12 | import com.takenoko.objective.SingleGardenerObjective; | |
| 13 | import com.takenoko.vector.PositionVector; | |
| 14 | import java.util.List; | |
| 15 | import java.util.Map; | |
| 16 | ||
| 17 | public class SmartGardener extends PriorityBot { | |
| 18 | ||
| 19 | @Override | |
| 20 | protected void fillAction(Board board, BotState botState, History history) { | |
| 21 | Map<Objective, List<PositionVector>> completionMap = | |
| 22 | GardenerPathfinding.getGardenerMoves(board, botState); | |
| 23 |
2
1. fillAction : changed conditional boundary → TIMED_OUT 2. fillAction : negated conditional → TIMED_OUT |
if (completionMap.size() > 0) { |
| 24 | for (Entry<Objective, List<PositionVector>> objective : completionMap.entrySet()) { | |
| 25 | for (PositionVector position : objective.getValue()) { | |
| 26 |
1
1. fillAction : removed call to com/takenoko/bot/unitary/SmartGardener::addActionWithPriority → SURVIVED |
this.addActionWithPriority( |
| 27 | new MoveGardenerAction(position), | |
| 28 |
1
1. fillAction : Replaced double division with multiplication → SURVIVED |
objective.getKey().getPoints() / (double) objective.getValue().size()); |
| 29 | } | |
| 30 | } | |
| 31 | } | |
| 32 | ||
| 33 | botState.getNotAchievedObjectives().stream() | |
| 34 |
2
1. lambda$fillAction$0 : negated conditional → KILLED 2. lambda$fillAction$0 : replaced boolean return with true for com/takenoko/bot/unitary/SmartGardener::lambda$fillAction$0 → KILLED |
.filter(v -> (v.getClass() == SingleGardenerObjective.class)) |
| 35 | .distinct() | |
| 36 |
1
1. lambda$fillAction$1 : replaced return value with Collections.emptyList for com/takenoko/bot/unitary/SmartGardener::lambda$fillAction$1 → TIMED_OUT |
.map(v -> ((SingleGardenerObjective) v).getPositionsToComplete(board)) |
| 37 | .flatMap(List::stream) | |
| 38 | .filter(board::isBambooGrowableAt) | |
| 39 |
2
1. lambda$fillAction$2 : removed call to com/takenoko/bot/unitary/SmartGardener::addActionWithPriority → SURVIVED 2. fillAction : removed call to java/util/stream/Stream::forEach → TIMED_OUT |
.forEach(v -> addActionWithPriority(new GrowBambooAction(v), DEFAULT_PRIORITY)); |
| 40 | ||
| 41 | botState.getNotAchievedObjectives().stream() | |
| 42 |
2
1. lambda$fillAction$3 : negated conditional → KILLED 2. lambda$fillAction$3 : replaced boolean return with true for com/takenoko/bot/unitary/SmartGardener::lambda$fillAction$3 → KILLED |
.filter(v -> (v.getClass() == MultipleGardenerObjective.class)) |
| 43 | .distinct() | |
| 44 |
1
1. lambda$fillAction$4 : replaced return value with Collections.emptyList for com/takenoko/bot/unitary/SmartGardener::lambda$fillAction$4 → TIMED_OUT |
.map(v -> ((MultipleGardenerObjective) v).getPositionsToComplete(board)) |
| 45 | .flatMap(List::stream) | |
| 46 | .filter(board::isBambooGrowableAt) | |
| 47 |
2
1. lambda$fillAction$5 : removed call to com/takenoko/bot/unitary/SmartGardener::addActionWithPriority → NO_COVERAGE 2. fillAction : removed call to java/util/stream/Stream::forEach → TIMED_OUT |
.forEach(v -> addActionWithPriority(new GrowBambooAction(v), DEFAULT_PRIORITY)); |
| 48 | } | |
| 49 | } | |
Mutations | ||
| 23 |
1.1 2.2 |
|
| 26 |
1.1 |
|
| 28 |
1.1 |
|
| 34 |
1.1 2.2 |
|
| 36 |
1.1 |
|
| 39 |
1.1 2.2 |
|
| 42 |
1.1 2.2 |
|
| 44 |
1.1 |
|
| 47 |
1.1 2.2 |