1 | package com.takenoko.bot.utils.pathfinding.panda; | |
2 | ||
3 | import com.takenoko.engine.Board; | |
4 | import com.takenoko.engine.BotState; | |
5 | import com.takenoko.objective.PandaObjective; | |
6 | import com.takenoko.vector.PositionVector; | |
7 | import java.util.List; | |
8 | import java.util.Map; | |
9 | import java.util.stream.Collectors; | |
10 | import org.apache.commons.lang3.tuple.Pair; | |
11 | ||
12 | public class PandaPathfinding { | |
13 | private PandaPathfinding() {} | |
14 | ||
15 | public static Map<PandaObjective, List<PositionVector>> getPandaMoves( | |
16 | Board board, BotState botState) { | |
17 |
1
1. getPandaMoves : replaced return value with Collections.emptyMap for com/takenoko/bot/utils/pathfinding/panda/PandaPathfinding::getPandaMoves → KILLED |
return botState.getNotAchievedObjectives().stream() |
18 | .filter(PandaObjective.class::isInstance) | |
19 | .map(PandaObjective.class::cast) | |
20 | .distinct() | |
21 | .map( | |
22 | pandaObjective -> | |
23 |
1
1. lambda$getPandaMoves$3 : replaced return value with null for com/takenoko/bot/utils/pathfinding/panda/PandaPathfinding::lambda$getPandaMoves$3 → KILLED |
Pair.of( |
24 | pandaObjective, | |
25 | pandaObjective | |
26 | .getWhereToEatToComplete(board, botState) | |
27 | .stream() | |
28 | .filter( | |
29 | positionToEat -> | |
30 |
2
1. lambda$getPandaMoves$1 : replaced boolean return with false for com/takenoko/bot/utils/pathfinding/panda/PandaPathfinding::lambda$getPandaMoves$1 → KILLED 2. lambda$getPandaMoves$1 : replaced boolean return with true for com/takenoko/bot/utils/pathfinding/panda/PandaPathfinding::lambda$getPandaMoves$1 → KILLED |
board |
31 | .getPandaPossibleMoves() | |
32 | .stream() | |
33 | // convert move position to | |
34 | // absolute position | |
35 | .map( | |
36 | pandaMove -> | |
37 |
1
1. lambda$getPandaMoves$0 : replaced return value with null for com/takenoko/bot/utils/pathfinding/panda/PandaPathfinding::lambda$getPandaMoves$0 → KILLED |
board.getPandaPosition() |
38 | .add( | |
39 | pandaMove) | |
40 | .toPositionVector()) | |
41 | // check if the move is | |
42 | // possible | |
43 | .toList() | |
44 | .contains(positionToEat)) | |
45 | .map( | |
46 | positionToEat -> | |
47 |
1
1. lambda$getPandaMoves$2 : replaced return value with null for com/takenoko/bot/utils/pathfinding/panda/PandaPathfinding::lambda$getPandaMoves$2 → KILLED |
positionToEat |
48 | .sub( | |
49 | board.getPandaPosition() | |
50 | .toPositionVector()) | |
51 | .toPositionVector()) | |
52 | .toList())) | |
53 |
2
1. lambda$getPandaMoves$4 : replaced boolean return with true for com/takenoko/bot/utils/pathfinding/panda/PandaPathfinding::lambda$getPandaMoves$4 → TIMED_OUT 2. lambda$getPandaMoves$4 : negated conditional → KILLED |
.filter(v -> !v.getValue().isEmpty()) |
54 | .collect(Collectors.toMap(Pair::getKey, Pair::getValue)); | |
55 | } | |
56 | ||
57 | public static List<PositionVector> getPandaMovesThatEatBamboo(Board board) { | |
58 |
1
1. getPandaMovesThatEatBamboo : replaced return value with Collections.emptyList for com/takenoko/bot/utils/pathfinding/panda/PandaPathfinding::getPandaMovesThatEatBamboo → TIMED_OUT |
return board.getPandaPossibleMoves().stream() |
59 | .filter( | |
60 | pandaMove -> | |
61 |
2
1. lambda$getPandaMovesThatEatBamboo$5 : replaced boolean return with false for com/takenoko/bot/utils/pathfinding/panda/PandaPathfinding::lambda$getPandaMovesThatEatBamboo$5 → TIMED_OUT 2. lambda$getPandaMovesThatEatBamboo$5 : replaced boolean return with true for com/takenoko/bot/utils/pathfinding/panda/PandaPathfinding::lambda$getPandaMovesThatEatBamboo$5 → TIMED_OUT |
board.isBambooEatableAt( |
62 | board.getPandaPosition().add(pandaMove).toPositionVector())) | |
63 | .toList(); | |
64 | } | |
65 | } | |
Mutations | ||
17 |
1.1 |
|
23 |
1.1 |
|
30 |
1.1 2.2 |
|
37 |
1.1 |
|
47 |
1.1 |
|
53 |
1.1 2.2 |
|
58 |
1.1 |
|
61 |
1.1 2.2 |