Skip to content

Package: HTHeadsStrategy

HTHeadsStrategy

nameinstructionbranchcomplexitylinemethod
HTHeadsStrategy(IHTMoveFactory)
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
computeNextMove(int, IHTPlayer, IHTState)
M: 0 C: 5
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.ipspiel23.ht.strategy.impl.heads;
2:
3: import java.util.Optional;
4:
5: import de.fhdw.gaming.core.domain.GameException;
6: import de.fhdw.gaming.ipspiel23.ht.domain.IHTPlayer;
7: import de.fhdw.gaming.ipspiel23.ht.domain.IHTState;
8: import de.fhdw.gaming.ipspiel23.ht.moves.IHTMove;
9: import de.fhdw.gaming.ipspiel23.ht.moves.factory.IHTMoveFactory;
10: import de.fhdw.gaming.ipspiel23.ht.strategy.impl.HTStrategy;
11:
12: /**
13: * Implements {@link HTStrategy} by always playing "heads".
14: */
15: public class HTHeadsStrategy extends HTStrategy {
16:
17: /**
18: * Creates an {@link HTHeadsStrategy}.
19: * @param moveFactory The factory for creating HT moves.
20: */
21: protected HTHeadsStrategy(final IHTMoveFactory moveFactory) {
22: super(moveFactory);
23: }
24:
25: @Override
26: public Optional<IHTMove> computeNextMove(final int gameId, final IHTPlayer player, final IHTState state)
27: throws GameException, InterruptedException {
28: return Optional.of(getMoveFactory().createHeadsMove());
29: }
30: }