Package org.ggp.base.server.event

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


            observer.observe(event);
        }

        // Add error events to mostRecentErrors for recording.
        if (event instanceof ServerIllegalMoveEvent) {
            ServerIllegalMoveEvent sEvent = (ServerIllegalMoveEvent)event;
            mostRecentErrors.put(sEvent.getRole(), "IL " + sEvent.getMove());
        } else if (event instanceof ServerTimeoutEvent) {
            ServerTimeoutEvent sEvent = (ServerTimeoutEvent)event;
            mostRecentErrors.put(sEvent.getRole(), "TO");
        } else if (event instanceof ServerConnectionErrorEvent) {
            ServerConnectionErrorEvent sEvent = (ServerConnectionErrorEvent)event;
            mostRecentErrors.put(sEvent.getRole(), "CE");
        }
    }
View Full Code Here


    try {
      Move candidateMove = gameServer.getStateMachine().getMoveFromTerm(GdlFactory.createTerm(match.getGdlScrambler().unscramble(response).toString()));
      if (new HashSet<Move>(legalMoves).contains(candidateMove)) {
        move = candidateMove;
      } else {
        gameServer.notifyObservers(new ServerIllegalMoveEvent(role, candidateMove));
      }
    } catch (GdlFormatException e) {
      gameServer.notifyObservers(new ServerIllegalMoveEvent(role, null));
    } catch (SymbolFormatException e) {
      gameServer.notifyObservers(new ServerIllegalMoveEvent(role, null));
    }
  }
View Full Code Here

    }

    @Override
    public void observe(Event event) {
        if(event instanceof ServerIllegalMoveEvent) {
            ServerIllegalMoveEvent x = (ServerIllegalMoveEvent)event;
            System.err.println("Got illegal move [" + x.getMove() + "] by role [" + x.getRole() + "].");
        } else if (event instanceof ServerTimeoutEvent) {
            ServerTimeoutEvent x = (ServerTimeoutEvent)event;
            System.err.println("Timeout when communicating with role [" + x.getRole() + "].");
        } else if (event instanceof ServerConnectionErrorEvent) {
            ServerConnectionErrorEvent x = (ServerConnectionErrorEvent)event;
            System.err.println("Connection error when communicating with role [" + x.getRole() + "].");
        }
    }
View Full Code Here

TOP

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

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.