Skip to content

Package: VGStrategyEins

VGStrategyEins

nameinstructionbranchcomplexitylinemethod
VGStrategyEins(VGMoveFactory)
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, VGPlayer, VGState)
M: 0 C: 17
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
toString()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: package de.fhdw.gaming.ipspiel22.VGStrategyEins.strategy;
2:
3: import java.util.Optional;
4:
5: import de.fhdw.gaming.core.domain.GameException;
6: import de.fhdw.gaming.ipspiel22.searchtree.algorithm.MinMaxAlgorithm;
7: import de.fhdw.gaming.ipspiel22.vierGewinnt.domain.VGPlayer;
8: import de.fhdw.gaming.ipspiel22.vierGewinnt.domain.VGState;
9: import de.fhdw.gaming.ipspiel22.vierGewinnt.domain.VGStrategy;
10: import de.fhdw.gaming.ipspiel22.vierGewinnt.moves.VGMove;
11: import de.fhdw.gaming.ipspiel22.vierGewinnt.moves.factory.VGMoveFactory;
12:
13: /**
14: * VGStrategyEins.
15: *
16: * @author DonPablo
17: *
18: */
19: public class VGStrategyEins implements VGStrategy {
20:
21: /**
22: * VGMoveFactory.
23: */
24: private final VGMoveFactory movesFactory;
25:
26: /**
27: * VGStrategyEins Constructor.
28: *
29: * @param moveFactory
30: */
31: public VGStrategyEins(final VGMoveFactory moveFactory) {
32: this.movesFactory = moveFactory;
33: }
34:
35: @Override
36: public Optional<VGMove> computeNextMove(final int gameId, final VGPlayer player, final VGState state)
37: throws GameException, InterruptedException {
38: final Bewertung vgGame = new Bewertung(player, state, movesFactory);
39: final MinMaxAlgorithm<VGPlayer, VGState, VGMove, Bewertung> vg = new MinMaxAlgorithm<>(vgGame);
40: return vg.getBestMove(5);
41: }
42:
43: @Override
44: public String toString() {
45: return VGStrategyEins.class.getSimpleName();
46: }
47:
48: }