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 java.util.List;
22:
23: import de.fhdw.gaming.core.domain.Game;
24: import de.fhdw.gaming.core.domain.GameBuilder;
25: import de.fhdw.gaming.core.domain.GameException;
26: import de.fhdw.gaming.core.domain.Observer;
27: import de.fhdw.gaming.ipspiel24.VierConnects.core.moves.VierConnectsMove;
28:
29: /**
30: * A builder which allows to create a Vier Connects game.
31: */
32: public interface VierConnectsGameBuilder extends GameBuilder {
33:
34: /**
35: * The default number of rows of a Vier Connects board.
36: */
37: int DEFAULT_NR_OF_ROWS = 7;
38:
39: /**
40: * The default number of columns of a Vier Connects board.
41: */
42: int DEFAULT_NR_OF_COLUMNS = 8;
43:
44: /**
45: * Creates an {@link VierConnectsPlayerBuilder} which allows to create and add a player to the game
46: * together with her
47: * strategy.
48: */
49: VierConnectsPlayerBuilder createPlayerBuilder();
50:
51: /**
52: * Adds a player and her corresponding strategy.
53: *
54: * @param player The player.
55: * @param strategy The player's strategy.
56: * @throws GameException if adding the player is not allowed by the rules of the game.
57: */
58: VierConnectsGameBuilder addPlayer(VierConnectsPlayer player, VierConnectsStrategy strategy) throws GameException;
59:
60: /**
61: * Changes the number of rows (and columns) of the board.
62: * <p>
63: * If this operation is called multiple times, only the last board size will be retained. If not called, the default
64: * size of {@link #DEFAULT_BOARD_SIZE} rows and columns is used.
65: *
66: * @param newNrOfRows The new number of rows of the board.
67: * @param newNrOfColumns The new number of columns of the board.
68: * @return {@code this}
69: */
70: VierConnectsGameBuilder changeBoardSize(int newNrOfRows, int newNrOfColumns);
71:
72: @Override
73: VierConnectsGameBuilder addObservers(List<Observer> newObservers);
74:
75: @Override
76: Game<VierConnectsPlayer, VierConnectsState, VierConnectsMove, VierConnectsStrategy> build(int id)
77: throws GameException, InterruptedException;
78: }