Package org.ggp.base.server.event

Examples of org.ggp.base.server.event.ServerNewGameStateEvent


        StateMachine theMachine = new CachedStateMachine(new ProverStateMachine());
        theMachine.initialize(theGame.getRules());
        try {
            MachineState theCurrentState = theMachine.getInitialState();
            do {
                theVisual.observe(new ServerNewGameStateEvent(theCurrentState));
                theCurrentState = theMachine.getRandomNextState(theCurrentState);
                Thread.sleep(250);
                System.out.println("State: " + theCurrentState);
            } while(!theMachine.isTerminal(theCurrentState));
            theVisual.observe(new ServerNewGameStateEvent(theCurrentState));
        } catch (Exception e) {
            e.printStackTrace();
        }
  }
View Full Code Here


            appendErrorsToMatchDescription();

            while (!stateMachine.isTerminal(currentState)) {
                publishWhenNecessary();
                saveWhenNecessary();
                notifyObservers(new ServerNewGameStateEvent(currentState));
                notifyObservers(new ServerTimeEvent(match.getPlayClock() * 1000));
                notifyObservers(new ServerMatchUpdatedEvent(match, spectatorServerKey, saveToFilename));
                previousMoves = sendPlayRequests();

                notifyObservers(new ServerNewMovesEvent(previousMoves));
                currentState = stateMachine.getNextState(currentState, previousMoves);

                match.appendMoves2(previousMoves);
                match.appendState(currentState.getContents());
                appendErrorsToMatchDescription();

                if (match.isAborted()) {
                  return;
                }
            }
            match.markCompleted(stateMachine.getGoals(currentState));
            publishWhenNecessary();
            saveWhenNecessary();
            notifyObservers(new ServerNewGameStateEvent(currentState));
            notifyObservers(new ServerCompletedMatchEvent(getGoals()));
            notifyObservers(new ServerMatchUpdatedEvent(match, spectatorServerKey, saveToFilename));
            sendStopRequests(previousMoves);
        } catch (InterruptedException ie) {
          if (match.isAborted()) {
View Full Code Here

TOP

Related Classes of org.ggp.base.server.event.ServerNewGameStateEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.