Skip to content

Package: GDMoveGeneratorImpl

GDMoveGeneratorImpl

nameinstructionbranchcomplexitylinemethod
GDMoveGeneratorImpl()
M: 0 C: 8
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
generate(GDPlayer, GDState)
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%

Coverage

1: /*
2: * Copyright © 2021-2023 Fachhochschule für die Wirtschaft (FHDW) Hannover
3: *
4: * This file is part of ipspiel24-GD.
5: *
6: * ipspiel24-GD 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-GD 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-GD. If not, see
14: * <http://www.gnu.org/licenses/>.
15: */
16: package de.fhdw.gaming.GefangenenDilemma.domain.impl;
17:
18: import java.util.Optional;
19:
20: import de.fhdw.gaming.GefangenenDilemma.domain.GDMoveGenerator;
21: import de.fhdw.gaming.GefangenenDilemma.domain.GDPlayer;
22: import de.fhdw.gaming.GefangenenDilemma.domain.GDState;
23: import de.fhdw.gaming.GefangenenDilemma.moves.GDMove;
24: import de.fhdw.gaming.GefangenenDilemma.moves.factory.GDMoveFactory;
25: import de.fhdw.gaming.GefangenenDilemma.moves.impl.GDDefaultMoveFactory;
26:
27: /**
28: * Implements the {@link GDMoveGenerator} interface.
29: */
30: final class GDMoveGeneratorImpl implements GDMoveGenerator {
31:
32: /**
33: * The move factory.
34: */
35: private final GDMoveFactory moveFactory = new GDDefaultMoveFactory();
36:
37: @Override
38: public Optional<GDMove> generate(final GDPlayer player,
39: final GDState state) {
40: // choose "no" to punish lame strategies
41: return Optional.of(this.moveFactory.createSnitchMove());
42: }
43: }