public String getGameWinner() { String winner = ""; String query = "winner(W)."; ArrayList<SolveInfo> arrayinfo = this.solveQuery(query); if (!arrayinfo.isEmpty()) { SolveInfo info = arrayinfo.get(0); List l = null; try { l = info.getBindingVars(); Var var = (Var) l.get(0); winner = var.toStringFlattened(); } catch (NoSolutionException ex) { Logger.getLogger(VisibilityEngine.class.getName()).log(Level.SEVERE, null, ex); } } return winner; }