@Override public final void stop() { theClojureGamer.setMatch(getMatch()); theClojureGamer.setRoleName(getRoleName()); try { theClojureGamer.stop(); } catch (RuntimeException e) { GamerLogger.logError("GamePlayer", "Caught exception in Clojure stateMachineStop:"); GamerLogger.logStackTrace("GamePlayer", e); } }
@Override public final void metaGame(long timeout) throws MetaGamingException { theClojureGamer.setMatch(getMatch()); theClojureGamer.setRoleName(getRoleName()); try { theClojureGamer.metaGame(timeout); } catch (RuntimeException e) { GamerLogger.logError("GamePlayer", "Caught exception in Clojure stateMachineMetaGame:"); GamerLogger.logStackTrace("GamePlayer", e); } }
@Override public final GdlSentence selectMove(long timeout) throws MoveSelectionException { theClojureGamer.setMatch(getMatch()); theClojureGamer.setRoleName(getRoleName()); try { return theClojureGamer.selectMove(timeout); } catch (RuntimeException e) { GamerLogger.logError("GamePlayer", "Caught exception in Clojure stateMachineSelectMove:"); GamerLogger.logStackTrace("GamePlayer", e); return null; } }
// TODO: This code should be put somewhere more general. public static void main(String args[]) { try { Gamer g = new ClojureLegalGamerStub(); System.out.println(g.getName()); Match m = new Match("", 1000, 1000, GameRepository.getDefaultRepository().getGame("conn4")); g.setMatch(m); g.setRoleName(GdlPool.getProposition(GdlPool.getConstant("xplayer"))); g.metaGame(1000); System.out.println(g.selectMove(1000)); } catch (Exception e) { e.printStackTrace(); } }