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:
7: /**
8: * A class managing all memories for all players.
9: */
10: public interface Brain {
11:
12: /**
13: * Sets the amount of outcomes that the brain can remember. Can be used during a game.
14: * @param length
15: */
16: void setMemoryLength(int length) throws IllegalArgumentException;
17:
18: /**
19: * Adds the outcomes of the current game for each player to the memory. Each combination of active player,
20: * their opponent, and the strategy of the active player requires a new {@link Key} for which the outcomes
21: * will be saved. In a 2 player game without changing strategies there should
22: * only ever be two {@link Key}s.
23: * @param game
24: */
25: void rememberOutcome(Game<?, ?, ?, ?> game);
26:
27: /**
28: * Returns the {@link ShiftList} containing the outcomes for a certain {@link Key}.
29: * That means a certain combination of player the memory is for,
30: * their opponent and the strategy used by the active player.
31: * @param key {@link Key}
32: */
33: ShiftList getMemory(Key key);
34:
35: /**
36: * Returns the entirety of the memory. It can be used to acquire any
37: * {@link ShiftList} of outcomes with the right key.
38: */
39: Map<Key, ShiftList> getMemory();
40:
41: }