Skip to content

Package: TicTacToeGameBuilder

TicTacToeGameBuilder

Coverage

1: /*
2: * Copyright © 2021 Fachhochschule für die Wirtschaft (FHDW) Hannover
3: *
4: * This file is part of ipspiel21-tictactoe-core.
5: *
6: * ipspiel21-tictactoe-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: * ipspiel21-tictactoe-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: * ipspiel21-tictactoe-core. If not, see <http://www.gnu.org/licenses/>.
18: */
19: package de.fhdw.gaming.ipspiel21.tictactoe.core.domain;
20:
21: import de.fhdw.gaming.core.domain.GameBuilder;
22: import de.fhdw.gaming.core.domain.GameException;
23: import de.fhdw.gaming.core.domain.ObserverFactoryProvider;
24:
25: /**
26: * A builder which allows to create a Tic Tac Toe game.
27: */
28: public interface TicTacToeGameBuilder extends GameBuilder {
29:
30: /**
31: * The default number of rows (and columns) of a Tic Tac Toe board.
32: */
33: int DEFAULT_BOARD_SIZE = 3;
34:
35: /**
36: * Creates an {@link TicTacToePlayerBuilder} which allows to create and add a player to the game together with her
37: * strategy.
38: */
39: TicTacToePlayerBuilder createPlayerBuilder();
40:
41: /**
42: * Adds a player builder and the corresponding strategy.
43: *
44: * @param playerBuilder The builder player used for creating the player.
45: * @param strategy The player's strategy.
46: * @throws GameException if adding the player is not allowed by the rules of the game.
47: */
48: TicTacToeGameBuilder addPlayerBuilder(TicTacToePlayerBuilder playerBuilder, TicTacToeStrategy strategy)
49: throws GameException;
50:
51: /**
52: * Changes the number of rows (and columns) of the board.
53: * <p>
54: * If this operation is called multiple times, only the last board size will be retained. If not called, the default
55: * size of {@link #DEFAULT_BOARD_SIZE} rows and columns is used.
56: *
57: * @param newBoardSize The new number of rows (and columns) of the board.
58: * @return {@code this}
59: */
60: TicTacToeGameBuilder changeBoardSize(int newBoardSize);
61:
62: /**
63: * Changes the {@link ObserverFactoryProvider}.
64: *
65: * @param newObserverFactoryProvider The new {@link ObserverFactoryProvider}.
66: * @return {@code this}
67: */
68: TicTacToeGameBuilder changeObserverFactoryProvider(ObserverFactoryProvider newObserverFactoryProvider);
69:
70: @Override
71: TicTacToeGame build(int id) throws GameException, InterruptedException;
72: }