<%@ page import ="org.w2mind.net.Serialiser" %> <%@ page import ="org.w2mind.soml.GetScoreBoardResponse" %> <%@ page import ="org.w2mind.soml.GetScoreBoardResponse_Wrapper" %> <%@ page import ="org.w2mind.soml.AbstractWrapper_WithScore" %> <%@ page import ="java.util.Vector" %> <%@ page import ="java.util.Iterator" %> World-Wide-Mind -> Tyrrell's Simulated Environment

World-Wide-Mind

w2mind.computing.dcu.ie -> tyrrell's simulated environment -> scoreboard


This scoreboard lists the best performing minds, or action selection mechanisms. The minds are judged according to how often the animal mates. In the even of a tie, the minds are judged based on how long the animal was able to survive in the environment. Note that a creature that sleeps for its entire lifetime can actually survive quite long, but obviously has no chance of mating, and so cannot help the survival of the species.

<% String startString = request.getParameter("start"); Vector scores = null; int start = 1; if(startString == null || startString.trim().length() == 0 || session.getValue("t_scores") == null) { Serialiser serialiser = new Serialiser("C:\\Progra~1\\Apache~1\\Tomcat~1.0\\webapps\\services\\scoreboard"); GetScoreBoardResponse r = serialiser.readScoreBoard("tyrrell.scoreboard"); GetScoreBoardResponse_Wrapper w = new GetScoreBoardResponse_Wrapper(r); scores = w.getAllScoresList(); session.putValue("t_scores", scores); } else { scores = (Vector)session.getValue("t_scores"); } if(startString != null && startString.trim().length() > 0) { try { start = Integer.parseInt(startString.trim()); } catch (NumberFormatException nfe) {} } %>

Refresh Scoreboard

<% int index = 1; int totalNumberOfScores = 0; if(scores != null) totalNumberOfScores = scores.size(); while((index + 20) < totalNumberOfScores) { if(index != start) { out.print(""); } out.print("[" + index + " - " + (index + 19) + "]"); if(index != start) { out.print(""); } out.print(" "); index += 20; } if(index != start) { out.print(""); } out.print("[" + index + " - " + totalNumberOfScores + "]"); if(index != start) { out.print(""); } %>

<% // for(int i = start - 1; i < start - 1 + 20 && i < scores.size(); i++) { for(int i = start - 1; i < start - 1 + 20 && i < totalNumberOfScores; i++) { AbstractWrapper_WithScore.Score score = (AbstractWrapper_WithScore.Score)scores.elementAt(i); if(score != null && score.getValue() != null) { String mind = score.getMindURL() == null ? "UNKNOWN" : score.getMindURL(); String username = score.getUser() == null ? "UNKNOWN" : score.getUser(); String usercontact = score.getUserContact() == null ? null : score.getUserContact(); String authorname = score.getAuthor() == null ? "UNKNOWN" : score.getAuthor(); String authorcontact = score.getAuthorContact() == null ? null : score.getAuthorContact(); String date = score.getDate() == null ? "UNKNOWN" : score.getDate().toString(); String time = score.getTime() == null ? "UNKNOWN" : score.getTime().toString(); String state = score.getValue(); int mate = 0; int live = 0; try { mate = Integer.parseInt(state.substring(0, state.indexOf(",")).trim()); live = Integer.parseInt(state.substring(state.indexOf(",") + 1, state.indexOf("(")).trim()); } catch (NumberFormatException e) { continue; } String userString = (usercontact == null) ? username : ("" + username + ""); String authorString = (authorcontact == null) ? authorname : ("" + authorname + ""); %> <% } } %>
Mind URL Author User Date Time Mated (times) Lived (timesteps)
<%=(i + 1) %> <%=mind %> <%=authorString %> <%=userString %> <%=date %> <%=time %> <%=mate %> <%=live %>

home (w2mind.computing.dcu.ie), tyrrell's simulated environment, challenge, documentation, tools, blocks world

Ciarán O'Leary, Ciaran.OLeary@comp.dit.ie, www.comp.dit.ie/coleary, Last updated, 8th September 2003