Skip to content

Package: OthelloGameBuilder

OthelloGameBuilder

Coverage

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