Skip to content

Package: Brain

Brain

Coverage

1: package de.fhdw.gaming.memory;
2:
3: import java.util.Map;
4:
5: import de.fhdw.gaming.core.domain.Game;
6: import de.fhdw.gaming.core.domain.Move;
7:
8: /**
9: * A class managing all memories for all players.
10: */
11: public interface Brain {
12:
13: /**
14: * .
15: * @return
16: */
17: int getLength();
18:
19: /**
20: * Sets the amount of outcomes that the brain can remember. Can be used during a game.
21: * @param length
22: */
23: void setMemoryLength(int length) throws IllegalArgumentException;
24:
25: /**
26: * Adds the outcomes of the current game for each player to the memory. Each combination of active player,
27: * their opponent, and the strategy of the active player requires a new {@link Key} for which the outcomes
28: * will be saved. In a 2 player game without changing strategies there should
29: * only ever be two {@link Key}s.
30: * @param game
31: */
32: void rememberOutcome(Game<?, ?, ?, ?> game);
33:
34: /**
35: * .
36: * @param key
37: * @param move
38: */
39: public void rememberMyMove(Key key, Move<?, ?> move);
40:
41: /**
42: * .
43: * @param key
44: * @param move
45: */
46: public void rememberOpponentMove(Key key, Move<?, ?> move);
47:
48: /**
49: * Returns the {@link ShiftList} containing the outcomes for a certain {@link Key}.
50: * That means a certain combination of player the memory is for,
51: * their opponent and the strategy used by the active player.
52: * @param key {@link Key}
53: */
54: ShiftList getMemory(Key key);
55:
56: /**
57: * Returns the entirety of the memory. It can be used to acquire any
58: * {@link ShiftList} of outcomes with the right key.
59: */
60: Map<Key, ShiftList> getMemory();
61:
62: }