if(gameId==null || "".equals(gameId)){throw new Exception("Game Id is unknown");}
final IGame game = Engine.instance().games.get(gameId);
if(game==null){throw new Exception("Game is unknown");}
final IPlayer player = game.getPlayer(xhash);
if(player==null){throw new Exception("player is unknown");}
final String moves = Arrays.toString(game.getLegalMoves(player.getEmail())).replace("{", "[").replace("}", "]").replace("null", "0");
final IPlayer mrx = game.getMrX();
if(mrx==null){
throw new Exception("MR X Is not there");
}
String position = "-1";
if(game.isRoundExposingMrX(game.getRound())){
position = mrx.getPosition()+"";
}
out.print("{\"msg\" : "+ moves +", \"mrx\" : { \"position\" : "+ position +", \"face\" : \""+ mrx.getIcon() +"\", \"name\" : \""+mrx.getName()+"\"} }");
}catch(Exception e){
out.print("{\"msg\" : \"EXCEPTION : "+(e.getMessage()+"").replace("\"", "'")+"\", \"className\" : \""+getClass().getName()+"\"}");
}