Skip to content

Method: generate(SspPlayer, SspState)

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