Пример #1
0
  @Override
  public void move(Piece piece, Position position, ResultHandler<GameState> resultHandler) {
    try {
      final Position oldPosition = piece2Position.get(piece);
      final GameState gameState = invokeMove(piece, position);
      resultHandler.result(gameState);

      nofityListeners(new Move(oldPosition, position));
    } catch (Exception e) {
      handleException(e, resultHandler);
    }
  }
Пример #2
0
 private void moveTo(Position position, Piece piece) {
   Position oldPosition = piece2Position.get(piece);
   position2Piece.remove(oldPosition);
   position2Piece.put(position, piece);
   piece2Position.put(piece, position);
 }