Package: GDQuietStrategy
GDQuietStrategy
| name | instruction | branch | complexity | line | method | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| GDQuietStrategy(GDMoveFactory) | 
  | 
  | 
  | 
  | 
  | 
||||||||||||||||||||
| computeNextMove(int, GDPlayer, GDState) | 
  | 
  | 
  | 
  | 
  | 
||||||||||||||||||||
| toString() | 
  | 
  | 
  | 
  | 
  | 
||||||||||||||||||||
Coverage
1: package de.fhdw.gaming.ipspiel22.gefangenenDilemma.strategy;
2: 
3: import java.util.Optional;
4: 
5: import de.fhdw.gaming.ipspiel22.gefangenenDilemma.domain.GDPlayer;
6: import de.fhdw.gaming.ipspiel22.gefangenenDilemma.domain.GDState;
7: import de.fhdw.gaming.ipspiel22.gefangenenDilemma.domain.GDStrategy;
8: import de.fhdw.gaming.ipspiel22.gefangenenDilemma.moves.GDMove;
9: import de.fhdw.gaming.ipspiel22.gefangenenDilemma.moves.factory.GDMoveFactory;
10: 
11: /**
12:  * Implements {@link GDStrategy} by always staying "quiet".
13:  */
14: public class GDQuietStrategy implements GDStrategy {
15:     /**
16:      * The factory for creating Gefangenen Dilemma moves.
17:      */
18:     private final GDMoveFactory moveFactory;
19: 
20:     /**
21:      * Creates an {@link GDQuietStrategy}.
22:      *
23:      * @param moveFactory The factory for creating Gefangenen Dilemma moves.
24:      */
25:     public GDQuietStrategy(final GDMoveFactory moveFactory) {
26:         this.moveFactory = moveFactory;
27:     }
28: 
29:     @Override
30:     public Optional<GDMove> computeNextMove(final int gameId, final GDPlayer player, final GDState state) {
31:         return Optional.of(this.moveFactory.createQuietMove());
32:     }
33: 
34:     @Override
35:     public String toString() {
36:         return GDQuietStrategy.class.getSimpleName();
37:     }
38: }