Skip to content

Package: VierConnectsGameBuilder

VierConnectsGameBuilder

Coverage

1: /*
2: * Copyright © 2021-2023 Fachhochschule für die Wirtschaft (FHDW) Hannover
3: *
4: * This file is part of ipspiel24-VierConnects-core.
5: *
6: * ipspiel24-VierConnects-core is free software: you can redistribute it and/or modify it under
7: * the terms of the GNU General Public License as published by the Free Software
8: * Foundation, either version 3 of the License, or (at your option) any later
9: * version.
10: *
11: * ipspiel24-VierConnects-core is distributed in the hope that it will be useful, but WITHOUT
12: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14: * details.
15: *
16: * You should have received a copy of the GNU General Public License along with
17: * ipspiel24-VierConnects-core. If not, see <http://www.gnu.org/licenses/>.
18: */
19: package de.fhdw.gaming.ipspiel24.VierConnects.core.domain;
20:
21: import de.fhdw.gaming.core.domain.Game;
22: import de.fhdw.gaming.core.domain.GameBuilder;
23: import de.fhdw.gaming.core.domain.GameException;
24: import de.fhdw.gaming.core.domain.ObserverFactoryProvider;
25: import de.fhdw.gaming.ipspiel24.VierConnects.core.moves.VierConnectsMove;
26:
27: /**
28: * A builder which allows to create a Vier Connects game.
29: */
30: public interface VierConnectsGameBuilder extends GameBuilder {
31:
32: /**
33: * The default number of rows of a Vier Connects board.
34: */
35: int DEFAULT_NR_OF_ROWS = 7;
36:
37: /**
38: * The default number of columns of a Vier Connects board.
39: */
40: int DEFAULT_NR_OF_COLUMNS = 8;
41:
42: /**
43: * Creates an {@link VierConnectsPlayerBuilder} which allows to create and add a player to the game
44: * together with her
45: * strategy.
46: */
47: VierConnectsPlayerBuilder createPlayerBuilder();
48:
49: /**
50: * Adds a player and her corresponding strategy.
51: *
52: * @param player The player.
53: * @param strategy The player's strategy.
54: * @throws GameException if adding the player is not allowed by the rules of the game.
55: */
56: VierConnectsGameBuilder addPlayer(VierConnectsPlayer player, VierConnectsStrategy strategy) throws GameException;
57:
58: /**
59: * Changes the number of rows (and columns) of the board.
60: * <p>
61: * If this operation is called multiple times, only the last board size will be retained. If not called, the default
62: * size of {@link #DEFAULT_BOARD_SIZE} rows and columns is used.
63: *
64: * @param newNrOfRows The new number of rows of the board.
65: * @param newNrOfColumns The new number of columns of the board.
66: * @return {@code this}
67: */
68: VierConnectsGameBuilder changeBoardSize(int newNrOfRows, int newNrOfColumns);
69:
70: /**
71: * Changes the {@link ObserverFactoryProvider}.
72: *
73: * @param newObserverFactoryProvider The new {@link ObserverFactoryProvider}.
74: * @return {@code this}
75: */
76: VierConnectsGameBuilder changeObserverFactoryProvider(ObserverFactoryProvider newObserverFactoryProvider);
77:
78: @Override
79: Game<VierConnectsPlayer, VierConnectsState, VierConnectsMove, VierConnectsStrategy> build(int id)
80: throws GameException, InterruptedException;
81: }