Skip to content

Package: IC4GameBuilder

IC4GameBuilder

Coverage

1: package de.fhdw.gaming.ipspiel23.c4.domain;
2:
3: import de.fhdw.gaming.core.domain.GameBuilder;
4: import de.fhdw.gaming.core.domain.GameException;
5: import de.fhdw.gaming.core.domain.ObserverFactoryProvider;
6: import de.fhdw.gaming.ipspiel23.c4.strategies.IC4Strategy;
7:
8: /**
9: * A builder for configuring a connect four game.
10: */
11: public interface IC4GameBuilder extends GameBuilder {
12:
13: /**
14: * The default number of rows of the board.
15: */
16: int DEFAULT_BOARD_ROWS = 6;
17:
18: /**
19: * The default number of columns of the board.
20: */
21: int DEFAULT_BOARD_COLUMNS = 7;
22:
23: /**
24: * The default number of fields that are required for a solution.
25: */
26: int DEFAULT_REQUIRED_SOLUTION_SIZE = 4;
27:
28: /**
29: * The default number of players.
30: */
31: int DEFAULT_PLAYER_COUNT = 2;
32:
33: /**
34: * The default observer factory provider.
35: */
36: IC4PlayerBuilder createPlayerBuilder();
37:
38: /**
39: * Adds a player to the game.
40: *
41: * @param player the player to add
42: * @param strategy the strategy used by the player
43: * @return the same builder instance for fluent configuration
44: */
45: IC4GameBuilder addPlayer(IC4Player player, IC4Strategy strategy) throws GameException;
46:
47: /**
48: * Changes the number of rows of the board.
49: *
50: * @param newRowCount the new number of rows
51: * @return the same builder instance for fluent configuration
52: */
53: IC4GameBuilder changeBoardRows(int newRowCount);
54:
55: /**
56: * Changes the number of columns of the board.
57: *
58: * @param newColumnCount the new number of columns
59: * @return the same builder instance for fluent configuration
60: */
61: IC4GameBuilder changeBoardColumns(int newColumnCount);
62:
63: /**
64: * Changes the number of fields that are required for a solution.
65: *
66: * @param newSolutionSize the new number of fields that are required for a solution
67: * @return the same builder instance for fluent configuration
68: */
69: IC4GameBuilder changeRequiredSolutionSize(int newSolutionSize);
70:
71: /**
72: * Changes the observer factory provider.
73: *
74: * @param newObserverFactoryProvider the new observer factory provider
75: * @return the same builder instance for fluent configuration
76: */
77: IC4GameBuilder changeObserverFactoryProvider(ObserverFactoryProvider newObserverFactoryProvider);
78:
79: /**
80: * Builds the game.
81: *
82: * @param id the ID of the game
83: * @return the game
84: * @throws GameException if the game cannot be built
85: * @throws InterruptedException if the game is interrupted
86: */
87: @Override
88: IC4Game build(int id) throws GameException, InterruptedException;
89: }