Skip to content

Package: GDGameBuilder

GDGameBuilder

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;
17:
18: import de.fhdw.gaming.GefangenenDilemma.moves.GDMove;
19: import de.fhdw.gaming.core.domain.Game;
20: import de.fhdw.gaming.core.domain.GameBuilder;
21: import de.fhdw.gaming.core.domain.GameException;
22: import de.fhdw.gaming.core.domain.ObserverFactoryProvider;
23:
24: /**
25: * A builder which allows to create a Gefangenen-Dilemma game.
26: */
27: public interface GDGameBuilder extends GameBuilder {
28:
29: /**
30: * Creates an {@link GDPlayerBuilder} which allows to create and add a player to the game together
31: * with her
32: * strategy.
33: */
34: GDPlayerBuilder createPlayerBuilder();
35:
36: /**
37: * Adds a player and her corresponding strategy.
38: *
39: * @param player The player.
40: * @param strategy The player's strategy.
41: * @throws GameException if adding the player is not allowed by the rules of the game.
42: */
43: GDGameBuilder addPlayer(GDPlayer player, GDStrategy strategy)
44: throws GameException;
45:
46: /**
47: * Changes the {@link ObserverFactoryProvider}.
48: *
49: * @param newObserverFactoryProvider The new {@link ObserverFactoryProvider}.
50: * @return {@code this}
51: */
52: GDGameBuilder changeObserverFactoryProvider(ObserverFactoryProvider newObserverFactoryProvider);
53:
54: @Override
55: Game<GDPlayer, GDState, GDMove, GDStrategy> build(
56: int id) throws GameException, InterruptedException;
57: }