Skip to content

Package: MuenzwurfChooseEdgeStrategy

MuenzwurfChooseEdgeStrategy

nameinstructionbranchcomplexitylinemethod
MuenzwurfChooseEdgeStrategy(MuenzwurfMoveFactory)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
computeNextMove(int, MuenzwurfPlayer, MuenzwurfState, long)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
toString()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * Copyright © 2021-2023 Fachhochschule für die Wirtschaft (FHDW) Hannover
3: *
4: * This file is part of ipspiel24-demo.
5: *
6: * Ipspiel24-demo is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
7: * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
8: * version.
9: *
10: * Ipspiel24-demo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
11: * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12: *
13: * You should have received a copy of the GNU General Public License along with ipspiel24-demo. If not, see
14: * <http://www.gnu.org/licenses/>.
15: */
16: package de.fhdw.gaming.ipspiel24.muenzwurf.core.strategy;
17:
18: import java.util.Optional;
19:
20: import de.fhdw.gaming.ipspiel24.muenzwurf.core.domain.MuenzwurfPlayer;
21: import de.fhdw.gaming.ipspiel24.muenzwurf.core.domain.MuenzwurfState;
22: import de.fhdw.gaming.ipspiel24.muenzwurf.core.domain.MuenzwurfStrategy;
23: import de.fhdw.gaming.ipspiel24.muenzwurf.core.moves.MuenzwurfMove;
24: import de.fhdw.gaming.ipspiel24.muenzwurf.core.moves.factory.MuenzwurfMoveFactory;
25:
26: /**
27: * Implements {@link DemoStrategy} by always choosing Edge.
28: */
29: public final class MuenzwurfChooseEdgeStrategy implements MuenzwurfStrategy {
30:
31: /**
32: * The factory for creating Demo moves.
33: */
34: private final MuenzwurfMoveFactory moveFactory;
35:
36: /**
37: * Creates an {@link MuenzwurfChooseEdgeStrategy}.
38: *
39: * @param moveFactory The factory for creating Demo moves.
40: */
41: MuenzwurfChooseEdgeStrategy(final MuenzwurfMoveFactory moveFactory) {
42: this.moveFactory = moveFactory;
43: }
44:
45: @Override
46: public Optional<MuenzwurfMove> computeNextMove(
47: final int gameId,
48: final MuenzwurfPlayer player,
49: final MuenzwurfState state,
50: final long maxComputationTimePerMove) {
51: return Optional.of(this.moveFactory.createEdgeMove());
52: }
53:
54: @Override
55: public String toString() {
56: return MuenzwurfChooseEdgeStrategy.class.getSimpleName();
57: }
58: }