Merge commit
This commit is contained in:
		@@ -1,17 +0,0 @@
 | 
			
		||||
<component name="ProjectRunConfigurationManager">
 | 
			
		||||
  <configuration default="false" name="MdgaApp" type="Application" factoryName="Application" singleton="false" nameIsGenerated="true">
 | 
			
		||||
    <option name="MAIN_CLASS_NAME" value="pp.mdga.client.MdgaApp" />
 | 
			
		||||
    <module name="Projekte.mdga.client.main" />
 | 
			
		||||
    <option name="VM_PARAMETERS" value="-Djava.util.logging.config.file=logging.properties -ea" />
 | 
			
		||||
    <option name="WORKING_DIRECTORY" value="$MODULE_WORKING_DIR$" />
 | 
			
		||||
    <extension name="coverage">
 | 
			
		||||
      <pattern>
 | 
			
		||||
        <option name="PATTERN" value="pp.mdga.client.board.Outline.*" />
 | 
			
		||||
        <option name="ENABLED" value="true" />
 | 
			
		||||
      </pattern>
 | 
			
		||||
    </extension>
 | 
			
		||||
    <method v="2">
 | 
			
		||||
      <option name="Make" enabled="true" />
 | 
			
		||||
    </method>
 | 
			
		||||
  </configuration>
 | 
			
		||||
</component>
 | 
			
		||||
@@ -1,16 +1,19 @@
 | 
			
		||||
package pp.mdga.client;
 | 
			
		||||
 | 
			
		||||
import pp.mdga.client.ceremonyState.CeremonyStateMachine;
 | 
			
		||||
 | 
			
		||||
public class Ceremony extends ClientState {
 | 
			
		||||
    private final CeremonyStateMachine ceremonyStateMachine;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public Ceremony(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.ceremonyStateMachine = new CeremonyStateMachine(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public CeremonyStateMachine getCeremonyStateMachine() {
 | 
			
		||||
        return ceremonyStateMachine;
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,24 +0,0 @@
 | 
			
		||||
package pp.mdga.client;
 | 
			
		||||
 | 
			
		||||
public class ClientAutomaton extends ClientStateMachine {
 | 
			
		||||
 | 
			
		||||
    private Dialogs dialogs;
 | 
			
		||||
    private Ceremony ceremony;
 | 
			
		||||
    private Game game;
 | 
			
		||||
    private Interrupt interrupt;
 | 
			
		||||
 | 
			
		||||
    public ClientAutomaton(ClientGameLogic logic){
 | 
			
		||||
        super(null, logic);
 | 
			
		||||
        dialogs = new Dialogs(this, logic);
 | 
			
		||||
        ceremony = new Ceremony(this, logic);
 | 
			
		||||
        game = new Game(this, logic);
 | 
			
		||||
        entry();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Dialogs initialState(){
 | 
			
		||||
        return dialogs;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,6 +1,12 @@
 | 
			
		||||
package pp.mdga.client;
 | 
			
		||||
 | 
			
		||||
public abstract class ClientState implements Observer {
 | 
			
		||||
import pp.mdga.game.Color;
 | 
			
		||||
import pp.mdga.message.server.*;
 | 
			
		||||
 | 
			
		||||
import java.lang.System.Logger.Level;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
public abstract class ClientState implements Observer, ServerInterpreter {
 | 
			
		||||
    protected static final System.Logger LOGGER = System.getLogger(ClientState.class.getName());
 | 
			
		||||
 | 
			
		||||
    protected ClientState parent;
 | 
			
		||||
@@ -12,13 +18,9 @@ protected ClientState(ClientState parent, ClientGameLogic logic){
 | 
			
		||||
        this.logic = logic;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void entry(){/* do nothing */}
 | 
			
		||||
    public abstract void enter();
 | 
			
		||||
 | 
			
		||||
    public void exit() {/* do nothing*/}
 | 
			
		||||
 | 
			
		||||
    public void gotoState(ClientState newState){
 | 
			
		||||
        throw new IllegalStateException("not in a statemachine");
 | 
			
		||||
    }
 | 
			
		||||
    public abstract void exit();
 | 
			
		||||
 | 
			
		||||
    public ClientState getParent(){
 | 
			
		||||
        return parent;
 | 
			
		||||
@@ -30,4 +32,187 @@ public void update() {/* do nothing */}
 | 
			
		||||
    public String toString(){
 | 
			
		||||
        return getClass().getSimpleName();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(ActivePlayer msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(AnyPiece msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(Briefing msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(CeremonyMessage msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(Die msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(DiceAgain msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(DiceNow msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(EndOfTurn msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(LobbyAccept msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(LobbyDeny msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(LobbyPlayerJoin msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(LobbyPlayerLeave msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(MoveMessage msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(NoTurn msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(PauseGame msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(PlayCard msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(PossibleCard msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(PossiblePiece msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(RankingResponse msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(RankingRollAgain msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(ReconnectBriefing msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(ResumeGame msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(ServerStartGame msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(StartPiece msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(UpdateReady msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(UpdateTSK msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(WaitPiece msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectPiece(UUID id) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Selecting piece not allowed.");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectCard(UUID id) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Selecting card not allowed.");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectTSK(Color color) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Selecting TSK not allowed.");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectDice() {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Selecting dice not allowed.");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setName(String name) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Setting name not allowed.");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectReady() {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Selecting ready not allowed.");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectHost() {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Selecting host not allowed.");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectJoin() {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Selecting join not allowed.");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectLeave() {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Selecting leave not allowed.");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void deselectTSK(Color color) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Deselecting TSK not allowed.");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectUnready(){
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Selecting unready not allowed.");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectStart(){
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Starting not allowed");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,44 +0,0 @@
 | 
			
		||||
package pp.mdga.client;
 | 
			
		||||
 | 
			
		||||
public abstract class ClientStateMachine extends ClientState {
 | 
			
		||||
 | 
			
		||||
    private ClientState state;
 | 
			
		||||
 | 
			
		||||
    protected ClientStateMachine(ClientState parent, ClientGameLogic logic){
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public abstract ClientState initialState();
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void gotoState(ClientState newState){
 | 
			
		||||
        LOGGER.log(System.Logger.Level.DEBUG, "{0}: {1} --> {2}", this, state, newState);
 | 
			
		||||
        enter(newState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void entry(){
 | 
			
		||||
        final ClientState newState = initialState();
 | 
			
		||||
        LOGGER.log(System.Logger.Level.DEBUG, "{0}: initial state={1}", this, newState);
 | 
			
		||||
        enter(newState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void enter(ClientState newState){
 | 
			
		||||
        if(newState.parent != this)
 | 
			
		||||
            throw new IllegalArgumentException("Wrong state: " + newState + " belongs to " + newState.parent + " instead of " + this);
 | 
			
		||||
        state = newState;
 | 
			
		||||
        state.entry();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit(){state.exit();}
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public String toString(){
 | 
			
		||||
        return super.toString() + "(in " + state + ")";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public ClientState getState(){
 | 
			
		||||
        return state;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,16 +1,53 @@
 | 
			
		||||
package pp.mdga.client;
 | 
			
		||||
 | 
			
		||||
import pp.mdga.client.dialogState.DialogsStateMachine;
 | 
			
		||||
import pp.mdga.client.dialogState.DialogStates;
 | 
			
		||||
import pp.mdga.client.dialogState.Lobby;
 | 
			
		||||
import pp.mdga.client.dialogState.NetworkDialog;
 | 
			
		||||
import pp.mdga.client.dialogState.StartDialog;
 | 
			
		||||
 | 
			
		||||
public class Dialogs extends ClientState {
 | 
			
		||||
    private final DialogsStateMachine dialogsStateMachine;
 | 
			
		||||
 | 
			
		||||
    private DialogStates currentState;
 | 
			
		||||
 | 
			
		||||
    private final Lobby lobby = new Lobby(this, logic);
 | 
			
		||||
    private final NetworkDialog networkDialog = new NetworkDialog(this, logic);
 | 
			
		||||
    private final StartDialog startDialog = new StartDialog(this, logic);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public Dialogs(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.dialogsStateMachine = new DialogsStateMachine(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public DialogsStateMachine getDialogsStateMachine() {
 | 
			
		||||
        return dialogsStateMachine;
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit(){
 | 
			
		||||
        currentState.exit();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter(){
 | 
			
		||||
        currentState = startDialog;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setState(DialogStates newState){
 | 
			
		||||
        currentState.exit();
 | 
			
		||||
        currentState = newState;
 | 
			
		||||
        currentState.enter();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Lobby getLobby() {
 | 
			
		||||
        return lobby;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public NetworkDialog getNetworkDialog() {
 | 
			
		||||
        return networkDialog;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public StartDialog getStartDialog() {
 | 
			
		||||
        return startDialog;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void startGame(){
 | 
			
		||||
        exit();
 | 
			
		||||
        logic.setState(logic.getGameState());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,16 +0,0 @@
 | 
			
		||||
package pp.mdga.client;
 | 
			
		||||
 | 
			
		||||
import pp.mdga.client.gameState.GameStateMachine;
 | 
			
		||||
 | 
			
		||||
public class Game extends ClientState {
 | 
			
		||||
    private final GameStateMachine gameStateMachine;
 | 
			
		||||
 | 
			
		||||
    public Game(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.gameStateMachine = new GameStateMachine(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public GameStateMachine getGameStateMachine() {
 | 
			
		||||
        return gameStateMachine;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,29 @@
 | 
			
		||||
package pp.mdga.client;
 | 
			
		||||
 | 
			
		||||
import pp.mdga.client.gameState.*;
 | 
			
		||||
 | 
			
		||||
public class GameState extends ClientState {
 | 
			
		||||
 | 
			
		||||
    private GameStates state;
 | 
			
		||||
 | 
			
		||||
    private Animation animation = new Animation(this, logic);
 | 
			
		||||
    private DetermineStartPlayer determineStartPlayer = new DetermineStartPlayer(this, logic);
 | 
			
		||||
    private Spectator spectator  = new Spectator(this, logic);
 | 
			
		||||
    private Turn turn = new Turn(this, logic);
 | 
			
		||||
    private Waiting waiting = new Waiting(this, logic);
 | 
			
		||||
 | 
			
		||||
    public GameState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        state = determineStartPlayer;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -2,10 +2,17 @@
 | 
			
		||||
 | 
			
		||||
public class Interrupt extends ClientState {
 | 
			
		||||
 | 
			
		||||
    private final Game lastState;
 | 
			
		||||
 | 
			
		||||
    public Interrupt(ClientState parent, ClientGameLogic logic, Game lastState) {
 | 
			
		||||
    public Interrupt(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.lastState = lastState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,16 +1,18 @@
 | 
			
		||||
package pp.mdga.client;
 | 
			
		||||
 | 
			
		||||
import pp.mdga.client.settingsState.SettingsStateMachine;
 | 
			
		||||
 | 
			
		||||
public class Settings extends ClientState {
 | 
			
		||||
    private final SettingsStateMachine settingsStateMachine;
 | 
			
		||||
 | 
			
		||||
    public Settings(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.settingsStateMachine = new SettingsStateMachine(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public SettingsStateMachine getSettingsStateMachine() {
 | 
			
		||||
        return settingsStateMachine;
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,18 +0,0 @@
 | 
			
		||||
package pp.mdga.client.ceremonyState;
 | 
			
		||||
 | 
			
		||||
import pp.mdga.client.ClientGameLogic;
 | 
			
		||||
import pp.mdga.client.ClientState;
 | 
			
		||||
import pp.mdga.client.ClientStateMachine;
 | 
			
		||||
 | 
			
		||||
public class CeremonyStateMachine extends ClientStateMachine {
 | 
			
		||||
 | 
			
		||||
    public CeremonyStateMachine(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Podium initialState() {
 | 
			
		||||
        return new Podium(this, logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,10 @@
 | 
			
		||||
package pp.mdga.client.ceremonyState;
 | 
			
		||||
 | 
			
		||||
import pp.mdga.client.ClientGameLogic;
 | 
			
		||||
import pp.mdga.client.ClientState;
 | 
			
		||||
 | 
			
		||||
public abstract class CeremonyStates extends ClientState {
 | 
			
		||||
    protected CeremonyStates(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -3,8 +3,18 @@
 | 
			
		||||
import pp.mdga.client.ClientGameLogic;
 | 
			
		||||
import pp.mdga.client.ClientState;
 | 
			
		||||
 | 
			
		||||
public class Podium extends ClientState {
 | 
			
		||||
public class Podium extends CeremonyStates {
 | 
			
		||||
    public Podium(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -3,8 +3,18 @@
 | 
			
		||||
import pp.mdga.client.ClientGameLogic;
 | 
			
		||||
import pp.mdga.client.ClientState;
 | 
			
		||||
 | 
			
		||||
public class Statistics extends ClientState {
 | 
			
		||||
public class Statistics extends CeremonyStates {
 | 
			
		||||
    public Statistics(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,16 +0,0 @@
 | 
			
		||||
package pp.mdga.client.dialogState;
 | 
			
		||||
 | 
			
		||||
import pp.mdga.client.ClientGameLogic;
 | 
			
		||||
import pp.mdga.client.ClientState;
 | 
			
		||||
import pp.mdga.client.ClientStateMachine;
 | 
			
		||||
 | 
			
		||||
public class DialogsStateMachine extends ClientStateMachine {
 | 
			
		||||
    public DialogsStateMachine(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public StartDialog initialState() {
 | 
			
		||||
        return new StartDialog(this, logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -2,9 +2,62 @@
 | 
			
		||||
 | 
			
		||||
import pp.mdga.client.ClientGameLogic;
 | 
			
		||||
import pp.mdga.client.ClientState;
 | 
			
		||||
import pp.mdga.client.Dialogs;
 | 
			
		||||
import pp.mdga.game.Color;
 | 
			
		||||
import pp.mdga.message.client.*;
 | 
			
		||||
import pp.mdga.message.server.ServerStartGame;
 | 
			
		||||
 | 
			
		||||
public class Lobby extends DialogStates {
 | 
			
		||||
 | 
			
		||||
    private final Dialogs parent;
 | 
			
		||||
 | 
			
		||||
    public Lobby(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.parent = (Dialogs) parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectLeave() {
 | 
			
		||||
        parent.setState(parent.getStartDialog());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectTSK(Color color) {
 | 
			
		||||
        logic.send(new SelectTSK(color));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void deselectTSK(Color color) {
 | 
			
		||||
        logic.send(new DeselectTSK(color));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectReady() {
 | 
			
		||||
        logic.send(new LobbyReady());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectUnready(){
 | 
			
		||||
        logic.send(new LobbyNotReady());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectStart(){
 | 
			
		||||
        logic.send(new StartGame());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(ServerStartGame msg){
 | 
			
		||||
        parent.startGame();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,9 +2,61 @@
 | 
			
		||||
 | 
			
		||||
import pp.mdga.client.ClientGameLogic;
 | 
			
		||||
import pp.mdga.client.ClientState;
 | 
			
		||||
import pp.mdga.client.Dialogs;
 | 
			
		||||
 | 
			
		||||
public class NetworkDialog extends DialogStates {
 | 
			
		||||
 | 
			
		||||
    private final Dialogs parent;
 | 
			
		||||
 | 
			
		||||
    public NetworkDialog(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.parent = (Dialogs) parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private boolean checkIP(String IP){
 | 
			
		||||
        String[] parts = IP.split("\\.");
 | 
			
		||||
 | 
			
		||||
        // Step 2: Check if there are exactly 4 parts
 | 
			
		||||
        if (parts.length != 4) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Step 3: Check each part for valid number
 | 
			
		||||
        for (String part : parts) {
 | 
			
		||||
            try {
 | 
			
		||||
                // Step 4: Convert each part into a number
 | 
			
		||||
                int num = Integer.parseInt(part);
 | 
			
		||||
 | 
			
		||||
                // Step 5: Check whether the number lies in between 0 and 255
 | 
			
		||||
                if (num < 0 || num > 255) {
 | 
			
		||||
                    return false;
 | 
			
		||||
                }
 | 
			
		||||
            } catch (NumberFormatException e) {
 | 
			
		||||
                // If parsing fails, it's not a valid number
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // If all checks passed, return true
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectBack() {
 | 
			
		||||
        parent.setState(parent.getStartDialog());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectJoin(String IP) {
 | 
			
		||||
        if(checkIP(IP)){
 | 
			
		||||
            parent.setState(parent.getLobby());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,9 +2,36 @@
 | 
			
		||||
 | 
			
		||||
import pp.mdga.client.ClientGameLogic;
 | 
			
		||||
import pp.mdga.client.ClientState;
 | 
			
		||||
import pp.mdga.client.Dialogs;
 | 
			
		||||
 | 
			
		||||
public class StartDialog extends DialogStates {
 | 
			
		||||
 | 
			
		||||
    private final Dialogs parent;
 | 
			
		||||
 | 
			
		||||
    public StartDialog(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.parent = (Dialogs) parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectJoin() {
 | 
			
		||||
        parent.setState(parent.getNetworkDialog());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectHost() {
 | 
			
		||||
        parent.setState(parent.getLobby());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectLeave() {
 | 
			
		||||
        parent.exit();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,4 +7,14 @@ public class Animation extends GameStates {
 | 
			
		||||
    public Animation(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,16 +0,0 @@
 | 
			
		||||
package pp.mdga.client.gameState;
 | 
			
		||||
 | 
			
		||||
import pp.mdga.client.ClientGameLogic;
 | 
			
		||||
import pp.mdga.client.ClientState;
 | 
			
		||||
import pp.mdga.client.ClientStateMachine;
 | 
			
		||||
 | 
			
		||||
public class GameStateMachine extends ClientStateMachine {
 | 
			
		||||
    public GameStateMachine(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public ClientState initialState() {
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -7,4 +7,14 @@ public class Spectator extends GameStates {
 | 
			
		||||
    public Spectator(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,17 +2,20 @@
 | 
			
		||||
 | 
			
		||||
import pp.mdga.client.ClientGameLogic;
 | 
			
		||||
import pp.mdga.client.ClientState;
 | 
			
		||||
import pp.mdga.client.gameState.turnState.TurnStateMachine;
 | 
			
		||||
 | 
			
		||||
public class Turn extends GameStates {
 | 
			
		||||
    private final TurnStateMachine turnStateMachine;
 | 
			
		||||
 | 
			
		||||
    public Turn(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.turnStateMachine = new TurnStateMachine(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public TurnStateMachine getTurnStateMachine() {
 | 
			
		||||
        return turnStateMachine;
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,4 +7,14 @@ public class Waiting extends GameStates {
 | 
			
		||||
    public Waiting(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -4,8 +4,9 @@
 | 
			
		||||
import pp.mdga.client.ClientState;
 | 
			
		||||
import pp.mdga.client.gameState.GameStates;
 | 
			
		||||
 | 
			
		||||
public class DetermineStartPlayerStates extends GameStates {
 | 
			
		||||
public abstract class DetermineStartPlayerStates extends GameStates {
 | 
			
		||||
    public DetermineStartPlayerStates(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,4 +7,14 @@ public class RollRankingDice extends DetermineStartPlayerStates {
 | 
			
		||||
    public RollRankingDice(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -8,4 +8,14 @@ public class WaitRanking extends GameStates {
 | 
			
		||||
    public WaitRanking(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,19 +1,21 @@
 | 
			
		||||
package pp.mdga.client.gameState.turnState;
 | 
			
		||||
 | 
			
		||||
import pp.mdga.client.gameState.turnState.choosePieceState.ChoosePieceStateMachine;
 | 
			
		||||
import pp.mdga.client.ClientGameLogic;
 | 
			
		||||
import pp.mdga.client.ClientState;
 | 
			
		||||
 | 
			
		||||
public class ChoosePiece extends TurnStates {
 | 
			
		||||
 | 
			
		||||
    private final ChoosePieceStateMachine choosePieceStateMachine;
 | 
			
		||||
 | 
			
		||||
    public ChoosePiece(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.choosePieceStateMachine = new ChoosePieceStateMachine(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public ChoosePieceStateMachine getChoosePieceStateMachine() {
 | 
			
		||||
        return choosePieceStateMachine;
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,4 +7,14 @@ public class MovePiece extends TurnStates {
 | 
			
		||||
    public MovePiece(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,4 +7,14 @@ public class PlayPowerCard extends TurnStates {
 | 
			
		||||
    public PlayPowerCard(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,17 +2,20 @@
 | 
			
		||||
 | 
			
		||||
import pp.mdga.client.ClientGameLogic;
 | 
			
		||||
import pp.mdga.client.ClientState;
 | 
			
		||||
import pp.mdga.client.gameState.turnState.powerCardState.PowerCardStateMachine;
 | 
			
		||||
 | 
			
		||||
public class PowerCard extends TurnStates {
 | 
			
		||||
    private final PowerCardStateMachine powerCardStateMachine;
 | 
			
		||||
 | 
			
		||||
    public PowerCard(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.powerCardStateMachine = new PowerCardStateMachine(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public PowerCardStateMachine getPowerCardStateMachine() {
 | 
			
		||||
        return powerCardStateMachine;
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,4 +7,14 @@ public class RollDice extends TurnStates {
 | 
			
		||||
    public RollDice(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,16 +0,0 @@
 | 
			
		||||
package pp.mdga.client.gameState.turnState;
 | 
			
		||||
 | 
			
		||||
import pp.mdga.client.ClientGameLogic;
 | 
			
		||||
import pp.mdga.client.ClientState;
 | 
			
		||||
import pp.mdga.client.ClientStateMachine;
 | 
			
		||||
 | 
			
		||||
public class TurnStateMachine extends ClientStateMachine {
 | 
			
		||||
    public TurnStateMachine(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public PowerCard initialState() {
 | 
			
		||||
        return new PowerCard(this, logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,16 +0,0 @@
 | 
			
		||||
package pp.mdga.client.gameState.turnState.choosePieceState;
 | 
			
		||||
 | 
			
		||||
import pp.mdga.client.ClientGameLogic;
 | 
			
		||||
import pp.mdga.client.ClientState;
 | 
			
		||||
import pp.mdga.client.ClientStateMachine;
 | 
			
		||||
 | 
			
		||||
public class ChoosePieceStateMachine extends ClientStateMachine {
 | 
			
		||||
    public ChoosePieceStateMachine(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public NoPiece initialState() {
 | 
			
		||||
        return new NoPiece(this, logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -7,4 +7,14 @@ public class NoPiece extends ChoosePieceStates {
 | 
			
		||||
    public NoPiece(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,4 +7,14 @@ public class SelectPiece extends ChoosePieceStates {
 | 
			
		||||
    public SelectPiece(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,4 +7,14 @@ public class StartPiece extends ChoosePieceStates {
 | 
			
		||||
    public StartPiece(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,4 +7,14 @@ public class WaitingPiece extends ChoosePieceStates {
 | 
			
		||||
    public WaitingPiece(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,4 +7,14 @@ public class ChoosePowerCard extends PowerCardStates {
 | 
			
		||||
    public ChoosePowerCard(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,16 +0,0 @@
 | 
			
		||||
package pp.mdga.client.gameState.turnState.powerCardState;
 | 
			
		||||
 | 
			
		||||
import pp.mdga.client.ClientGameLogic;
 | 
			
		||||
import pp.mdga.client.ClientState;
 | 
			
		||||
import pp.mdga.client.ClientStateMachine;
 | 
			
		||||
 | 
			
		||||
public class PowerCardStateMachine extends ClientStateMachine {
 | 
			
		||||
    public PowerCardStateMachine(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public ChoosePowerCard initialState() {
 | 
			
		||||
        return new ChoosePowerCard(this, logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -7,4 +7,14 @@ public class Shield extends PowerCardStates {
 | 
			
		||||
    public Shield(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,4 +7,14 @@ public class Swap extends PowerCardStates {
 | 
			
		||||
    public Swap(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,4 +7,14 @@ public class AudioSettings extends SettingStates {
 | 
			
		||||
    public AudioSettings(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,4 +7,14 @@ public class MainSettings extends ClientState {
 | 
			
		||||
    public MainSettings(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,16 +0,0 @@
 | 
			
		||||
package pp.mdga.client.settingsState;
 | 
			
		||||
 | 
			
		||||
import pp.mdga.client.ClientGameLogic;
 | 
			
		||||
import pp.mdga.client.ClientState;
 | 
			
		||||
import pp.mdga.client.ClientStateMachine;
 | 
			
		||||
 | 
			
		||||
public class SettingsStateMachine extends ClientStateMachine {
 | 
			
		||||
    public SettingsStateMachine(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public ClientState initialState() {
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -7,4 +7,14 @@ public class VideoSettings extends SettingStates {
 | 
			
		||||
    public VideoSettings(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,12 @@
 | 
			
		||||
package pp.mdga.game;
 | 
			
		||||
 | 
			
		||||
public enum Color {
 | 
			
		||||
    ARMY,
 | 
			
		||||
    NAVY,
 | 
			
		||||
    AIRFORCE,
 | 
			
		||||
    CYBER,
 | 
			
		||||
    AIRFORCE
 | 
			
		||||
    NAVY,
 | 
			
		||||
    ARMY;
 | 
			
		||||
 | 
			
		||||
    public Color next() {
 | 
			
		||||
        return values()[(ordinal() + 1) % values().length];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -6,22 +6,12 @@
 | 
			
		||||
 * This class will be used to handle general PlayerData
 | 
			
		||||
 */
 | 
			
		||||
public class Player {
 | 
			
		||||
 | 
			
		||||
    private String name;
 | 
			
		||||
    private Statistic playerStatistic;
 | 
			
		||||
    private ArrayList<BonusCard> handCards;
 | 
			
		||||
    private final int id;
 | 
			
		||||
    private Color color;
 | 
			
		||||
    private boolean isReady;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This constructor constructs a new Player object
 | 
			
		||||
     */
 | 
			
		||||
    public Player(int id) {
 | 
			
		||||
        this.id = id;
 | 
			
		||||
        playerStatistic = new Statistic();
 | 
			
		||||
        handCards = new ArrayList<>();
 | 
			
		||||
    }
 | 
			
		||||
    private boolean active = true;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This constructor constructs a new Player object
 | 
			
		||||
@@ -32,7 +22,13 @@ public Player(String name) {
 | 
			
		||||
        this.name = name;
 | 
			
		||||
        playerStatistic = new Statistic();
 | 
			
		||||
        handCards = new ArrayList<>();
 | 
			
		||||
        id = 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructor.
 | 
			
		||||
     */
 | 
			
		||||
    public Player() {
 | 
			
		||||
        this("");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -76,7 +72,7 @@ public ArrayList<BonusCard> getHandCards() {
 | 
			
		||||
     *
 | 
			
		||||
     * @param card the card to be added to the players hand
 | 
			
		||||
     */
 | 
			
		||||
    public void addHandCards(BonusCard card){
 | 
			
		||||
    public void addHandCards(BonusCard card) {
 | 
			
		||||
        handCards.add(card);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -94,15 +90,6 @@ public BonusCard removeHandCard(BonusCard card) {
 | 
			
		||||
        return cardToRemove;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the id of the connection to the client represented by this player.
 | 
			
		||||
     *
 | 
			
		||||
     * @return the id
 | 
			
		||||
     */
 | 
			
		||||
    public int getId() {
 | 
			
		||||
        return id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method returns the color of the player
 | 
			
		||||
     *
 | 
			
		||||
@@ -130,6 +117,15 @@ public boolean isReady() {
 | 
			
		||||
        return isReady;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be used to return active attribute of Player class.
 | 
			
		||||
     *
 | 
			
		||||
     * @return active as a Boolean.
 | 
			
		||||
     */
 | 
			
		||||
    public boolean isActive() {
 | 
			
		||||
        return this.active;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method sets the player to ready
 | 
			
		||||
     *
 | 
			
		||||
@@ -138,4 +134,13 @@ public boolean isReady() {
 | 
			
		||||
    public void setReady(boolean ready) {
 | 
			
		||||
        isReady = ready;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be used to set active attribute of Player class to the given active parameter.
 | 
			
		||||
     *
 | 
			
		||||
     * @param active as the new active value as a Boolean.
 | 
			
		||||
     */
 | 
			
		||||
    public void setActive(boolean active) {
 | 
			
		||||
        this.active = active;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -20,14 +20,13 @@ public interface ClientInterpreter {
 | 
			
		||||
     */
 | 
			
		||||
    void received(DeselectTSK msg, int from);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Processes a received ForceStartGame message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  the ForceStartGame message to be processed
 | 
			
		||||
     * @param from the connection ID from which the message was received
 | 
			
		||||
     */
 | 
			
		||||
    void received(ForceStartGame msg, int from);
 | 
			
		||||
    void received(StartGame msg, int from);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Processes a received JoinServer message.
 | 
			
		||||
@@ -61,6 +60,14 @@ public interface ClientInterpreter {
 | 
			
		||||
     */
 | 
			
		||||
    void received(LobbyReady msg, int from);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Processes a received Disconnected message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  the Disconnected message to be processed
 | 
			
		||||
     * @param from the connection ID from which the message was received
 | 
			
		||||
     */
 | 
			
		||||
    void received(Disconnected msg, int from);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Processes a received RequestBriefing message.
 | 
			
		||||
     *
 | 
			
		||||
@@ -70,12 +77,12 @@ public interface ClientInterpreter {
 | 
			
		||||
    void received(RequestBriefing msg, int from);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Processes a received RequestDice message.
 | 
			
		||||
     * Processes a received RequestDie message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  the RequestDice message to be processed
 | 
			
		||||
     * @param msg  the RequestDie message to be processed
 | 
			
		||||
     * @param from the connection ID from which the message was received
 | 
			
		||||
     */
 | 
			
		||||
    void received(RequestDice msg, int from);
 | 
			
		||||
    void received(RequestDie msg, int from);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Processes a received RequestMove message.
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,34 @@
 | 
			
		||||
package pp.mdga.message.client;
 | 
			
		||||
 | 
			
		||||
import com.jme3.network.serializing.Serializable;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
@Serializable
 | 
			
		||||
public class Disconnected extends ClientMessage {
 | 
			
		||||
    public Disconnected() {
 | 
			
		||||
        super();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns a string representation of this message.
 | 
			
		||||
     *
 | 
			
		||||
     * @return a string representation of this message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public String toString() {
 | 
			
		||||
        return "ClientStartGame{}";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Accepts a visitor to process this message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param interpreter the visitor to process this message
 | 
			
		||||
     * @param from        the connection ID from which the message was received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void accept(ClientInterpreter interpreter, int from) {
 | 
			
		||||
        interpreter.received(this, from);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -7,11 +7,23 @@
 | 
			
		||||
 */
 | 
			
		||||
@Serializable
 | 
			
		||||
public class JoinServer extends ClientMessage {
 | 
			
		||||
 | 
			
		||||
    private final String name;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a new JoinServer instance.
 | 
			
		||||
     */
 | 
			
		||||
    public JoinServer(String name) {
 | 
			
		||||
        super();
 | 
			
		||||
        this.name = name;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a new JoinServer instance.
 | 
			
		||||
     */
 | 
			
		||||
    public JoinServer() {
 | 
			
		||||
        super();
 | 
			
		||||
        name = null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -6,11 +6,11 @@
 | 
			
		||||
 * A message sent by a client to request a die roll.
 | 
			
		||||
 */
 | 
			
		||||
@Serializable
 | 
			
		||||
public class RequestDice extends ClientMessage {
 | 
			
		||||
public class RequestDie extends ClientMessage {
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a new RequestDice instance.
 | 
			
		||||
     * Constructs a new RequestDie instance.
 | 
			
		||||
     */
 | 
			
		||||
    public RequestDice() {
 | 
			
		||||
    public RequestDie() {
 | 
			
		||||
        super();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -21,7 +21,7 @@ public RequestDice() {
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public String toString() {
 | 
			
		||||
        return "RequestDice{}";
 | 
			
		||||
        return "RequestDie{}";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -6,12 +6,21 @@
 | 
			
		||||
 * A message sent by the host to force start the game when not everyone is ready or not everyone has selected a TSK.
 | 
			
		||||
 */
 | 
			
		||||
@Serializable
 | 
			
		||||
public class ForceStartGame extends ClientMessage {
 | 
			
		||||
public class StartGame extends ClientMessage {
 | 
			
		||||
 | 
			
		||||
    private final boolean forceStartGame;
 | 
			
		||||
 | 
			
		||||
    public StartGame(boolean forceStartGame){
 | 
			
		||||
        super();
 | 
			
		||||
        this.forceStartGame = forceStartGame;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a new ForceStartGame message.
 | 
			
		||||
     */
 | 
			
		||||
    public ForceStartGame() {
 | 
			
		||||
    public StartGame() {
 | 
			
		||||
        super();
 | 
			
		||||
        forceStartGame = false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
 * A message sent by the server to the client to inform about the dice roll.
 | 
			
		||||
 */
 | 
			
		||||
@Serializable
 | 
			
		||||
public class Dice extends ServerMessage {
 | 
			
		||||
public class Die extends ServerMessage {
 | 
			
		||||
    /**
 | 
			
		||||
     * The eye of the dice
 | 
			
		||||
     */
 | 
			
		||||
@@ -25,7 +25,7 @@ public class Dice extends ServerMessage {
 | 
			
		||||
     * @param diceEye        the eye of the dice
 | 
			
		||||
     * @param moveablePieces the pieces that can be moved
 | 
			
		||||
     */
 | 
			
		||||
    public Dice(int diceEye, List<String> moveablePieces) {
 | 
			
		||||
    public Die(int diceEye, List<String> moveablePieces) {
 | 
			
		||||
        super();
 | 
			
		||||
        this.diceEye = diceEye;
 | 
			
		||||
        this.moveablePieces = moveablePieces;
 | 
			
		||||
@@ -34,7 +34,7 @@ public Dice(int diceEye, List<String> moveablePieces) {
 | 
			
		||||
    /**
 | 
			
		||||
     * Default constructor for serialization purposes.
 | 
			
		||||
     */
 | 
			
		||||
    private Dice() {
 | 
			
		||||
    private Die() {
 | 
			
		||||
        diceEye = 0;
 | 
			
		||||
        moveablePieces = null;
 | 
			
		||||
    }
 | 
			
		||||
@@ -45,8 +45,8 @@ private Dice() {
 | 
			
		||||
     * @param diceEye the eye of the dice
 | 
			
		||||
     * @return a new Dice object
 | 
			
		||||
     */
 | 
			
		||||
    public static Dice inactivePlayer(int diceEye) {
 | 
			
		||||
        return new Dice(diceEye, null);
 | 
			
		||||
    public static Die inactivePlayer(int diceEye) {
 | 
			
		||||
        return new Die(diceEye, null);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -56,8 +56,8 @@ public static Dice inactivePlayer(int diceEye) {
 | 
			
		||||
     * @param moveablePieces the pieces that can be moved
 | 
			
		||||
     * @return a new Dice object
 | 
			
		||||
     */
 | 
			
		||||
    public static Dice activePlayer(int diceEye, List<String> moveablePieces) {
 | 
			
		||||
        return new Dice(diceEye, moveablePieces);
 | 
			
		||||
    public static Die activePlayer(int diceEye, List<String> moveablePieces) {
 | 
			
		||||
        return new Die(diceEye, moveablePieces);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -13,14 +13,20 @@ public class LobbyPlayerJoin extends ServerMessage {
 | 
			
		||||
     */
 | 
			
		||||
    private final String name;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The ID of the new Player
 | 
			
		||||
     */
 | 
			
		||||
    private final int id;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a new LobbyPlayerJoin instance with the specified player name.
 | 
			
		||||
     *
 | 
			
		||||
     * @param name the name of the player joining the lobby
 | 
			
		||||
     */
 | 
			
		||||
    public LobbyPlayerJoin(String name) {
 | 
			
		||||
    public LobbyPlayerJoin(int id, String name) {
 | 
			
		||||
        super();
 | 
			
		||||
        this.name = name;
 | 
			
		||||
        this.id = id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -28,6 +34,7 @@ public LobbyPlayerJoin(String name) {
 | 
			
		||||
     */
 | 
			
		||||
    private LobbyPlayerJoin() {
 | 
			
		||||
        name = null;
 | 
			
		||||
        id = 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -39,6 +46,15 @@ public String getName() {
 | 
			
		||||
        return name;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the id of the new Player
 | 
			
		||||
     *
 | 
			
		||||
     * @return the id of the player
 | 
			
		||||
     */
 | 
			
		||||
    public int getId(){
 | 
			
		||||
        return id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Accepts a visitor to process this message.
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,7 @@ public class LobbyPlayerLeave extends ServerMessage {
 | 
			
		||||
    /**
 | 
			
		||||
     * The name of the player leaving the lobby.
 | 
			
		||||
     */
 | 
			
		||||
    private final String name;
 | 
			
		||||
    private final int id;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The color associated with the player leaving the lobby.
 | 
			
		||||
@@ -21,12 +21,12 @@ public class LobbyPlayerLeave extends ServerMessage {
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a new LobbyPlayerLeave instance with the specified player name and color.
 | 
			
		||||
     *
 | 
			
		||||
     * @param name  the name of the player leaving the lobby
 | 
			
		||||
     * @param id  the id of the player leaving the lobby
 | 
			
		||||
     * @param color the color associated with the player leaving the lobby
 | 
			
		||||
     */
 | 
			
		||||
    public LobbyPlayerLeave(String name, Color color) {
 | 
			
		||||
    public LobbyPlayerLeave(int id, Color color) {
 | 
			
		||||
        super();
 | 
			
		||||
        this.name = name;
 | 
			
		||||
        this.id = id;
 | 
			
		||||
        this.color = color;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -34,7 +34,7 @@ public LobbyPlayerLeave(String name, Color color) {
 | 
			
		||||
     * Default constructor for serialization purposes.
 | 
			
		||||
     */
 | 
			
		||||
    private LobbyPlayerLeave() {
 | 
			
		||||
        name = null;
 | 
			
		||||
        id = 0;
 | 
			
		||||
        color = null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -43,8 +43,8 @@ private LobbyPlayerLeave() {
 | 
			
		||||
     *
 | 
			
		||||
     * @return the name of the player leaving the lobby
 | 
			
		||||
     */
 | 
			
		||||
    public String getName() {
 | 
			
		||||
        return name;
 | 
			
		||||
    public int getId() {
 | 
			
		||||
        return id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -34,11 +34,11 @@ public interface ServerInterpreter {
 | 
			
		||||
    void received(CeremonyMessage msg);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Handles a Dice message received from the server.
 | 
			
		||||
     * Handles a Die message received from the server.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the Dice message received
 | 
			
		||||
     */
 | 
			
		||||
    void received(Dice msg);
 | 
			
		||||
    void received(Die msg);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Handles a DiceAgain message received from the server.
 | 
			
		||||
@@ -193,4 +193,11 @@ public interface ServerInterpreter {
 | 
			
		||||
     * @param msg the WaitPiece message received
 | 
			
		||||
     */
 | 
			
		||||
    void received(WaitPiece msg);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Handles a Spectator message received from the server.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the Spectator message received.
 | 
			
		||||
     */
 | 
			
		||||
    void received(Spectator msg);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,32 @@
 | 
			
		||||
package pp.mdga.message.server;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
public class Spectator extends ServerMessage {
 | 
			
		||||
    /**
 | 
			
		||||
     * Construc
 | 
			
		||||
     */
 | 
			
		||||
    public Spectator() {
 | 
			
		||||
        super();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     *
 | 
			
		||||
     * @param interpreter the visitor to process this message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void accept(ServerInterpreter interpreter) {
 | 
			
		||||
        interpreter.received(this);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     *
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public String getInfoTextKey() {
 | 
			
		||||
        return "";
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -11,7 +11,7 @@ public class UpdateTSK extends ServerMessage {
 | 
			
		||||
    /**
 | 
			
		||||
     * The name associated with the update.
 | 
			
		||||
     */
 | 
			
		||||
    private final String name;
 | 
			
		||||
    private final int id;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The color associated with the update.
 | 
			
		||||
@@ -21,12 +21,12 @@ public class UpdateTSK extends ServerMessage {
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a new UpdateTSK instance with the specified name and color.
 | 
			
		||||
     *
 | 
			
		||||
     * @param name  the name associated with the update
 | 
			
		||||
     * @param id  the name associated with the update
 | 
			
		||||
     * @param color the color associated with the update
 | 
			
		||||
     */
 | 
			
		||||
    public UpdateTSK(String name, Color color) {
 | 
			
		||||
    public UpdateTSK(int id, Color color) {
 | 
			
		||||
        super();
 | 
			
		||||
        this.name = name;
 | 
			
		||||
        this.id = id;
 | 
			
		||||
        this.color = color;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -34,7 +34,7 @@ public UpdateTSK(String name, Color color) {
 | 
			
		||||
     * Default constructor for serialization purposes.
 | 
			
		||||
     */
 | 
			
		||||
    private UpdateTSK() {
 | 
			
		||||
        this("", null);
 | 
			
		||||
        this(0, null);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -42,8 +42,8 @@ private UpdateTSK() {
 | 
			
		||||
     *
 | 
			
		||||
     * @return the name
 | 
			
		||||
     */
 | 
			
		||||
    public String getName() {
 | 
			
		||||
        return name;
 | 
			
		||||
    public int getId() {
 | 
			
		||||
        return id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +0,0 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class Ceremony extends ServerState {
 | 
			
		||||
    public Ceremony(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,7 +0,0 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class ChoosePiece extends Turn {
 | 
			
		||||
    public ChoosePiece(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class ChoosePieceState extends TurnState {
 | 
			
		||||
    public ChoosePieceState(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,9 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
import pp.mdga.server.automaton.GameState;
 | 
			
		||||
 | 
			
		||||
public class DetermineStartPlayerState extends GameState {
 | 
			
		||||
    public DetermineStartPlayerState(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,7 +0,0 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class FirstRoll extends RollDice {
 | 
			
		||||
    public FirstRoll(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class FirstRollStateState extends RollDiceState {
 | 
			
		||||
    public FirstRollStateState(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,7 +0,0 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class Interrupt extends ServerState {
 | 
			
		||||
    public Interrupt(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,14 +0,0 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class Lobby extends ServerState {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a server state of the specified game logic.
 | 
			
		||||
     *
 | 
			
		||||
     * @param logic the game logic
 | 
			
		||||
     */
 | 
			
		||||
    public Lobby(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,7 +0,0 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class MovePiece extends Turn {
 | 
			
		||||
    public MovePiece(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class MovePieceState extends TurnState {
 | 
			
		||||
    public MovePieceState(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,7 +0,0 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class NoPiece extends ChoosePiece {
 | 
			
		||||
    public NoPiece(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class NoPieceState extends ChoosePieceState {
 | 
			
		||||
    public NoPieceState(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,7 +0,0 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class NoTurn extends ChoosePiece {
 | 
			
		||||
    public NoTurn(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class NoTurnState extends ChoosePieceState {
 | 
			
		||||
    public NoTurnState(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,7 +0,0 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class PowerCard extends Turn {
 | 
			
		||||
    public PowerCard(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class PowerCardState extends TurnState {
 | 
			
		||||
    public PowerCardState(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,7 +0,0 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class RollDice extends Turn {
 | 
			
		||||
    public RollDice(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class RollDiceState extends TurnState {
 | 
			
		||||
    public RollDiceState(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,7 +0,0 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class SecondRoll extends RollDice {
 | 
			
		||||
    public SecondRoll(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class SecondRollState extends RollDiceState {
 | 
			
		||||
    public SecondRollState(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,7 +0,0 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class SelectPiece extends ChoosePiece {
 | 
			
		||||
    public SelectPiece(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class SelectPieceState extends ChoosePieceState {
 | 
			
		||||
    public SelectPieceState(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -13,4 +13,12 @@ public interface ServerSender {
 | 
			
		||||
     * @param message the message
 | 
			
		||||
     */
 | 
			
		||||
    void send(int id, ServerMessage message);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be used to send the given message parameter to all connected players which are saved inside the
 | 
			
		||||
     * players attribute of Game class.
 | 
			
		||||
     *
 | 
			
		||||
     * @param message as the message which will be sent to all players as a ServerMessage.
 | 
			
		||||
     */
 | 
			
		||||
    void broadcast(ServerMessage message);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,25 +0,0 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Defines the behavior and state transitions for the server-side game logic.
 | 
			
		||||
 * Different states of the game logic implement this interface to handle various game events and actions.
 | 
			
		||||
 */
 | 
			
		||||
public class ServerState {
 | 
			
		||||
    /**
 | 
			
		||||
     * The server logic object.
 | 
			
		||||
     */
 | 
			
		||||
    private final ServerGameLogic logic;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a server state of the specified game logic.
 | 
			
		||||
     *
 | 
			
		||||
     * @param logic the game logic
 | 
			
		||||
     */
 | 
			
		||||
    public ServerState(ServerGameLogic logic) {
 | 
			
		||||
        this.logic = logic;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,7 +0,0 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class StartPiece extends ChoosePiece {
 | 
			
		||||
    public StartPiece(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class StartPieceState extends ChoosePieceState {
 | 
			
		||||
    public StartPieceState(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,7 +0,0 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class ThirdRoll extends RollDice {
 | 
			
		||||
    public ThirdRoll(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class ThirdRollState extends RollDiceState {
 | 
			
		||||
    public ThirdRollState(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,9 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
import pp.mdga.server.automaton.GameState;
 | 
			
		||||
 | 
			
		||||
public class TurnState extends GameState {
 | 
			
		||||
    public TurnState(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,7 +0,0 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class WaitingPiece extends ChoosePiece {
 | 
			
		||||
    public WaitingPiece(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
package pp.mdga.server;
 | 
			
		||||
 | 
			
		||||
public class WaitingPieceState extends ChoosePieceState {
 | 
			
		||||
    public WaitingPieceState(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,33 @@
 | 
			
		||||
package pp.mdga.server.automaton;
 | 
			
		||||
 | 
			
		||||
import pp.mdga.server.ServerGameLogic;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
public class CeremonyState extends ServerState {
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructor.
 | 
			
		||||
     *
 | 
			
		||||
     * @param logic as the server game logic which is the automaton as a ServerGameLogic object.
 | 
			
		||||
     */
 | 
			
		||||
    public CeremonyState(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be used whenever this state will be entered.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
        // ToDo: Close server.
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be used whenever this state will be exited.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,60 @@
 | 
			
		||||
package pp.mdga.server.automaton;
 | 
			
		||||
 | 
			
		||||
import pp.mdga.message.client.Disconnected;
 | 
			
		||||
import pp.mdga.message.client.LeaveGame;
 | 
			
		||||
import pp.mdga.message.server.PauseGame;
 | 
			
		||||
import pp.mdga.server.ServerGameLogic;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
public class GameState extends ServerState {
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructor.
 | 
			
		||||
     *
 | 
			
		||||
     * @param logic as the server game logic which is the automaton as a ServerGameLogic object.
 | 
			
		||||
     */
 | 
			
		||||
    public GameState(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be used whenever this state will be entered.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be used whenever this state will be exited.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a Disconnected object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(Disconnected msg, int from) {
 | 
			
		||||
        this.logic.getServerSender().broadcast(new PauseGame());
 | 
			
		||||
        this.logic.setCurrentState(this.logic.getInterruptState());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a LeaveGame object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(LeaveGame msg, int from) {
 | 
			
		||||
        this.logic.getGame().updatePlayerActiveState(from, false);
 | 
			
		||||
        if (this.logic.getGame().getNumberOfActivePlayers() == 1) {
 | 
			
		||||
            this.logic.setCurrentState(this.logic.getCeremonyState());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,47 @@
 | 
			
		||||
package pp.mdga.server.automaton;
 | 
			
		||||
 | 
			
		||||
import com.jme3.system.Timer;
 | 
			
		||||
import pp.mdga.message.client.ForceContinueGame;
 | 
			
		||||
import pp.mdga.message.server.ResumeGame;
 | 
			
		||||
import pp.mdga.server.ServerGameLogic;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
public class InterruptState extends ServerState {
 | 
			
		||||
    /**
 | 
			
		||||
     * Attributes.
 | 
			
		||||
     */
 | 
			
		||||
    private Timer timer;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructor.
 | 
			
		||||
     *
 | 
			
		||||
     * @param logic as the server game logic which is the automaton as a ServerGameLogic object.
 | 
			
		||||
     */
 | 
			
		||||
    public InterruptState(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be used whenever this state will be entered.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
        // Create timer and connect signal.
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be used whenever this state will be exited.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(ForceContinueGame msg, int from) {
 | 
			
		||||
        this.logic.getServerSender().broadcast(new ResumeGame());
 | 
			
		||||
        this.logic.setCurrentState(this.logic.getGameState());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,88 @@
 | 
			
		||||
package pp.mdga.server.automaton;
 | 
			
		||||
 | 
			
		||||
import pp.mdga.message.client.*;
 | 
			
		||||
import pp.mdga.message.server.ServerStartGame;
 | 
			
		||||
import pp.mdga.message.server.UpdateReady;
 | 
			
		||||
import pp.mdga.message.server.UpdateTSK;
 | 
			
		||||
import pp.mdga.server.ServerGameLogic;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
public class LobbyState extends ServerState {
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a server state of the specified game logic.
 | 
			
		||||
     *
 | 
			
		||||
     * @param logic the game logic
 | 
			
		||||
     */
 | 
			
		||||
    public LobbyState(ServerGameLogic logic) {
 | 
			
		||||
        super(logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be used whenever this state will be entered.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be used whenever this state will be exited.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a SelectTSK object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(SelectTSK msg, int from) {
 | 
			
		||||
        this.logic.getServerSender().broadcast(new UpdateTSK(from, msg.getColor()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a DeselectTSK object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(DeselectTSK msg, int from) {
 | 
			
		||||
        this.logic.getServerSender().broadcast(new UpdateTSK(from, msg.getColor()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a LobbyReady object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(LobbyReady msg, int from) {
 | 
			
		||||
        this.logic.getServerSender().broadcast(new UpdateReady(from, true));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a LobbyNotReady object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(LobbyNotReady msg, int from) {
 | 
			
		||||
        this.logic.getServerSender().broadcast(new UpdateReady(from, false));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a ForceStartGame object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(ForceStartGame msg, int from) {
 | 
			
		||||
        this.logic.getServerSender().broadcast(new ServerStartGame());
 | 
			
		||||
        this.logic.setCurrentState(this.logic.getGameState());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,196 @@
 | 
			
		||||
package pp.mdga.server.automaton;
 | 
			
		||||
 | 
			
		||||
import pp.mdga.message.client.*;
 | 
			
		||||
import pp.mdga.server.ServerGameLogic;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Defines the behavior and state transitions for the server-side game logic.
 | 
			
		||||
 * Different states of the game logic implement this interface to handle various game events and actions.
 | 
			
		||||
 */
 | 
			
		||||
public abstract class ServerState {
 | 
			
		||||
    /**
 | 
			
		||||
     * The server logic object.
 | 
			
		||||
     */
 | 
			
		||||
    protected final ServerGameLogic logic;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a server state of the specified game logic.
 | 
			
		||||
     *
 | 
			
		||||
     * @param logic the game logic
 | 
			
		||||
     */
 | 
			
		||||
    public ServerState(ServerGameLogic logic) {
 | 
			
		||||
        this.logic = logic;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be used whenever this state will be entered.
 | 
			
		||||
     */
 | 
			
		||||
    public abstract void enter();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be used whenever this state will be exited.
 | 
			
		||||
     */
 | 
			
		||||
    public abstract void exit();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the server received an AnimationEnd message.
 | 
			
		||||
     * It will also get the client id of the player who send this message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a AnimationEnd object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    public void received(AnimationEnd msg, int from) {}
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the server received an DeselectTSK message.
 | 
			
		||||
     * It will also get the client id of the player who send this message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a DeselectTSK object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    public void received(DeselectTSK msg, int from) {}
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the server received a StartGame message.
 | 
			
		||||
     * It will also get the client id of the player who send this message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a StartGame object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    public void received(StartGame msg, int from) {}
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the server received a JoinServer message.
 | 
			
		||||
     * It will also get the client id of the player who send this message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a JoinServer object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    public void received(JoinServer msg, int from) {}
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the server received an LeaveGame message.
 | 
			
		||||
     * It will also get the client id of the player who send this message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a LeaveGame object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    public void received(LeaveGame msg, int from) {}
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the server received a LobbyReady message.
 | 
			
		||||
     * It will also get the client id of the player who send this message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a LobbyReady object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    public void received(LobbyReady msg, int from) {}
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the server received a LobbyNotReady message.
 | 
			
		||||
     * It will also get the client id of the player who send this message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a LobbyNotReady object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    public void received(LobbyNotReady msg, int from) {}
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the server received a Disconnected message.
 | 
			
		||||
     * It will also get the client id of the player who send this message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a Disconnected object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    public void received(Disconnected msg, int from) {}
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the server received a Briefing message.
 | 
			
		||||
     * It will also get the client id of the player who send this message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a Briefing object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    public void received(RequestBriefing msg, int from) {}
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the server received a Die message.
 | 
			
		||||
     * It will also get the client id of the player who send this message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a Die object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    public void received(RequestDie msg, int from) {}
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the server received a RequestMove message.
 | 
			
		||||
     * It will also get the client id of the player who send this message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a RequestMove object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    public void received(RequestMove msg, int from) {}
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the server received a PlayCard message.
 | 
			
		||||
     * It will also get the client id of the player who send this message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a PlayCard object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    public void received(RequestPlayCard msg, int from) {}
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the server received a SelectCard message.
 | 
			
		||||
     * It will also get the client id of the player who send this message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a SelectCard object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    public void received(SelectCard msg, int from) {}
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the server received a SelectTSK message.
 | 
			
		||||
     * It will also get the client id of the player who send this message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a SelectTSK object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    public void received(SelectTSK msg, int from) {}
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the server received a ForceContinueGame message.
 | 
			
		||||
     * It will also get the client id of the player who send this message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a ForceContinueGame object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    public void received(ForceContinueGame msg, int from) {}
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the server received a ClientStartGame message.
 | 
			
		||||
     * It will also get the client id of the player who send this message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a ClientStartGame object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    public void received(ClientStartGame msg, int from) {}
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the server received a NoPowerCard message.
 | 
			
		||||
     * It will also get the client id of the player who send this message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a NoPowerCard object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    public void received(NoPowerCard msg, int from) {}
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the server received a SelectedPieces message.
 | 
			
		||||
     * It will also get the client id of the player who send this message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a SelectedPieces object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    public void received(SelectedPieces msg, int from) {}
 | 
			
		||||
}
 | 
			
		||||
@@ -6,7 +6,7 @@
 | 
			
		||||
/**
 | 
			
		||||
 * this test-class tests the testcases T084-T095
 | 
			
		||||
 */
 | 
			
		||||
public class LobbyTest {
 | 
			
		||||
public class LobbyStateTest {
 | 
			
		||||
 | 
			
		||||
    @Before
 | 
			
		||||
    public void setUp() {
 | 
			
		||||
@@ -4,10 +4,8 @@
 | 
			
		||||
import org.junit.Test;
 | 
			
		||||
import pp.mdga.client.*;
 | 
			
		||||
import pp.mdga.client.Ceremony;
 | 
			
		||||
import pp.mdga.client.ceremonyState.CeremonyStateMachine;
 | 
			
		||||
import pp.mdga.client.ceremonyState.Podium;
 | 
			
		||||
import pp.mdga.client.ceremonyState.Statistics;
 | 
			
		||||
import pp.mdga.client.dialogState.DialogsStateMachine;
 | 
			
		||||
import pp.mdga.client.dialogState.Lobby;
 | 
			
		||||
import pp.mdga.client.dialogState.NetworkDialog;
 | 
			
		||||
import pp.mdga.client.dialogState.StartDialog;
 | 
			
		||||
@@ -16,13 +14,11 @@
 | 
			
		||||
import pp.mdga.client.gameState.determineStartPlayer.DetermineStartPlayerStateMachine;
 | 
			
		||||
import pp.mdga.client.gameState.turnState.*;
 | 
			
		||||
import pp.mdga.client.gameState.turnState.powerCardState.ChoosePowerCard;
 | 
			
		||||
import pp.mdga.client.gameState.turnState.powerCardState.PowerCardStateMachine;
 | 
			
		||||
import pp.mdga.client.gameState.turnState.powerCardState.Shield;
 | 
			
		||||
import pp.mdga.client.gameState.turnState.powerCardState.Swap;
 | 
			
		||||
import pp.mdga.client.Settings;
 | 
			
		||||
import pp.mdga.client.settingsState.AudioSettings;
 | 
			
		||||
import pp.mdga.client.settingsState.MainSettings;
 | 
			
		||||
import pp.mdga.client.settingsState.SettingsStateMachine;
 | 
			
		||||
import pp.mdga.client.settingsState.VideoSettings;
 | 
			
		||||
import pp.mdga.game.BonusCard;
 | 
			
		||||
import pp.mdga.game.Color;
 | 
			
		||||
@@ -53,7 +49,7 @@ public class ClientStateTest {
 | 
			
		||||
    private DetermineStartPlayerStateMachine determineStartPlayerStateMachine;
 | 
			
		||||
    private Dialogs dialogs;
 | 
			
		||||
    private DialogsStateMachine dialogsStateMachine;
 | 
			
		||||
    private Game gameState;
 | 
			
		||||
    private GameState gameState;
 | 
			
		||||
    private GameStateMachine gameStateMachine;
 | 
			
		||||
    private Interrupt interrupt;
 | 
			
		||||
    private Lobby lobby;
 | 
			
		||||
@@ -197,7 +193,7 @@ public void send(ClientMessage msg) {
 | 
			
		||||
 | 
			
		||||
        //initialize the states
 | 
			
		||||
        dialogs = new Dialogs(clientAutomaton,clientGameLogic);
 | 
			
		||||
        gameState = new Game(clientAutomaton,clientGameLogic);
 | 
			
		||||
        gameState = new GameState(clientAutomaton,clientGameLogic);
 | 
			
		||||
        ceremony = new Ceremony(clientAutomaton,clientGameLogic);
 | 
			
		||||
        interrupt = new Interrupt(clientAutomaton,clientGameLogic,gameState);
 | 
			
		||||
 | 
			
		||||
@@ -261,10 +257,10 @@ public void testDialogsToGame() {
 | 
			
		||||
        clientGameLogic.receive(startGame);
 | 
			
		||||
 | 
			
		||||
        //tests if the client is in the gameState after receiving the message
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //tests if the new State of the GameStateMachine is in DetermineStartPlayer
 | 
			
		||||
        Game gameState1 = (Game) clientAutomaton.getState();
 | 
			
		||||
        GameState gameState1 = (GameState) clientAutomaton.getState();
 | 
			
		||||
        GameStateMachine gameStateMachine1 = gameState1.getGameStateMachine();
 | 
			
		||||
        assertTrue(gameStateMachine1.getState() instanceof DetermineStartPlayer);
 | 
			
		||||
 | 
			
		||||
@@ -290,7 +286,7 @@ public void testDialogsToClientStateEndState() {
 | 
			
		||||
    public void testClientGameToCeremony() {
 | 
			
		||||
        //sends the ClientAutomaton in GameState
 | 
			
		||||
        clientAutomaton.gotoState(gameState);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the Ceremony-Message to the client
 | 
			
		||||
        clientGameLogic.receive(ceremonyMessage);
 | 
			
		||||
@@ -313,7 +309,7 @@ public void testClientGameSubStatesToInterrupt() {
 | 
			
		||||
        clientAutomaton.gotoState(gameState);
 | 
			
		||||
 | 
			
		||||
        //tests if the client is in GameState
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the Ceremony-Message to the client
 | 
			
		||||
        clientGameLogic.receive(interrupt);
 | 
			
		||||
@@ -356,7 +352,7 @@ public void testClientInterruptToGame() {
 | 
			
		||||
        //Todo sends the continue-message
 | 
			
		||||
 | 
			
		||||
        //tests if the client is in the game
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -580,10 +576,10 @@ public void testLobbyToRollRankingDice() {
 | 
			
		||||
        clientGameLogic.receive();//TODO message
 | 
			
		||||
 | 
			
		||||
        //tests if the clientStateMachine is in the GameState
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //tests if the clientStateMachine is in the DetermineStartPlayer
 | 
			
		||||
        Game gameState1 = (Game) clientAutomaton.getState();
 | 
			
		||||
        GameState gameState1 = (GameState) clientAutomaton.getState();
 | 
			
		||||
        GameStateMachine gameStateMachine1 = gameState1.getGameStateMachine();
 | 
			
		||||
        assertTrue(gameStateMachine1.getState() instanceof DetermineStartPlayer);
 | 
			
		||||
 | 
			
		||||
@@ -608,7 +604,7 @@ public void testDetermineStartPlayerToWait() {
 | 
			
		||||
    public void testWaitToAnimation() {
 | 
			
		||||
        //sends the ClientAutomaton in GameState
 | 
			
		||||
        clientAutomaton.gotoState(gameState);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the client in WaitState
 | 
			
		||||
        gameStateMachine.gotoState(waiting);
 | 
			
		||||
@@ -616,7 +612,7 @@ public void testWaitToAnimation() {
 | 
			
		||||
 | 
			
		||||
        //tests if a piece is moved,that the client goes into Animation
 | 
			
		||||
        clientGameLogic.receive(moveMessage); //Todo ??? richtige message
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Animation);
 | 
			
		||||
 | 
			
		||||
        //sends the client in WaitState
 | 
			
		||||
@@ -625,7 +621,7 @@ public void testWaitToAnimation() {
 | 
			
		||||
 | 
			
		||||
        //tests if a powerCard is played,that the client goes into Animation
 | 
			
		||||
        clientGameLogic.receive(playCardTurbo); //Todo ??? richtige message
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Animation);
 | 
			
		||||
 | 
			
		||||
        //sends the client in WaitState
 | 
			
		||||
@@ -634,7 +630,7 @@ public void testWaitToAnimation() {
 | 
			
		||||
 | 
			
		||||
        //tests if a die is rolled,that the client goes into Animation
 | 
			
		||||
        clientGameLogic.receive(dice); //Todo ??? richtige message
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Animation);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -645,7 +641,7 @@ public void testWaitToAnimation() {
 | 
			
		||||
    public void testWaitToTurn() {
 | 
			
		||||
        //sends client in gameState
 | 
			
		||||
        clientAutomaton.gotoState(gameState);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in the Waiting
 | 
			
		||||
        gameStateMachine.gotoState(waiting);
 | 
			
		||||
@@ -655,7 +651,7 @@ public void testWaitToTurn() {
 | 
			
		||||
        clientGameLogic.receive(activePlayer);
 | 
			
		||||
 | 
			
		||||
        //tests if the client is in GameState
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //tests if Client is in Turn
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
@@ -732,7 +728,7 @@ public void testPowerCardSubStatesToRollDice() {
 | 
			
		||||
    public void testStayInPlayPowerCard() {
 | 
			
		||||
        //sends the ClientAutomaton in GameState
 | 
			
		||||
        clientAutomaton.gotoState(gameState);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in the Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
@@ -745,7 +741,7 @@ public void testStayInPlayPowerCard() {
 | 
			
		||||
        //Todo send messages to test to stay in playPowerCard
 | 
			
		||||
 | 
			
		||||
        //tests if the client is in PlayPowerCard
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof PlayPowerCard);
 | 
			
		||||
    }
 | 
			
		||||
@@ -757,7 +753,7 @@ public void testStayInPlayPowerCard() {
 | 
			
		||||
    public void testPlayPowerCardToRollDice() {
 | 
			
		||||
        //sends the ClientAutomaton in GameState
 | 
			
		||||
        clientAutomaton.gotoState(gameState);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in the Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
@@ -771,7 +767,7 @@ public void testPlayPowerCardToRollDice() {
 | 
			
		||||
        //Todo test other messages, that there is no state change
 | 
			
		||||
 | 
			
		||||
        //tests if the client is in RollDice
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof RollDice);
 | 
			
		||||
    }
 | 
			
		||||
@@ -857,7 +853,7 @@ public void testChoosePowerCardToRollDice() {
 | 
			
		||||
        //TODO
 | 
			
		||||
        //sends the ClientAutomaton in GameState
 | 
			
		||||
        clientAutomaton.gotoState(gameState);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in the Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
@@ -874,7 +870,7 @@ public void testChoosePowerCardToRollDice() {
 | 
			
		||||
        //todo send the messages, to force a state change to rollDice
 | 
			
		||||
 | 
			
		||||
        //tests if the turnStateMachine is in RollDice
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof RollDice);
 | 
			
		||||
    }
 | 
			
		||||
@@ -886,7 +882,7 @@ public void testChoosePowerCardToRollDice() {
 | 
			
		||||
    public void testChoosePowerCardToSwap() {
 | 
			
		||||
        //sends the ClientAutomaton in GameState
 | 
			
		||||
        clientAutomaton.gotoState(gameState);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in the Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
@@ -903,7 +899,7 @@ public void testChoosePowerCardToSwap() {
 | 
			
		||||
        //todo send the messages, to force a state change to swap
 | 
			
		||||
 | 
			
		||||
        //tests if the client is in Swap
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof PowerCard);
 | 
			
		||||
        assertTrue(powerCardStateMachine.getState() instanceof Swap);
 | 
			
		||||
@@ -916,7 +912,7 @@ public void testChoosePowerCardToSwap() {
 | 
			
		||||
    public void testChoosePowerCardToShield() {
 | 
			
		||||
        //sends the ClientAutomaton in GameState
 | 
			
		||||
        clientAutomaton.gotoState(gameState);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in the Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
@@ -933,7 +929,7 @@ public void testChoosePowerCardToShield() {
 | 
			
		||||
        //todo send the messages, to force a state change to shield
 | 
			
		||||
 | 
			
		||||
        //tests if the client is in Shield
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof PowerCard);
 | 
			
		||||
        assertTrue(powerCardStateMachine.getState() instanceof Shield);
 | 
			
		||||
@@ -946,7 +942,7 @@ public void testChoosePowerCardToShield() {
 | 
			
		||||
    public void testStayInShield() {
 | 
			
		||||
        //sends the ClientAutomaton in GameState
 | 
			
		||||
        clientAutomaton.gotoState(gameState);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in the Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
@@ -963,7 +959,7 @@ public void testStayInShield() {
 | 
			
		||||
        //todo send the messages, which dont force a statechange
 | 
			
		||||
 | 
			
		||||
        //tests if the client is in PlayPowerCard
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof PowerCard);
 | 
			
		||||
        assertTrue(powerCardStateMachine.getState() instanceof PlayPowerCard);
 | 
			
		||||
@@ -976,7 +972,7 @@ public void testStayInShield() {
 | 
			
		||||
    public void testShieldToPowerCardEndState() {
 | 
			
		||||
        //sends the ClientAutomaton in GameState
 | 
			
		||||
        clientAutomaton.gotoState(gameState);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in the Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
@@ -994,7 +990,7 @@ public void testShieldToPowerCardEndState() {
 | 
			
		||||
        //todo send the message to force the statechange
 | 
			
		||||
 | 
			
		||||
        //tests if the client is in PlayPowerCard
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof PlayPowerCard);
 | 
			
		||||
    }
 | 
			
		||||
@@ -1006,7 +1002,7 @@ public void testShieldToPowerCardEndState() {
 | 
			
		||||
    public void testSwapToPowerCardEndState() {
 | 
			
		||||
        //sends the ClientAutomaton in GameState
 | 
			
		||||
        clientAutomaton.gotoState(gameState);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in the Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
@@ -1023,7 +1019,7 @@ public void testSwapToPowerCardEndState() {
 | 
			
		||||
        //todo send the message to force the statechange
 | 
			
		||||
 | 
			
		||||
        //tests if the client is in PlayPowerCard
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof PlayPowerCard);
 | 
			
		||||
    }
 | 
			
		||||
@@ -1035,7 +1031,7 @@ public void testSwapToPowerCardEndState() {
 | 
			
		||||
    public void testNoPieceInWaitingPiece() {
 | 
			
		||||
        //sends the ClientAutomaton in GameState
 | 
			
		||||
        clientAutomaton.gotoState(gameState);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in the Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
@@ -1054,7 +1050,7 @@ public void testNoPieceInWaitingPiece() {
 | 
			
		||||
        //sends to the clientGameLogic the message WaitPiece
 | 
			
		||||
        clientGameLogic.receive(waitPiece);
 | 
			
		||||
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof WaitingPiece);
 | 
			
		||||
@@ -1067,7 +1063,7 @@ public void testNoPieceInWaitingPiece() {
 | 
			
		||||
    public void testNoPieceInSelectedPiece() {
 | 
			
		||||
        //sends the ClientAutomaton in GameState
 | 
			
		||||
        clientAutomaton.gotoState(gameState);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in the Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
@@ -1086,7 +1082,7 @@ public void testNoPieceInSelectedPiece() {
 | 
			
		||||
        //sends to the clientGameLogic the message SelectPiece
 | 
			
		||||
        clientGameLogic.receive(selectPiece);
 | 
			
		||||
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof SelectPiece);
 | 
			
		||||
@@ -1099,7 +1095,7 @@ public void testNoPieceInSelectedPiece() {
 | 
			
		||||
    public void testNoPieceInStartPiece() {
 | 
			
		||||
        //sends the ClientAutomaton in GameState
 | 
			
		||||
        clientAutomaton.gotoState(gameState);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in the Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
@@ -1118,7 +1114,7 @@ public void testNoPieceInStartPiece() {
 | 
			
		||||
        //sends to the clientGameLogic the message StartPiece
 | 
			
		||||
        clientGameLogic.receive(startPiece);
 | 
			
		||||
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof StartPiece);
 | 
			
		||||
@@ -1131,7 +1127,7 @@ public void testNoPieceInStartPiece() {
 | 
			
		||||
    public void testNoPieceInWait() {
 | 
			
		||||
        //sends the ClientAutomaton in GameState
 | 
			
		||||
        clientAutomaton.gotoState(gameState);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in the Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
@@ -1150,7 +1146,7 @@ public void testNoPieceInWait() {
 | 
			
		||||
        //sends to the clientGameLogic the message NoTurn
 | 
			
		||||
        clientGameLogic.receive(noTurn);
 | 
			
		||||
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof Waiting);
 | 
			
		||||
    }
 | 
			
		||||
@@ -1162,7 +1158,7 @@ public void testNoPieceInWait() {
 | 
			
		||||
    public void testStayInWaitingPiece() {
 | 
			
		||||
        //sends the ClientAutomaton in GameState
 | 
			
		||||
        clientAutomaton.gotoState(gameState);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in the Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
@@ -1178,7 +1174,7 @@ public void testStayInWaitingPiece() {
 | 
			
		||||
 | 
			
		||||
        //TODO send all sever-messages except ... to the clientGameLogic to test there are no state change
 | 
			
		||||
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof WaitingPiece);
 | 
			
		||||
@@ -1191,7 +1187,7 @@ public void testStayInWaitingPiece() {
 | 
			
		||||
    public void testWaitingPieceInChoosePieceEndState() {
 | 
			
		||||
        //sends the ClientAutomaton in GameState
 | 
			
		||||
        clientAutomaton.gotoState(gameState);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in the Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
@@ -1207,7 +1203,7 @@ public void testWaitingPieceInChoosePieceEndState() {
 | 
			
		||||
 | 
			
		||||
        //Todo send the message to the clientGameLogic to force a state change
 | 
			
		||||
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof MovePiece);
 | 
			
		||||
    }
 | 
			
		||||
@@ -1219,7 +1215,7 @@ public void testWaitingPieceInChoosePieceEndState() {
 | 
			
		||||
    public void testStayInSelectedPiece() {
 | 
			
		||||
        //sends the ClientAutomaton in GameState
 | 
			
		||||
        clientAutomaton.gotoState(gameState);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in the Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
@@ -1235,7 +1231,7 @@ public void testStayInSelectedPiece() {
 | 
			
		||||
 | 
			
		||||
        //Todo send all server messages which dont force a state change here
 | 
			
		||||
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof SelectPiece);
 | 
			
		||||
@@ -1248,7 +1244,7 @@ public void testStayInSelectedPiece() {
 | 
			
		||||
    public void testSelectedPieceInChoosePieceEndState() {
 | 
			
		||||
        //sends the ClientAutomaton in GameState
 | 
			
		||||
        clientAutomaton.gotoState(gameState);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in the Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
@@ -1264,7 +1260,7 @@ public void testSelectedPieceInChoosePieceEndState() {
 | 
			
		||||
 | 
			
		||||
        //Todo send the message which force a state change
 | 
			
		||||
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof MovePiece);
 | 
			
		||||
    }
 | 
			
		||||
@@ -1276,7 +1272,7 @@ public void testSelectedPieceInChoosePieceEndState() {
 | 
			
		||||
    public void testStayInStartPiece() {
 | 
			
		||||
        //sends the ClientAutomaton in GameState
 | 
			
		||||
        clientAutomaton.gotoState(gameState);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in the Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
@@ -1292,7 +1288,7 @@ public void testStayInStartPiece() {
 | 
			
		||||
 | 
			
		||||
        //todo send all messages which dont force a state change
 | 
			
		||||
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof StartPiece);
 | 
			
		||||
@@ -1305,7 +1301,7 @@ public void testStayInStartPiece() {
 | 
			
		||||
    public void testStartPieceToChoosePieceEndState() {
 | 
			
		||||
        //sends the ClientAutomaton in GameState
 | 
			
		||||
        clientAutomaton.gotoState(gameState);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in the Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
@@ -1321,7 +1317,7 @@ public void testStartPieceToChoosePieceEndState() {
 | 
			
		||||
 | 
			
		||||
        //Todo send the message which force a state change
 | 
			
		||||
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof Game);
 | 
			
		||||
        assertTrue(clientAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof MovePiece);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -5,6 +5,11 @@
 | 
			
		||||
import pp.mdga.game.Game;
 | 
			
		||||
import pp.mdga.message.server.ServerMessage;
 | 
			
		||||
import pp.mdga.server.*;
 | 
			
		||||
import pp.mdga.server.automaton.CeremonyState;
 | 
			
		||||
import pp.mdga.server.automaton.InterruptState;
 | 
			
		||||
import pp.mdga.server.automaton.LobbyState;
 | 
			
		||||
import pp.mdga.server.automaton.ServerAutomaton;
 | 
			
		||||
 | 
			
		||||
import static org.junit.Assert.*;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -46,25 +51,25 @@ public class ServerStateTest {
 | 
			
		||||
 | 
			
		||||
    //TODO
 | 
			
		||||
    private Animation animation;
 | 
			
		||||
    private Ceremony ceremony;
 | 
			
		||||
    private ChoosePiece choosePiece;
 | 
			
		||||
    private DetermineStartPlayer determineStartPlayer;
 | 
			
		||||
    private FirstRoll firstRoll;
 | 
			
		||||
    private CeremonyState ceremonyState;
 | 
			
		||||
    private ChoosePieceState choosePieceState;
 | 
			
		||||
    private DetermineStartPlayerState determineStartPlayerState;
 | 
			
		||||
    private FirstRollStateState firstRollState;
 | 
			
		||||
    private GameState gameState;
 | 
			
		||||
    private Interrupt interrupt;
 | 
			
		||||
    private Lobby lobby;
 | 
			
		||||
    private MovePiece movePiece;
 | 
			
		||||
    private NoPiece noPiece;
 | 
			
		||||
    private NoTurn noTurn;
 | 
			
		||||
    private InterruptState interruptState;
 | 
			
		||||
    private LobbyState lobbyState;
 | 
			
		||||
    private MovePieceState movePieceState;
 | 
			
		||||
    private NoPieceState noPiece;
 | 
			
		||||
    private NoTurnState noTurnState;
 | 
			
		||||
    private PlayPowerCard playPowerCard;
 | 
			
		||||
    private PowerCard powerCard;
 | 
			
		||||
    private RollDice rollDice;
 | 
			
		||||
    private SecondRoll secondRoll;
 | 
			
		||||
    private SelectPiece selectPiece;
 | 
			
		||||
    private StartPiece startPiece;
 | 
			
		||||
    private ThirdRoll thirdRoll;
 | 
			
		||||
    private Turn turn;
 | 
			
		||||
    private WaitingPiece waitingPiece;
 | 
			
		||||
    private PowerCardState powerCardState;
 | 
			
		||||
    private RollDiceState rollDiceState;
 | 
			
		||||
    private SecondRollState secondRoll;
 | 
			
		||||
    private SelectPieceState selectPiece;
 | 
			
		||||
    private StartPieceState startPiece;
 | 
			
		||||
    private ThirdRollState thirdRoll;
 | 
			
		||||
    private TurnState turnState;
 | 
			
		||||
    private WaitingPieceState waitingPiece;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * TODO
 | 
			
		||||
@@ -115,36 +120,36 @@ public void send(int id, ServerMessage msg) {
 | 
			
		||||
        from = 1234;
 | 
			
		||||
        fromHost = 2345;
 | 
			
		||||
 | 
			
		||||
        choosePieceStateMachine = choosePiece.getChoosePieceMachine();
 | 
			
		||||
        rollDiceMachine = rollDice.getRollDicemachine();
 | 
			
		||||
        turnStateMachine = turn.getTurnStatemachine();
 | 
			
		||||
        choosePieceStateMachine = choosePieceState.getChoosePieceMachine();
 | 
			
		||||
        rollDiceMachine = rollDiceState.getRollDicemachine();
 | 
			
		||||
        turnStateMachine = turnState.getTurnStatemachine();
 | 
			
		||||
        serverAutomaton = logic.getServerAutomaton();
 | 
			
		||||
        gameStateMachine = gameState.getGameStatemachine();
 | 
			
		||||
 | 
			
		||||
        thirdRoll = new ThirdRoll(rollDiceMachine, logic);
 | 
			
		||||
        secondRoll = new SecondRoll(rollDiceMachine, logic);
 | 
			
		||||
        firstRoll = new FirstRoll(rollDiceMachine, logic);
 | 
			
		||||
        thirdRoll = new ThirdRollState(rollDiceMachine, logic);
 | 
			
		||||
        secondRoll = new SecondRollState(rollDiceMachine, logic);
 | 
			
		||||
        firstRollState = new FirstRollStateState(rollDiceMachine, logic);
 | 
			
		||||
 | 
			
		||||
        noPiece = new NoPiece(choosePieceStateMachine, logic);
 | 
			
		||||
        noTurn = new NoTurn(choosePieceStateMachine, logic);
 | 
			
		||||
        waitingPiece = new WaitingPiece(choosePieceStateMachine, logic);
 | 
			
		||||
        startPiece = new StartPiece(choosePieceStateMachine, logic);
 | 
			
		||||
        selectPiece = new SelectPiece(choosePieceStateMachine, logic);
 | 
			
		||||
        noPiece = new NoPieceState(choosePieceStateMachine, logic);
 | 
			
		||||
        noTurnState = new NoTurnState(choosePieceStateMachine, logic);
 | 
			
		||||
        waitingPiece = new WaitingPieceState(choosePieceStateMachine, logic);
 | 
			
		||||
        startPiece = new StartPieceState(choosePieceStateMachine, logic);
 | 
			
		||||
        selectPiece = new SelectPieceState(choosePieceStateMachine, logic);
 | 
			
		||||
 | 
			
		||||
        powerCard = new PowerCard(turnStateMachine, logic);
 | 
			
		||||
        powerCardState = new PowerCardState(turnStateMachine, logic);
 | 
			
		||||
        playPowerCard = new PlayPowerCard(turnStateMachine, logic);
 | 
			
		||||
        rollDice = new RollDice(turnStateMachine, logic);
 | 
			
		||||
        choosePiece = new ChoosePiece(turnStateMachine, logic);
 | 
			
		||||
        movePiece = new MovePiece(turnStateMachine, logic);
 | 
			
		||||
        rollDiceState = new RollDiceState(turnStateMachine, logic);
 | 
			
		||||
        choosePieceState = new ChoosePieceState(turnStateMachine, logic);
 | 
			
		||||
        movePieceState = new MovePieceState(turnStateMachine, logic);
 | 
			
		||||
 | 
			
		||||
        determineStartPlayer = new DetermineStartPlayer(gameStateMachine, logic);
 | 
			
		||||
        turn = new Turn(gameStateMachine, logic);
 | 
			
		||||
        determineStartPlayerState = new DetermineStartPlayerState(gameStateMachine, logic);
 | 
			
		||||
        turnState = new TurnState(gameStateMachine, logic);
 | 
			
		||||
        animation = new Animation(gameStateMachine, logic);
 | 
			
		||||
 | 
			
		||||
        lobby = new Lobby(serverAutomaton, logic);
 | 
			
		||||
        lobbyState = new LobbyState(serverAutomaton, logic);
 | 
			
		||||
        gameState = new GameState(serverAutomaton, logic);
 | 
			
		||||
        ceremony = new Ceremony(serverAutomaton, logic);
 | 
			
		||||
        interrupt = new Interrupt(serverAutomaton, logic, gameState);
 | 
			
		||||
        ceremonyState = new CeremonyState(serverAutomaton, logic);
 | 
			
		||||
        interruptState = new InterruptState(serverAutomaton, logic, gameState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -152,7 +157,7 @@ public void send(int id, ServerMessage msg) {
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    public void testInitialStateServerState() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof Lobby);
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof LobbyState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -162,8 +167,8 @@ public void testInitialStateServerState() {
 | 
			
		||||
    @Test
 | 
			
		||||
    public void testLobbyToDetermineStartPlayer() {
 | 
			
		||||
        //sends the server in the lobby-state
 | 
			
		||||
        serverAutomaton.gotoState(lobby);
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof Lobby);
 | 
			
		||||
        serverAutomaton.gotoState(lobbyState);
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof LobbyState);
 | 
			
		||||
 | 
			
		||||
        //sends the startGame message from the Host to the server
 | 
			
		||||
        logic.received(clientStartGame, from);
 | 
			
		||||
@@ -172,7 +177,7 @@ public void testLobbyToDetermineStartPlayer() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
        GameState gameState1 = (GameState) serverAutomaton.getState();//Todo erzeuge state
 | 
			
		||||
        GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
 | 
			
		||||
        assertTrue(gameStateMachine1.getState() instanceof DetermineStartPlayer);
 | 
			
		||||
        assertTrue(gameStateMachine1.getState() instanceof DetermineStartPlayerState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -181,8 +186,8 @@ public void testLobbyToDetermineStartPlayer() {
 | 
			
		||||
    @Test
 | 
			
		||||
    public void testStayInLobby() {
 | 
			
		||||
        //sends the server in the lobby-state
 | 
			
		||||
        serverAutomaton.gotoState(lobby);
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof Lobby);
 | 
			
		||||
        serverAutomaton.gotoState(lobbyState);
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof LobbyState);
 | 
			
		||||
 | 
			
		||||
        //TODO logic gets all messages
 | 
			
		||||
        logic.received(animationEnd, from);
 | 
			
		||||
@@ -203,7 +208,7 @@ public void testStayInLobby() {
 | 
			
		||||
        logic.received(selectTSK, from);
 | 
			
		||||
 | 
			
		||||
        //tests if Server is still in Lobby
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof Lobby);
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof LobbyState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -218,7 +223,7 @@ public void testServerGameSubStatesToInterrupt() {
 | 
			
		||||
        //TODO create interrupt
 | 
			
		||||
 | 
			
		||||
        //tests if the server is in the Interrupt-state
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof Interrupt);
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof InterruptState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -233,7 +238,7 @@ public void testServerGameToCeremony() {
 | 
			
		||||
        //Todo game is finished
 | 
			
		||||
 | 
			
		||||
        //tests if the server is in the Ceremony-state
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof Ceremony);
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof CeremonyState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -242,8 +247,8 @@ public void testServerGameToCeremony() {
 | 
			
		||||
    @Test
 | 
			
		||||
    public void testInterruptToGameContinue() {
 | 
			
		||||
        //sends the server in the Interrupt-State
 | 
			
		||||
        serverAutomaton.gotoState(interrupt);
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof Interrupt);
 | 
			
		||||
        serverAutomaton.gotoState(interruptState);
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof InterruptState);
 | 
			
		||||
 | 
			
		||||
        //sends the continue-message to the server
 | 
			
		||||
        logic.received(forceContinueGame, from);
 | 
			
		||||
@@ -258,8 +263,8 @@ public void testInterruptToGameContinue() {
 | 
			
		||||
    @Test
 | 
			
		||||
    public void testInterruptToGameReconnect() {
 | 
			
		||||
        //sends the server in the Interrupt-State
 | 
			
		||||
        serverAutomaton.gotoState(interrupt);
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof Interrupt);
 | 
			
		||||
        serverAutomaton.gotoState(interruptState);
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof InterruptState);
 | 
			
		||||
 | 
			
		||||
        //todo implement the timer
 | 
			
		||||
 | 
			
		||||
@@ -273,8 +278,8 @@ public void testInterruptToGameReconnect() {
 | 
			
		||||
    @Test
 | 
			
		||||
    public void testInterruptToGameTimer() {
 | 
			
		||||
        //sends the server in the Interrupt-State
 | 
			
		||||
        serverAutomaton.gotoState(interrupt);
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof Interrupt);
 | 
			
		||||
        serverAutomaton.gotoState(interruptState);
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof InterruptState);
 | 
			
		||||
 | 
			
		||||
        //Todo implement the timer
 | 
			
		||||
 | 
			
		||||
@@ -301,14 +306,14 @@ public void testDetermineStartPlayerToDetermineStartPlayer1() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in DSP-state
 | 
			
		||||
        gameStateMachine.gotoState(determineStartPlayer);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof DetermineStartPlayer);
 | 
			
		||||
        gameStateMachine.gotoState(determineStartPlayerState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof DetermineStartPlayerState);
 | 
			
		||||
 | 
			
		||||
        //TODO sends messages to the server
 | 
			
		||||
 | 
			
		||||
        //tests if the server is still in DSP-state
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof DetermineStartPlayer);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof DetermineStartPlayerState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -321,14 +326,14 @@ public void testDetermineStartPlayerToDetermineStartPlayer2() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in DSP-state
 | 
			
		||||
        gameStateMachine.gotoState(determineStartPlayer);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof DetermineStartPlayer);
 | 
			
		||||
        gameStateMachine.gotoState(determineStartPlayerState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof DetermineStartPlayerState);
 | 
			
		||||
 | 
			
		||||
        //TODO sends messages 2 RequestDiceMessage, die gleich geränkt werden to the server
 | 
			
		||||
 | 
			
		||||
        //tests if the server is still in DSP-state
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof DetermineStartPlayer);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof DetermineStartPlayerState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -341,8 +346,8 @@ public void testDetermineStartPlayerToAnimation() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in DSP-state
 | 
			
		||||
        gameStateMachine.gotoState(determineStartPlayer);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof DetermineStartPlayer);
 | 
			
		||||
        gameStateMachine.gotoState(determineStartPlayerState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof DetermineStartPlayerState);
 | 
			
		||||
 | 
			
		||||
        //TODO sends messages 2 RequestDiceMessage, die ungleich geränkt werden, sodass der server weitergeht
 | 
			
		||||
 | 
			
		||||
@@ -375,10 +380,10 @@ public void testAnimationToPowerCard() {
 | 
			
		||||
 | 
			
		||||
        //tests if the server is in the PowerCard-state
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        Turn turn1 = (Turn) gameStateMachine.getState();
 | 
			
		||||
        TurnStateMachine turnStateMachine = (TurnStateMachine) turn1.getTurnStateMachine();
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof PowerCard);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
        TurnState turnState1 = (TurnState) gameStateMachine.getState();
 | 
			
		||||
        TurnStateMachine turnStateMachine = (TurnStateMachine) turnState1.getTurnStateMachine();
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof PowerCardState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -392,8 +397,8 @@ public void testTurnToAnimation() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        gameStateMachine.gotoState(turnState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
 | 
			
		||||
        //todo set the turn finished and there are still two players left
 | 
			
		||||
 | 
			
		||||
@@ -413,13 +418,13 @@ public void testTurnToGameEndState() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        gameStateMachine.gotoState(turnState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
 | 
			
		||||
        //todo set the turn finished and there is only one players left
 | 
			
		||||
 | 
			
		||||
        //tests if the server is in the end-state of game, Ceremony
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof Ceremony);
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof CeremonyState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -433,19 +438,19 @@ public void testStayInPowerCard() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        gameStateMachine.gotoState(turnState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
 | 
			
		||||
        //sends the TurnStateMachine in PowerCard
 | 
			
		||||
        turnStateMachine.gotoState(powerCard);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof PowerCard);
 | 
			
		||||
        turnStateMachine.gotoState(powerCardState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof PowerCardState);
 | 
			
		||||
 | 
			
		||||
        //Todo: receive messages which dont lead to a state change
 | 
			
		||||
 | 
			
		||||
        //tests if the server is in PowerCard
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof PowerCard);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof PowerCardState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -459,18 +464,18 @@ public void testPowerCardToPlayPowerCard() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        gameStateMachine.gotoState(turnState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
 | 
			
		||||
        //sends the TurnStateMachine in PowerCard
 | 
			
		||||
        turnStateMachine.gotoState(powerCard);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof PowerCard);
 | 
			
		||||
        turnStateMachine.gotoState(powerCardState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof PowerCardState);
 | 
			
		||||
 | 
			
		||||
        //todo
 | 
			
		||||
 | 
			
		||||
        //tests if the server is in PlayPowerCard
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof PlayPowerCard);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -485,8 +490,8 @@ public void testPlayPowerCardToRollDice() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        gameStateMachine.gotoState(turnState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
 | 
			
		||||
        //sends the TurnStateMachine in PowerCard
 | 
			
		||||
        turnStateMachine.gotoState(playPowerCard);
 | 
			
		||||
@@ -495,7 +500,7 @@ public void testPlayPowerCardToRollDice() {
 | 
			
		||||
        //receive first AnimationEndMessage from the host
 | 
			
		||||
        logic.received(animationEnd, fromHost);
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof PlayPowerCard);
 | 
			
		||||
 | 
			
		||||
        //receive second AnimationEndMessage
 | 
			
		||||
@@ -503,11 +508,11 @@ public void testPlayPowerCardToRollDice() {
 | 
			
		||||
 | 
			
		||||
        //tests if the server is in RollDice and in FirstRoll
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof RollDice);
 | 
			
		||||
        RollDice rollDice = (RollDice) turnStateMachine.getState();
 | 
			
		||||
        RollDiceMachine rollDiceMachine1 = rollDice.getRollDiceStateMachine();
 | 
			
		||||
        assertTrue(rollDiceMachine1.getState() instanceof FirstRoll);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof RollDiceState);
 | 
			
		||||
        RollDiceState rollDiceState = (RollDiceState) turnStateMachine.getState();
 | 
			
		||||
        RollDiceMachine rollDiceMachine1 = rollDiceState.getRollDiceStateMachine();
 | 
			
		||||
        assertTrue(rollDiceMachine1.getState() instanceof FirstRollStateState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -521,18 +526,18 @@ public void testChoosePieceToMovePiece() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        gameStateMachine.gotoState(turnState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
 | 
			
		||||
        //sends the TurnStateMachine in ChoosePiece
 | 
			
		||||
        turnStateMachine.gotoState(choosePiece);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        turnStateMachine.gotoState(choosePieceState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePieceState);
 | 
			
		||||
 | 
			
		||||
        //Todo ???
 | 
			
		||||
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof MovePiece);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof MovePieceState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -546,12 +551,12 @@ public void testMovePieceToTurnEndState() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        gameStateMachine.gotoState(turnState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
 | 
			
		||||
        //sends the TurnStateMachine in MovePiece
 | 
			
		||||
        turnStateMachine.gotoState(movePiece);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof MovePiece);
 | 
			
		||||
        turnStateMachine.gotoState(movePieceState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof MovePieceState);
 | 
			
		||||
 | 
			
		||||
        //Todo no 6 was rolled, so the server looks, if there are 2 or less player are still in the game
 | 
			
		||||
        //TODO
 | 
			
		||||
@@ -569,21 +574,21 @@ public void testMovePieceToFirstRoll() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        gameStateMachine.gotoState(turnState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
 | 
			
		||||
        //sends the TurnStateMachine in MovePiece
 | 
			
		||||
        turnStateMachine.gotoState(movePiece);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof MovePiece);
 | 
			
		||||
        turnStateMachine.gotoState(movePieceState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof MovePieceState);
 | 
			
		||||
 | 
			
		||||
        //Todo the player rolled a 6 and the player is not finished
 | 
			
		||||
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof RollDice);
 | 
			
		||||
        RollDice rollDice = (RollDice) turnStateMachine.getState();
 | 
			
		||||
        RollDiceMachine rollDiceMachine1 = rollDice.getRollDiceStateMachine();
 | 
			
		||||
        assertTrue(rollDiceMachine1.getState() instanceof FirstRoll);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof RollDiceState);
 | 
			
		||||
        RollDiceState rollDiceState = (RollDiceState) turnStateMachine.getState();
 | 
			
		||||
        RollDiceMachine rollDiceMachine1 = rollDiceState.getRollDiceStateMachine();
 | 
			
		||||
        assertTrue(rollDiceMachine1.getState() instanceof FirstRollStateState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -597,26 +602,26 @@ public void testFirstRollToRollDiceEndState() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        gameStateMachine.gotoState(turnState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
 | 
			
		||||
        //sends the TurnStateMachine in RollDice
 | 
			
		||||
        turnStateMachine.gotoState(rollDice);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof RollDice);
 | 
			
		||||
        turnStateMachine.gotoState(rollDiceState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof RollDiceState);
 | 
			
		||||
 | 
			
		||||
        //sends the RollDiceMachine in FirstRoll
 | 
			
		||||
        rollDiceMachine.gotoState(firstRoll);
 | 
			
		||||
        assertTrue(rollDiceMachine.getState() instanceof FirstRoll);
 | 
			
		||||
        rollDiceMachine.gotoState(firstRollState);
 | 
			
		||||
        assertTrue(rollDiceMachine.getState() instanceof FirstRollStateState);
 | 
			
		||||
 | 
			
		||||
        //TODO 2 Möglichkeiten
 | 
			
		||||
 | 
			
		||||
        //tests if the server is in NoPiece of ChoosePiece
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        ChoosePiece choosePiece1 = (ChoosePiece) turnStateMachine.getState();
 | 
			
		||||
        ChoosePieceStateMachine choosePieceStateMachine = choosePiece1.getChoosePieceStateMachine();
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof NoPiece);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePieceState);
 | 
			
		||||
        ChoosePieceState choosePieceState1 = (ChoosePieceState) turnStateMachine.getState();
 | 
			
		||||
        ChoosePieceStateMachine choosePieceStateMachine = choosePieceState1.getChoosePieceStateMachine();
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof NoPieceState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -630,24 +635,24 @@ public void testFirstRollToSecondRoll() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        gameStateMachine.gotoState(turnState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
 | 
			
		||||
        //sends the TurnStateMachine in RollDice
 | 
			
		||||
        turnStateMachine.gotoState(rollDice);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof RollDice);
 | 
			
		||||
        turnStateMachine.gotoState(rollDiceState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof RollDiceState);
 | 
			
		||||
 | 
			
		||||
        //sends the RollDiceMachine in FirstRoll
 | 
			
		||||
        rollDiceMachine.gotoState(firstRoll);
 | 
			
		||||
        assertTrue(rollDiceMachine.getState() instanceof FirstRoll);
 | 
			
		||||
        rollDiceMachine.gotoState(firstRollState);
 | 
			
		||||
        assertTrue(rollDiceMachine.getState() instanceof FirstRollStateState);
 | 
			
		||||
 | 
			
		||||
        //Todo player has no figures to move and had no 6
 | 
			
		||||
 | 
			
		||||
        //tests if the server is in the SecondRoll
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof RollDice);
 | 
			
		||||
        assertTrue(rollDiceMachine.getState() instanceof SecondRoll);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof RollDiceState);
 | 
			
		||||
        assertTrue(rollDiceMachine.getState() instanceof SecondRollState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -661,26 +666,26 @@ public void testSecondRollToRollDiceEndState() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        gameStateMachine.gotoState(turnState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
 | 
			
		||||
        //sends the TurnStateMachine in RollDice
 | 
			
		||||
        turnStateMachine.gotoState(rollDice);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof RollDice);
 | 
			
		||||
        turnStateMachine.gotoState(rollDiceState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof RollDiceState);
 | 
			
		||||
 | 
			
		||||
        //sends the RollDiceMachine in SecondRoll
 | 
			
		||||
        rollDiceMachine.gotoState(secondRoll);
 | 
			
		||||
        assertTrue(rollDiceMachine.getState() instanceof SecondRoll);
 | 
			
		||||
        assertTrue(rollDiceMachine.getState() instanceof SecondRollState);
 | 
			
		||||
 | 
			
		||||
        //Todo
 | 
			
		||||
 | 
			
		||||
        //tests if the server is in NoPiece of ChoosePiece
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        ChoosePiece choosePiece1 = (ChoosePiece) turnStateMachine.getState();
 | 
			
		||||
        ChoosePieceStateMachine choosePieceStateMachine = choosePiece1.getChoosePieceStateMachine();
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof NoPiece);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePieceState);
 | 
			
		||||
        ChoosePieceState choosePieceState1 = (ChoosePieceState) turnStateMachine.getState();
 | 
			
		||||
        ChoosePieceStateMachine choosePieceStateMachine = choosePieceState1.getChoosePieceStateMachine();
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof NoPieceState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -694,24 +699,24 @@ public void testSecondRollToThirdRoll() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        gameStateMachine.gotoState(turnState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
 | 
			
		||||
        //sends the TurnStateMachine in RollDice
 | 
			
		||||
        turnStateMachine.gotoState(rollDice);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof RollDice);
 | 
			
		||||
        turnStateMachine.gotoState(rollDiceState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof RollDiceState);
 | 
			
		||||
 | 
			
		||||
        //sends the RollDiceMachine in SecondRoll
 | 
			
		||||
        rollDiceMachine.gotoState(secondRoll);
 | 
			
		||||
        assertTrue(rollDiceMachine.getState() instanceof SecondRoll);
 | 
			
		||||
        assertTrue(rollDiceMachine.getState() instanceof SecondRollState);
 | 
			
		||||
 | 
			
		||||
        //Todo player has no figures to move and had no 6
 | 
			
		||||
 | 
			
		||||
        //tests if the server is in the ThirdRoll
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof RollDice);
 | 
			
		||||
        assertTrue(rollDiceMachine.getState() instanceof ThirdRoll);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof RollDiceState);
 | 
			
		||||
        assertTrue(rollDiceMachine.getState() instanceof ThirdRollState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -725,26 +730,26 @@ public void testThirdRollToRollDiceEndState() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        gameStateMachine.gotoState(turnState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
 | 
			
		||||
        //sends the TurnStateMachine in RollDice
 | 
			
		||||
        turnStateMachine.gotoState(rollDice);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof RollDice);
 | 
			
		||||
        turnStateMachine.gotoState(rollDiceState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof RollDiceState);
 | 
			
		||||
 | 
			
		||||
        //sends the RollDiceMachine in ThirdRoll
 | 
			
		||||
        rollDiceMachine.gotoState(thirdRoll);
 | 
			
		||||
        assertTrue(rollDiceMachine.getState() instanceof ThirdRoll);
 | 
			
		||||
        assertTrue(rollDiceMachine.getState() instanceof ThirdRollState);
 | 
			
		||||
 | 
			
		||||
        //Todo
 | 
			
		||||
 | 
			
		||||
        //tests if the server is in NoPiece of ChoosePiece
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        ChoosePiece choosePiece1 = (ChoosePiece) turnStateMachine.getState();
 | 
			
		||||
        ChoosePieceStateMachine choosePieceStateMachine = choosePiece1.getChoosePieceStateMachine();
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof NoPiece);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePieceState);
 | 
			
		||||
        ChoosePieceState choosePieceState1 = (ChoosePieceState) turnStateMachine.getState();
 | 
			
		||||
        ChoosePieceStateMachine choosePieceStateMachine = choosePieceState1.getChoosePieceStateMachine();
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof NoPieceState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -758,16 +763,16 @@ public void testThirdRollToTurnEndState() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the gameStateMachine in Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        gameStateMachine.gotoState(turnState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
 | 
			
		||||
        //sends the TurnStateMachine in RollDice
 | 
			
		||||
        turnStateMachine.gotoState(rollDice);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof RollDice);
 | 
			
		||||
        turnStateMachine.gotoState(rollDiceState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof RollDiceState);
 | 
			
		||||
 | 
			
		||||
        //sends the RollDiceMachine in ThirdRoll
 | 
			
		||||
        rollDiceMachine.gotoState(thirdRoll);
 | 
			
		||||
        assertTrue(rollDiceMachine.getState() instanceof ThirdRoll);
 | 
			
		||||
        assertTrue(rollDiceMachine.getState() instanceof ThirdRollState);
 | 
			
		||||
 | 
			
		||||
        //Todo
 | 
			
		||||
    }
 | 
			
		||||
@@ -783,24 +788,24 @@ public void testNoPieceToWaitingPiece() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        gameStateMachine.gotoState(turnState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in ChoosePiece
 | 
			
		||||
        turnStateMachine.gotoState(choosePiece);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        turnStateMachine.gotoState(choosePieceState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePieceState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in NoPiece
 | 
			
		||||
        choosePieceStateMachine.gotoState(noPiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof NoPiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof NoPieceState);
 | 
			
		||||
 | 
			
		||||
        //TODO
 | 
			
		||||
 | 
			
		||||
        //tests if the server is in WaitingPiece
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof WaitingPiece);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePieceState);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof WaitingPieceState);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -815,24 +820,24 @@ public void testNoPieceToNoTurn() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        gameStateMachine.gotoState(turnState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in ChoosePiece
 | 
			
		||||
        turnStateMachine.gotoState(choosePiece);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        turnStateMachine.gotoState(choosePieceState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePieceState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in NoPiece
 | 
			
		||||
        choosePieceStateMachine.gotoState(noPiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof NoPiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof NoPieceState);
 | 
			
		||||
 | 
			
		||||
        //TODO
 | 
			
		||||
 | 
			
		||||
        //tests if the server is in NoTurn
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof NoTurn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePieceState);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof NoTurnState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -846,16 +851,16 @@ public void testNoTurnToTurnEndState() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        gameStateMachine.gotoState(turnState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in ChoosePiece
 | 
			
		||||
        turnStateMachine.gotoState(choosePiece);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        turnStateMachine.gotoState(choosePieceState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePieceState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in NoTurn
 | 
			
		||||
        choosePieceStateMachine.gotoState(noTurn);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof NoTurn);
 | 
			
		||||
        choosePieceStateMachine.gotoState(noTurnState);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof NoTurnState);
 | 
			
		||||
 | 
			
		||||
        //TODO
 | 
			
		||||
    }
 | 
			
		||||
@@ -871,24 +876,24 @@ public void testStayInWaitingPiece() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        gameStateMachine.gotoState(turnState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in ChoosePiece
 | 
			
		||||
        turnStateMachine.gotoState(choosePiece);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        turnStateMachine.gotoState(choosePieceState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePieceState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in WaitingPiece
 | 
			
		||||
        choosePieceStateMachine.gotoState(waitingPiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof WaitingPiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof WaitingPieceState);
 | 
			
		||||
 | 
			
		||||
        //TODO
 | 
			
		||||
 | 
			
		||||
        //tests if the server is in WaitingPiece
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof WaitingPiece);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePieceState);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof WaitingPieceState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -902,16 +907,16 @@ public void testWaitingPieceToMovePiece() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        gameStateMachine.gotoState(turnState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in ChoosePiece
 | 
			
		||||
        turnStateMachine.gotoState(choosePiece);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        turnStateMachine.gotoState(choosePieceState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePieceState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in WaitingPiece
 | 
			
		||||
        choosePieceStateMachine.gotoState(waitingPiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof WaitingPiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof WaitingPieceState);
 | 
			
		||||
 | 
			
		||||
        //TODO
 | 
			
		||||
    }
 | 
			
		||||
@@ -927,24 +932,24 @@ public void testNoPieceToSelectPiece() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        gameStateMachine.gotoState(turnState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in ChoosePiece
 | 
			
		||||
        turnStateMachine.gotoState(choosePiece);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        turnStateMachine.gotoState(choosePieceState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePieceState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in NoPiece
 | 
			
		||||
        choosePieceStateMachine.gotoState(noPiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof NoPiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof NoPieceState);
 | 
			
		||||
 | 
			
		||||
        //TODO
 | 
			
		||||
 | 
			
		||||
        //tests if the server is in SelectPiece
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof SelectPiece);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePieceState);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof SelectPieceState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -958,24 +963,24 @@ public void testNoPieceToStartPiece() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        gameStateMachine.gotoState(turnState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in ChoosePiece
 | 
			
		||||
        turnStateMachine.gotoState(choosePiece);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        turnStateMachine.gotoState(choosePieceState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePieceState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in NoPiece
 | 
			
		||||
        choosePieceStateMachine.gotoState(noPiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof NoPiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof NoPieceState);
 | 
			
		||||
 | 
			
		||||
        //TODO
 | 
			
		||||
 | 
			
		||||
        //tests if the server is in StartPiece
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof StartPiece);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePieceState);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof StartPieceState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -989,24 +994,24 @@ public void testStayInSelectPiece() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        gameStateMachine.gotoState(turnState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in ChoosePiece
 | 
			
		||||
        turnStateMachine.gotoState(choosePiece);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        turnStateMachine.gotoState(choosePieceState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePieceState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in SelectPiece
 | 
			
		||||
        choosePieceStateMachine.gotoState(selectPiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof SelectPiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof SelectPieceState);
 | 
			
		||||
 | 
			
		||||
        //TODO
 | 
			
		||||
 | 
			
		||||
        //tests if the server is in SelectPiece
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof SelectPiece);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePieceState);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof SelectPieceState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -1020,16 +1025,16 @@ public void testSelectPieceToMovePiece() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        gameStateMachine.gotoState(turnState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in ChoosePiece
 | 
			
		||||
        turnStateMachine.gotoState(choosePiece);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        turnStateMachine.gotoState(choosePieceState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePieceState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in SelectPiece
 | 
			
		||||
        choosePieceStateMachine.gotoState(selectPiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof SelectPiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof SelectPieceState);
 | 
			
		||||
 | 
			
		||||
        //TODO
 | 
			
		||||
    }
 | 
			
		||||
@@ -1045,24 +1050,24 @@ public void testStayInStartPiece() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        gameStateMachine.gotoState(turnState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in ChoosePiece
 | 
			
		||||
        turnStateMachine.gotoState(choosePiece);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        turnStateMachine.gotoState(choosePieceState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePieceState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in StartPiece
 | 
			
		||||
        choosePieceStateMachine.gotoState(startPiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof StartPiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof StartPieceState);
 | 
			
		||||
 | 
			
		||||
        //TODO
 | 
			
		||||
 | 
			
		||||
        //tests if the server is in StartPiece
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof StartPiece);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePieceState);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof StartPieceState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -1076,16 +1081,16 @@ public void testStartPieceToMovePiece() {
 | 
			
		||||
        assertTrue(serverAutomaton.getState() instanceof GameState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in Turn
 | 
			
		||||
        gameStateMachine.gotoState(turn);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof Turn);
 | 
			
		||||
        gameStateMachine.gotoState(turnState);
 | 
			
		||||
        assertTrue(gameStateMachine.getState() instanceof TurnState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in ChoosePiece
 | 
			
		||||
        turnStateMachine.gotoState(choosePiece);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
 | 
			
		||||
        turnStateMachine.gotoState(choosePieceState);
 | 
			
		||||
        assertTrue(turnStateMachine.getState() instanceof ChoosePieceState);
 | 
			
		||||
 | 
			
		||||
        //sends the server in StartPiece
 | 
			
		||||
        choosePieceStateMachine.gotoState(startPiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof StartPiece);
 | 
			
		||||
        assertTrue(choosePieceStateMachine.getState() instanceof StartPieceState);
 | 
			
		||||
 | 
			
		||||
        //TODO
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user