Thread: [virtualcommons-svn] SF.net SVN: virtualcommons:[290] irrigation/trunk/src/main
Status: Beta
Brought to you by:
alllee
From: <al...@us...> - 2009-10-08 22:11:00
|
Revision: 290 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=290&view=rev Author: alllee Date: 2009-10-08 22:10:47 +0000 (Thu, 08 Oct 2009) Log Message: ----------- More refactoring, getting rid of unused obscure equation variable names. Adding first cut at configuration files. More cleanup to come. Modified Paths: -------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChartWindowPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChartWindowPanelTokenBandwidth.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationGameWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleScorePanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/IrrigationFacilitatorWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/ClientData.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java Added Paths: ----------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/CloseGateEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/OpenGateEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/PauseEvent.java irrigation/trunk/src/main/resources/configuration/ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round0.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round1.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round10.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round11.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round12.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round13.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round14.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round15.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round16.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round17.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round18.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round19.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round2.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round20.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round21.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round3.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round4.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round5.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round6.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round7.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round8.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round9.xml Removed Paths: ------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/GateOpenedEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/StartPausedEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/StopDownloadEvent.java Property Changed: ---------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ActivitySummaryPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ActivitySummaryPanelNew.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/Ball.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanelAnimation.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanelAnimationNew.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChartWindowPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChartWindowPanelTokenBandwidth.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/Gate.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClientGameState.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationGameWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleScorePanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleWindowPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/PieChart.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ScoreBoxPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/BeginCommunicationRequest.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ClientUpdateEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/DisplaySubmitTokenRequest.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/EndRoundEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ExperimentDurationEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/FacilitatorEndRoundEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/FileDownloadCompleteEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/FileDownloadedEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/InstructionEnableRequest.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/InvestedTokensEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/QuizCompletedEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/RegistrationEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/RoundStartedEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/SendContributionStatusEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/SendFileProgressEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ServerGameStateEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/StartDownload.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/TransferFileInformationEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/IrrigationFacilitator.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/IrrigationFacilitatorWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/ClientData.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationPersister.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/ServerDataModel.java Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ActivitySummaryPanel.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ActivitySummaryPanelNew.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/Ball.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanelAnimation.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanelAnimationNew.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChartWindowPanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChartWindowPanel.java 2009-10-08 18:29:40 UTC (rev 289) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChartWindowPanel.java 2009-10-08 22:10:47 UTC (rev 290) @@ -30,7 +30,7 @@ * Original Author: David Gilbert (for Object Refinery Limited); * Contributor(s): -; * - * $Id: ChartWindowPanel.java 127 2009-04-29 21:31:34Z alllee $ + * $Id$ * * Changes * ------- Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChartWindowPanel.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChartWindowPanelTokenBandwidth.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChartWindowPanelTokenBandwidth.java 2009-10-08 18:29:40 UTC (rev 289) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChartWindowPanelTokenBandwidth.java 2009-10-08 22:10:47 UTC (rev 290) @@ -30,7 +30,7 @@ * Original Author: David Gilbert (for Object Refinery Limited); * Contributor(s): -; * - * $Id: ChartWindowPanelTokenBandwidth.java 124 2009-04-23 17:56:22Z alllee $ + * $Id$ * * Changes * ------- Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChartWindowPanelTokenBandwidth.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java 2009-10-08 18:29:40 UTC (rev 289) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java 2009-10-08 22:10:47 UTC (rev 290) @@ -46,7 +46,7 @@ * not linear. * * @author alllee - * @version $Revision: $ + * @version $Revision$ */ @SuppressWarnings("serial") Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/Gate.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java 2009-10-08 18:29:40 UTC (rev 289) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java 2009-10-08 22:10:47 UTC (rev 290) @@ -20,15 +20,15 @@ import edu.asu.commons.irrigation.events.BeginCommunicationRequest; import edu.asu.commons.irrigation.events.DisplaySubmitTokenRequest; import edu.asu.commons.irrigation.events.EndRoundEvent; -import edu.asu.commons.irrigation.events.GateOpenedEvent; +import edu.asu.commons.irrigation.events.OpenGateEvent; import edu.asu.commons.irrigation.events.InstructionEnableRequest; import edu.asu.commons.irrigation.events.InvestedTokensEvent; import edu.asu.commons.irrigation.events.RegistrationEvent; import edu.asu.commons.irrigation.events.RoundStartedEvent; import edu.asu.commons.irrigation.events.SendContributionStatusEvent; import edu.asu.commons.irrigation.events.SendFileProgressEvent; -import edu.asu.commons.irrigation.events.StartPausedEvent; -import edu.asu.commons.irrigation.events.StopDownloadEvent; +import edu.asu.commons.irrigation.events.PauseEvent; +import edu.asu.commons.irrigation.events.CloseGateEvent; import edu.asu.commons.irrigation.server.ClientData; import edu.asu.commons.net.ClientDispatcher; import edu.asu.commons.net.DispatcherFactory; @@ -143,7 +143,7 @@ public void transmitTokenContributed(int tokens) { InvestedTokensEvent transferTokenBandwidthEvent = new InvestedTokensEvent( getId(), tokens); - clientDispatcher.transmit(transferTokenBandwidthEvent); + transmit(transferTokenBandwidthEvent); } /** @@ -152,22 +152,21 @@ * * @param fileNo */ - public void startDownload(String fileNo) { - GateOpenedEvent startDownloadEvent = new GateOpenedEvent(getId()); - startDownloadEvent.setFileNumber(fileNo); - clientDispatcher.transmit(startDownloadEvent); + public void openGate(String fileNo) { + OpenGateEvent openGateEvent = new OpenGateEvent(getId()); + transmit(openGateEvent); } - public void stopDownload(String fileNo) { - StopDownloadEvent stopDownloadEvent = new StopDownloadEvent(getId()); - stopDownloadEvent.setFileNumber(fileNo); - clientDispatcher.transmit(stopDownloadEvent); + public void closeGate(String fileNo) { + CloseGateEvent closeGateEvent = new CloseGateEvent(getId()); + closeGateEvent.setFileNumber(fileNo); + transmit(closeGateEvent); } public void startPause(String fileNo) { - StartPausedEvent startPausedEvent = new StartPausedEvent(getId()); + PauseEvent startPausedEvent = new PauseEvent(getId()); startPausedEvent.setFileNumber(fileNo); - clientDispatcher.transmit(startPausedEvent); + transmit(startPausedEvent); } public void transmit(Event event) { Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClientGameState.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationGameWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationGameWindow.java 2009-10-08 18:29:40 UTC (rev 289) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationGameWindow.java 2009-10-08 22:10:47 UTC (rev 290) @@ -376,7 +376,7 @@ * time" + System.currentTimeMillis() / 1000); */ - client.startDownload(fileNo); + client.openGate(fileNo); disableAllFiles(); initEnable(); @@ -391,7 +391,7 @@ // TODO Auto-generated method stub int i; for (i = 0; i < TOTAL_CROPS_AVAILABLE; i++) { - if (isDownloaded[i] == false && fileClicked == false && !clientData.isDownloading()) { + if (isDownloaded[i] == false && fileClicked == false && !clientData.isGateOpen()) { (getFile(i)).setBackground(new Color(186, 226, 237)); (getFile(i)).setEnabled(true); } @@ -795,7 +795,7 @@ pauseDownload.setText("Pause"); // StopDownload.setEnabled(true); disableAllFiles(); - client.startDownload(fileNo); + client.openGate(fileNo); } } }); @@ -1072,7 +1072,7 @@ updateFileFinished(clientData.getDownloadListArray()); } else - if(clientData.isDownloading() || clientData.isPaused()){ + if(clientData.isGateOpen() || clientData.isPaused()){ disableAllFiles(); initEnable(); } Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationGameWindow.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java 2009-10-08 18:29:40 UTC (rev 289) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java 2009-10-08 22:10:47 UTC (rev 290) @@ -257,14 +257,14 @@ else{ scoreBoxPanel.update(clientData); } - if(clientData.isDownloading() == true){ + if(clientData.isGateOpen() == true){ upperPanel.openGates(clientData.getPriority()); } else if(clientData.isPaused() == true){ upperPanel.closeGates(clientData.getPriority()); } - if(clientData.isStopped() == true){ + if(clientData.isGateClosed() == true){ upperPanel.closeGates(clientData.getPriority()); } } Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleScorePanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleScorePanel.java 2009-10-08 18:29:40 UTC (rev 289) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleScorePanel.java 2009-10-08 22:10:47 UTC (rev 290) @@ -164,7 +164,7 @@ filesDownloadedText.setText(new Integer(clientData.getCropsGrown()).toString()); tokensText.setText(new Integer(clientData.getTotalTokensEarned()).toString()); - if(clientData.isDownloading() == true && clientData.getAvailableFlowCapacity() > 0) + if(clientData.isGateOpen() == true && clientData.getAvailableFlowCapacity() > 0) fileLabel.setVisible(true); else fileLabel.setVisible(false); Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleScorePanel.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleWindowPanel.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/PieChart.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ScoreBoxPanel.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java 2009-10-08 18:29:40 UTC (rev 289) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java 2009-10-08 22:10:47 UTC (rev 290) @@ -8,6 +8,15 @@ import edu.asu.commons.conf.ExperimentRoundParameters; import edu.asu.commons.util.Duration; +/** + * $Id$ + * + * Configuration parameters for a given round in the irrigation experiment. + * Provides reward functions, etc. + * + * @author <a href='mailto:All...@as...'>Allen Lee</a> + * @version $Rev$ + */ public class RoundConfiguration extends ExperimentRoundParameters.Base<ServerConfiguration> { private static final long serialVersionUID = -5053624886508752562L; @@ -22,15 +31,6 @@ super(resource); } - /** - * used to get the file Size given the File number from the current - * configuration file - */ - public int getFileSize(String fileNumber) { - // FIXME: lift constants - return getIntProperty(fileNumber, 250); - } - public int getMaximumClientFlowCapacity() { return getIntProperty("max-client-flow-capacity", 25); } @@ -47,12 +47,6 @@ return getIntProperty("max-canal-flow-capacity", 40); } - public double getFilesDownloadAwardConversion() { - // FIXME: change String key to something more meaningful - return getDoubleProperty("FilesDownload-Award-Conversion", 1.0d); - // return (double) Integer.parseInt(properties.getProperty("FilesDownload-Award-Conversion")); - } - public int getMaximumTokenContribution() { return getIntProperty("max-token-contribution", 10); } @@ -61,28 +55,29 @@ * returns maximum number of tokens that could have been contributed * @return */ - public int getMaximumTotalTokenContribution(){ + public int getMaximumTotalTokenContribution() { return getMaximumTokenContribution() * getClientsPerGroup(); } public int getMaximumInfrastructureEfficiency() { - return getIntProperty("maximum-infrastructure-efficiency", 100); + return getIntProperty("max-infrastructure-efficiency", 100); } - public int getBtmax() { - return getIntProperty("Btmax"); + public double getMaximumIndividualFlowCapacity() { + return getDoubleProperty("max-individual-flow-capacity", 20.0d); } public boolean isPracticeRound() { return getBooleanProperty("practice-round"); } + // FIXME: horrible hack.. figure out why this is here again. public boolean isSecondPracticeRound(){ return getBooleanProperty("second-practice-round",false); } public int getClientsPerGroup() { - return getIntProperty("clients-per-group", 0); + return getIntProperty("clients-per-group", 5); } /** @@ -150,30 +145,6 @@ return getIntProperty("communication-duration", 40); } - public double getAlpha() { - return getDoubleProperty("TBM-alpha", 0.0d); - } - - public double getA() { - return getDoubleProperty("TBM-a", 0.0d); - } - - public double getB() { - return getDoubleProperty("TBM-b", 0.0d); - } - - public double getAlphaAward() { - return getDoubleProperty("FAM-alpha", 0.0d); - } - - public double getA_award() { - return getDoubleProperty("FAM-a", 0.0d); - } - - public double getB_award() { - return getDoubleProperty("FAM-b", 0.0d); - } - /** * Returns the duration of the round in seconds. Set to default of 50 seconds per round. */ Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java 2009-10-08 18:29:40 UTC (rev 289) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java 2009-10-08 22:10:47 UTC (rev 290) @@ -7,7 +7,7 @@ import edu.asu.commons.conf.ExperimentConfiguration; /** - * $Id: ServerConfiguration.java 131 2009-04-30 01:52:21Z alllee $ + * $Id$ * * Contains the know-how for parsing and programmatically accessing the forager * server's configuration file properties. The forager server's config file @@ -23,7 +23,7 @@ * @author <a href='mailto:All...@as...'>Allen Lee</a> * @see edu.asu.csid.irrigation.RoundConfiguration, * edu.asu.csid.conf.ExperimentConfiguration - * @version $Revision: 131 $ + * @version $Revision$ */ public class ServerConfiguration extends ExperimentConfiguration.Base<RoundConfiguration> { @@ -34,8 +34,6 @@ private final static String DEFAULT_LOG_FILE_DESTINATION = "irrigation.log"; - //FIXME: can move this parameter to the configuration files - public ServerConfiguration() { super(); } @@ -57,9 +55,8 @@ } @Override - protected RoundConfiguration createConfiguration( - String roundConfigurationResource) { - return new RoundConfiguration(roundConfigurationResource); + protected RoundConfiguration createConfiguration(String roundConfigurationFile) { + return new RoundConfiguration(roundConfigurationFile); } @Override @@ -70,42 +67,42 @@ /** * getting the general welcome instructions * + * FIXME: Refactor this method. + * * @param instructionNumber * @param pagesTraversed * @return */ public String getGeneralInstructions(int instructionNumber, - int pagesTraversed,int clientPriority) { + int pagesTraversed, int clientPosition) { String position = ""; String undisruptedBandwidthInstruction = ""; - //System.out.println("Instruction Nnumber :"+instructionNumber+" Pages Traversed :"+pagesTraversed); if (instructionNumber != 11) { if (instructionNumber > pagesTraversed) { if (instructionNumber == 4) { //instructionNumber = getNewInstructionNumber(clientPriority); - position = "\n YOUR POSITION : "+getPosition(clientPriority); + position = "\n Your position : "+toPriorityString(clientPosition); } if(instructionNumber == 5 && isUndisruptedBandwidth()){ undisruptedBandwidthInstruction=assistant.getStringProperty("general-instructions"+"-undisruptedBandwidth"); } - - return (position+assistant.getStringProperty("general-instructions" - + instructionNumber - )+undisruptedBandwidthInstruction+assistant - .getStringProperty("general-instructionsq" - + instructionNumber)); - } else { + return (position + + assistant.getStringProperty("general-instructions" + instructionNumber) + + undisruptedBandwidthInstruction + + assistant.getStringProperty("general-instructionsq" + instructionNumber)); + } + else { if (instructionNumber == 4) { //instructionNumber = getNewInstructionNumber(clientPriority); - position = "\n YOUR POSITION : "+getPosition(clientPriority); + position = "\n YOUR POSITION : "+toPriorityString(clientPosition); } if(instructionNumber == 5 && isUndisruptedBandwidth()){ undisruptedBandwidthInstruction=assistant.getStringProperty("general-instructions"+"-undisruptedBandwidth"); } - return position+assistant.getStringProperty("general-instructions" - + instructionNumber, - "<b>No instructions available for this round</b>")+undisruptedBandwidthInstruction; + return (position + + assistant.getStringProperty("general-instructions" + instructionNumber, "<b>No instructions available for this round</b>") + + undisruptedBandwidthInstruction); } } @@ -115,27 +112,33 @@ "<b>No instructions available for this round</b>"); } + + private final static String[] PRIORITY_STRINGS = { "A", "B", "C", "D", "E" }; - private String getPosition(int clientPriority) { - // TODO Auto-generated method stub - switch(clientPriority){ - case 0 : return "A"; - case 1 : return "B"; - case 2: return "C"; - case 3: return "D"; - case 4: return "E"; - } - return "Position not found"; + private String toPriorityString(int clientPriority) { + // bounds check + if (clientPriority >= 0 && clientPriority < PRIORITY_STRINGS.length) { + return PRIORITY_STRINGS[clientPriority]; + } +// +// switch(clientPriority){ +// case 0 : return "A"; +// case 1 : return "B"; +// case 2: return "C"; +// case 3: return "D"; +// case 4: return "E"; +// } + return "Position not found"; } //overriding method isLastRound - public boolean isLastRound(){ - System.out.println("The Current round Number is :"+getCurrentRoundNumber()); - if(getCurrentRoundNumber() == assistant.getIntProperty("number-of-rounds")-1) - return true; - else - return false; - } +// public boolean isLastRound(){ +// System.out.println("The Current round Number is :"+getCurrentRoundNumber()); +// if(getCurrentRoundNumber() == assistant.getIntProperty("number-of-rounds")-1) +// return true; +// else +// return false; +// } public boolean isUndisruptedBandwidth(){ if(assistant.getBooleanProperty("undisrupted-bandwidth")== true) @@ -143,26 +146,10 @@ return false; } - private int getNewInstructionNumber(int clientPriority) { - // TODO Auto-generated method stub - switch(clientPriority){ - case 0 : return 40; - - case 1: return 41; - - } - //FIXME: AT present just returning case 1 's case when clientPriority is 2,3,4. Need to change this. - if(clientPriority == 2 || clientPriority == 3 || clientPriority == 4){ - return 41; - } - return -1; + public double getShowUpPayment() { + return assistant.getDoubleProperty("showup-payment", 5.0d); } - public String getShowUpFees() { - // TODO Auto-generated method stub - return assistant.getStringProperty("showup-fees", "5"); - } - public Map<String, String> getQuizAnswers() { //System.out.println("I am in the beginning of getquiz"); Properties properties = assistant.getProperties(); Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/BeginCommunicationRequest.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ClientUpdateEvent.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Copied: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/CloseGateEvent.java (from rev 288, irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/StopDownloadEvent.java) =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/CloseGateEvent.java (rev 0) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/CloseGateEvent.java 2009-10-08 22:10:47 UTC (rev 290) @@ -0,0 +1,17 @@ +package edu.asu.commons.irrigation.events; + +import edu.asu.commons.net.Identifier; + +/** + * @author Sanket + * + */ +public class CloseGateEvent extends TransferFileInformationEvent { + + private static final long serialVersionUID = -6932559955912875464L; + + public CloseGateEvent(Identifier id) { + super(id); + } + +} Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/CloseGateEvent.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/DisplaySubmitTokenRequest.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/EndRoundEvent.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ExperimentDurationEvent.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/FacilitatorEndRoundEvent.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/FileDownloadCompleteEvent.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/FileDownloadedEvent.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Deleted: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/GateOpenedEvent.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/GateOpenedEvent.java 2009-10-08 18:29:40 UTC (rev 289) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/GateOpenedEvent.java 2009-10-08 22:10:47 UTC (rev 290) @@ -1,17 +0,0 @@ -package edu.asu.commons.irrigation.events; - -import edu.asu.commons.net.Identifier; - -/** - * @author Sanket - * - */ -public class GateOpenedEvent extends TransferFileInformationEvent { - - private static final long serialVersionUID = -4902131375099741851L; - - public GateOpenedEvent(Identifier id) { - super(id); - } - -} Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/InstructionEnableRequest.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/InvestedTokensEvent.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Copied: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/OpenGateEvent.java (from rev 288, irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/GateOpenedEvent.java) =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/OpenGateEvent.java (rev 0) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/OpenGateEvent.java 2009-10-08 22:10:47 UTC (rev 290) @@ -0,0 +1,18 @@ +package edu.asu.commons.irrigation.events; + +import edu.asu.commons.event.AbstractPersistableEvent; +import edu.asu.commons.net.Identifier; + +/** + * + * + */ +public class OpenGateEvent extends AbstractPersistableEvent { + + private static final long serialVersionUID = -4902131375099741851L; + + public OpenGateEvent(Identifier id) { + super(id); + } + +} Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/OpenGateEvent.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Copied: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/PauseEvent.java (from rev 288, irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/StartPausedEvent.java) =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/PauseEvent.java (rev 0) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/PauseEvent.java 2009-10-08 22:10:47 UTC (rev 290) @@ -0,0 +1,21 @@ +package edu.asu.commons.irrigation.events; + +import edu.asu.commons.net.Identifier; + + + +/** + * @author Sanket + * + */ +public class PauseEvent extends TransferFileInformationEvent { + + private static final long serialVersionUID = -6518246719469415026L; + + public PauseEvent(Identifier id) { + super(id); + } + + + +} Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/PauseEvent.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/QuizCompletedEvent.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/RegistrationEvent.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/RoundStartedEvent.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/SendContributionStatusEvent.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/SendFileProgressEvent.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ServerGameStateEvent.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/StartDownload.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Deleted: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/StartPausedEvent.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/StartPausedEvent.java 2009-10-08 18:29:40 UTC (rev 289) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/StartPausedEvent.java 2009-10-08 22:10:47 UTC (rev 290) @@ -1,21 +0,0 @@ -package edu.asu.commons.irrigation.events; - -import edu.asu.commons.net.Identifier; - - - -/** - * @author Sanket - * - */ -public class StartPausedEvent extends TransferFileInformationEvent { - - private static final long serialVersionUID = -6518246719469415026L; - - public StartPausedEvent(Identifier id) { - super(id); - } - - - -} Deleted: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/StopDownloadEvent.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/StopDownloadEvent.java 2009-10-08 18:29:40 UTC (rev 289) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/StopDownloadEvent.java 2009-10-08 22:10:47 UTC (rev 290) @@ -1,17 +0,0 @@ -package edu.asu.commons.irrigation.events; - -import edu.asu.commons.net.Identifier; - -/** - * @author Sanket - * - */ -public class StopDownloadEvent extends TransferFileInformationEvent { - - private static final long serialVersionUID = -6932559955912875464L; - - public StopDownloadEvent(Identifier id) { - super(id); - } - -} Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/TransferFileInformationEvent.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/IrrigationFacilitator.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/IrrigationFacilitatorWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/IrrigationFacilitatorWindow.java 2009-10-08 18:29:40 UTC (rev 289) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/IrrigationFacilitatorWindow.java 2009-10-08 22:10:47 UTC (rev 290) @@ -181,7 +181,7 @@ clientId.toString(), data.getTotalTokensEarned(), data.getTotalTokensEarned() * model.getCurrentConfiguration().getDollarsPerToken(), - data.getTotalTokens() * model.getCurrentConfiguration().getDollarsPerToken()+Double.parseDouble(facilitator.getConfiguration().getShowUpFees()))); + data.getTotalTokens() * model.getCurrentConfiguration().getDollarsPerToken()+ facilitator.getConfiguration().getShowUpPayment())); } builder.append("</tbody></table><hr>"); //FIXME: Could not understand how to evaluate .isLastRound(), hence using the Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/IrrigationFacilitatorWindow.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/ClientData.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/ClientData.java 2009-10-08 18:29:40 UTC (rev 289) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/ClientData.java 2009-10-08 22:10:47 UTC (rev 290) @@ -20,7 +20,7 @@ * minus tokens subtracted by sanctioning others * * @author <a href='ano...@gm...'>Allen Lee</a>, Deepali Bhagvat - * @version $Revision: 131 $ + * @version $Revision$ */ public class ClientData implements Serializable { @@ -46,7 +46,7 @@ private int cropsGrown = 0; // maximum available bandwidth - private double maximumDeliveryBandwidth; + private double maximumIndividualFlowCapacity; /** * current download speed */ @@ -64,11 +64,8 @@ private boolean paused = false; - // FIXME: this is just the negation of downloading, we do not need two flags for this. - private boolean stopped = true; + private boolean gateOpen = false; - private boolean downloading = false; - public ClientData(Identifier id) { this.id = id; } @@ -77,12 +74,12 @@ return paused; } - public boolean isStopped(){ - return stopped; + public boolean isGateClosed(){ + return ! gateOpen; } - public boolean isDownloading(){ - return downloading; + public boolean isGateOpen(){ + return gateOpen; } // cap on the size of the entire stream (e.g,. 50 kbps) @@ -91,12 +88,12 @@ } // cap on the size of the stream that can be delivered to the client (e.g., 25 kbps) - public void setMaximumDeliveryBandwidth(double deliveryBandwidth){ - this.maximumDeliveryBandwidth = deliveryBandwidth; + public void setMaximumIndividualFlowCapacity(double deliveryBandwidth){ + this.maximumIndividualFlowCapacity = deliveryBandwidth; } - public double getMaximumDeliveryBandwidth(){ - return maximumDeliveryBandwidth; + public double getMaximumIndividualFlowCapacity(){ + return maximumIndividualFlowCapacity; } /** @@ -126,18 +123,6 @@ return fileNumber; } - /** - * Gets and sets the size of the file - * @param fileSize - */ - public void setFileSize(int fileSize){ - this.fileSize = fileSize; - } - - public double getFileSize(){ - return fileSize; - } - public double getPercentFileDownload(){ return percentFileDownloaded; } @@ -148,21 +133,23 @@ * that the users are allowed to do. */ - public void setStartDownload(){ - downloading = true; + public void openGate(){ + gateOpen = true; paused = false; - stopped = false; } public void setPaused(){ paused = true; - downloading = false; - stopped = false; + gateOpen = false; } + + public void unpause() { + paused = false; + gateOpen = true; + } - public void setStoppedDownloading(){ - stopped = true; - downloading = false; + public void closeGate(){ + gateOpen = false; paused = false; } @@ -197,7 +184,7 @@ */ public void reset() { resetFileInformation(); - setStoppedDownloading(); + closeGate(); contributedTokens = 0; //adding number of files to be downloaded = 0 per round cropsGrown = 0; @@ -235,7 +222,7 @@ public void init(double availableBandwidth) { resetFileInformation(); //maximumDeliveryBandwidth = getRoundConfiguration().getBtmax()/getRoundConfiguration().getClientsPerGroup(); - maximumDeliveryBandwidth = getRoundConfiguration().getBtmax()/2; + maximumIndividualFlowCapacity = getRoundConfiguration().getMaximumIndividualFlowCapacity(); //currentBandwidth = totalContributedBandwidth; this.availableFlowCapacity = availableBandwidth; } @@ -245,7 +232,7 @@ fileNumber = ""; downloadedFileSize = 0; percentFileDownloaded = 0; - setStoppedDownloading(); + closeGate(); } public void award() { @@ -310,7 +297,7 @@ *as processDownload function */ public void allocateFlowCapacity(double availableBandwidth) { - assert downloading; + assert gateOpen; fileDownloaded = false; incrementFileDownloadSize(); } Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/ClientData.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java 2009-10-08 18:29:40 UTC (rev 289) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java 2009-10-08 22:10:47 UTC (rev 290) @@ -192,10 +192,10 @@ public void allocateFlowCapacity(ClientData clientData) { - if (currentlyAvailableFlowCapacity >= clientData.getMaximumDeliveryBandwidth()) { - currentlyAvailableFlowCapacity -= clientData.getMaximumDeliveryBandwidth(); + if (currentlyAvailableFlowCapacity >= clientData.getMaximumIndividualFlowCapacity()) { + currentlyAvailableFlowCapacity -= clientData.getMaximumIndividualFlowCapacity(); // setAvailableBandwidth(clientData.getTotalContributedBandwidth() - clientData.getDeliveryBandwidth()); - clientData.setAvailableFlowCapacity(clientData.getMaximumDeliveryBandwidth()); + clientData.setAvailableFlowCapacity(clientData.getMaximumIndividualFlowCapacity()); } else { clientData.setAvailableFlowCapacity(currentlyAvailableFlowCapacity); Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationPersister.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java 2009-10-08 18:29:40 UTC (rev 289) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java 2009-10-08 22:10:47 UTC (rev 290) @@ -22,7 +22,7 @@ import edu.asu.commons.irrigation.events.DisplaySubmitTokenRequest; import edu.asu.commons.irrigation.events.EndRoundEvent; import edu.asu.commons.irrigation.events.FacilitatorEndRoundEvent; -import edu.asu.commons.irrigation.events.GateOpenedEvent; +import edu.asu.commons.irrigation.events.OpenGateEvent; import edu.asu.commons.irrigation.events.InstructionEnableRequest; import edu.asu.commons.irrigation.events.InvestedTokensEvent; import edu.asu.commons.irrigation.events.QuizCompletedEvent; @@ -30,8 +30,8 @@ import edu.asu.commons.irrigation.events.RoundStartedEvent; import edu.asu.commons.irrigation.events.SendContributionStatusEvent; import edu.asu.commons.irrigation.events.SendFileProgressEvent; -import edu.asu.commons.irrigation.events.StartPausedEvent; -import edu.asu.commons.irrigation.events.StopDownloadEvent; +import edu.asu.commons.irrigation.events.PauseEvent; +import edu.asu.commons.irrigation.events.CloseGateEvent; import edu.asu.commons.net.Dispatcher; import edu.asu.commons.net.Identifier; import edu.asu.commons.net.event.ConnectionEvent; @@ -39,12 +39,12 @@ import edu.asu.commons.util.Duration; /** - * $Id: IrrigationServer.java 129 2009-04-29 23:38:45Z alllee $ + * $Id$ * * Main entry point for the irrigation experiment server. * * @author Sanket Joshi, <a href='All...@as...'>Allen Lee</a> - * @version $Revision: 129 $ + * @version $Revision$ */ public class IrrigationServer extends AbstractExperiment<ServerConfiguration> { @@ -220,22 +220,19 @@ } } }); - addEventProcessor(new EventTypeProcessor<GateOpenedEvent>(GateOpenedEvent.class) { - public void handle(GateOpenedEvent event) { + addEventProcessor(new EventTypeProcessor<OpenGateEvent>(OpenGateEvent.class) { + public void handle(OpenGateEvent event) { ClientData clientData = clients.get(event.getId()); - String fileNumber = event.getFileNumber(); - clientData.setFileNumber(fileNumber); - clientData.setFileSize(getRoundConfiguration().getFileSize(fileNumber)); - clientData.setStartDownload(); + clientData.openGate(); } }); - addEventProcessor(new EventTypeProcessor<StopDownloadEvent>(StopDownloadEvent.class) { - public void handle(StopDownloadEvent event) { - clients.get(event.getId()).setStoppedDownloading(); + addEventProcessor(new EventTypeProcessor<CloseGateEvent>(CloseGateEvent.class) { + public void handle(CloseGateEvent event) { + clients.get(event.getId()).closeGate(); } }); - addEventProcessor(new EventTypeProcessor<StartPausedEvent>(StartPausedEvent.class) { - public void handle(StartPausedEvent event) { + addEventProcessor(new EventTypeProcessor<PauseEvent>(PauseEvent.class) { + public void handle(PauseEvent event) { clients.get(event.getId()).setPaused(); } }); @@ -298,12 +295,12 @@ if(clientData.getAvailableFlowCapacity()<=0 && getConfiguration().isUndisruptedBandwidth()){ clientData.init(group.getCurrentlyAvailableFlowCapacity()); } - if (clientData.isDownloading()) { + if (clientData.isGateOpen()) { //System.out.println("Downloading file"+clientData.getFileNumber()+"Current time"+System.currentTimeMillis()/1000); group.allocateFlowCapacity(clientData); } - else if (clientData.isStopped()) { + else if (clientData.isGateClosed()) { clientData.init(group.getCurrentlyAvailableFlowCapacity()); } else if (clientData.isPaused()) { Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/ServerDataModel.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml 2009-10-08 22:10:47 UTC (rev 290) @@ -0,0 +1,620 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation XML-ized experiment round configuration</comment> + +<!--<entry key="hostname">localhost</entry>--> +<entry key="hostname">localhost</entry> +<entry key="port">16001</entry> +<entry key="round0">round0.xml</entry> +<entry key="round1">round1.xml</entry> +<entry key="round2">round2.xml</entry> +<entry key="round3">round3.xml</entry> +<entry key="round4">round4.xml</entry> +<entry key="round5">round5.xml</entry> +<entry key="round6">round6.xml</entry> +<entry key="round7">round7.xml</entry> +<entry key="round8">round8.xml</entry> +<entry key="round9">round9.xml</entry> +<entry key="round10">round10.xml</entry> +<entry key="round11">round11.xml</entry> +<entry key="round12">round12.xml</entry> +<entry key="round13">round13.xml</entry> +<entry key="round14">round14.xml</entry> +<entry key="round15">round15.xml</entry> +<entry key="round16">round16.xml</entry> +<entry key="round17">round17.xml</entry> +<entry key="round18">round18.xml</entry> +<entry key="round19">round19.xml</entry> +<entry key="round20">round20.xml</entry> +<entry key="round21">round21.xml</entry> + + +<entry key="wait-for-participants">true</entry> +<entry key="number-of-rounds">22</entry> + +<entry key="undisrupted-bandwidth">true</entry> + +<entry key="q1">4</entry> +<entry key="q2">identity</entry> +<entry key="q3">49</entry> +<entry key="q4">76</entry> +<entry key="q5">4</entry> +<entry key="q6">5</entry> +<entry key="q7">25</entry> +<entry key="q8">4</entry> +<entry key="q9">25</entry> +<entry key="q10">30</entry> +<entry key="q11">1.50</entry> + + +<entry key="facilitator-instructions"> +<![CDATA[ +<h3>Facilitator Instructions</h3> +<p> +Welcome to the facilitator interface. This interface allows you to control +the experiment. You may only modify configuration parameters <b>before</b> +you start the experiment by selecting the Configuration menu. When all the +participants are ready to begin the experiment, you can start the experiment +by selecting Experiment -> Start. After a round has been completed you +will be able to view the statistics for all of the participants. You can +begin the next round by selecting Round -> Start. +</p> +]]> +</entry> + + + +<entry key="general-instructions0"> +<![CDATA[ +<center><h3>Welcome to the experiment. Please do not close this window or open any +other applications.</h3></center> +]]> +</entry> + +<entry key="general-instructions1"> +<![CDATA[ +<h3>General Instructions</h3> +<p>Welcome. You have already earned 5 dollars by showing up for this exercise. +You can earn more, up to an extra 25 dollars, by participating in the exercise +which will last for about one hour. You will participate in this exercise as a +part of a group. Each group has five participants. Your group has been formed +by randomly assigning you to FOUR other participants in the room. The amount +of money you earn will depend on the decisions made by you and the rest of the +group. That is, your earnings will depend on your decisions as well as the +other members of your group. +</p> +<p> +This exercise mimics decisions people make in irrigation systems. In each round you +will receive 10 tokens which you can choose to keep or invest in the irrigation +infrastructure (for example canals and water diversion structures). Depending on the +state of repair of the irrigation infrastructure, it will be capable of directing +water to your field when you use your water diversion structure (called an +irrigation gate). Depending on the amount of water you can get to your field, you +can grow crops. Depending on the number of crops you grow you earn tokens. Each +token is worth 5 cents and you will be paid cash in private at the end of the +experiment based on the number of tokens you earned. +</p> +<p> +The experiment consists of a number of rounds. In each round you will first make a +decision as to how much to invest in the irrigation infrastructure. Without periodic +investment, the irrigation infrastructure will break down over time. Based on the +combined contributions of all 5 participants in your group in each round, as +explained below, your group can maintain the performance of the irrigation +infrastructure. The condition of the irrigation infrastructure determines +its capacity to deliver water which you can use to grow crops. +</p> +]]> +</entry> + +<entry key="general-instructionsq1"> +<![CDATA[ +<br><br> +To continue to the next page, please answer the following question:<br> +<form> +How many OTHER people in the room will be in your group?<br> +<input type="radio" name="q1" value="0">0<br> +<input type="radio" name="q1" value="1">1<br> +<input type="radio" name="q1" value="4">4<br> +<input type="radio" name="q1" value="Everybody">Everybody<br> +<br><br> +<input type="submit" name="submit" value="Submit"> +</form> +]]> +</entry> + +<entry key="general-instructions2"> +<![CDATA[ +<h3>Chat</h3> +<p>Each round will start with a chat period of 40 seconds where you can send text +messages to the other participants. You may discuss any aspect of the exercise. +<b>However</b>, you are <b>not allowed</b> to promise the other participants +side-payments or threaten them with any consequence after the experiment is +finished. You are also <b>not allowed</b> to reveal your real identity. We will be +monitoring the chat traffic. If we see any member of a group violating the rules, +we will have to remove that <b>entire group</b> from the experiment room. That +group will have to wait until the entire experiment is finished to receive +their payment.<br><br> + +You will see a text box appear on your screen when a chat period starts. The amount +of time left in the chat period will be shown at the <b>top left of the screen</b>.<br> +]]> +</entry> + +<entry key="general-instructionsq2"> +<![CDATA[ +<br><br> +To continue to the next page, please answer the following question:<br> +<form> +Which of the following topics are you <b>not allowed</b> to discuss in chat?<br> +<input type="radio" name="q2" value="weather">the weather<br> +<input type="radio" name="q2"... [truncated message content] |
From: <al...@us...> - 2009-10-19 18:58:27
|
Revision: 301 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=301&view=rev Author: alllee Date: 2009-10-19 18:58:17 +0000 (Mon, 19 Oct 2009) Log Message: ----------- finished adding the rest of the general instructions, still need to fill in screenshots. More refactoring on the client GUI as well, general instructions are almost complete. Modified Paths: -------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ClientDataModel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/RegistrationEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/FacilitatorWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ClientDataModel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ClientDataModel.java 2009-10-17 22:23:23 UTC (rev 300) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ClientDataModel.java 2009-10-19 18:58:17 UTC (rev 301) @@ -1,6 +1,3 @@ -/** - * - */ package edu.asu.commons.irrigation.client; import java.util.ArrayList; @@ -32,13 +29,15 @@ private GroupDataModel groupDataModel; private IrrigationClient client; - + + private ServerConfiguration serverConfiguration; private RoundConfiguration roundConfiguration; private int timeLeft = 0; public ClientDataModel(EventChannel channel, IrrigationClient client) { this.client = client; + this.serverConfiguration = client.getServerConfiguration(); } public ClientData getClientData() { @@ -85,12 +84,11 @@ } public ServerConfiguration getServerConfiguration() { - return roundConfiguration.getParentConfiguration(); + return serverConfiguration; } public void setGroupDataModel(GroupDataModel groupDataModel) { this.groupDataModel = groupDataModel; - setRoundConfiguration(groupDataModel.getRoundConfiguration()); } public GroupDataModel getGroupDataModel() { Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java 2009-10-17 22:23:23 UTC (rev 300) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java 2009-10-19 18:58:17 UTC (rev 301) @@ -41,6 +41,8 @@ * $Id$ * * The root experiment window placed in the client's JFrame. + * + * FIXME: refactor this class. * * @author <a href='mailto:All...@as...'>Allen Lee</a> * @version $Rev$ @@ -50,6 +52,8 @@ private static final long serialVersionUID = -5636795631355367711L; private ClientDataModel clientDataModel; + + private ChatPanel chatPanel; private JScrollPane instructionsScrollPane; @@ -249,7 +253,7 @@ // FIXME: get rid of hardcoded animation on page 5. Should instead // just be an animated gif or something like that. // should be more like "if instructions.hasAnimation()" - if(instructionNumber == 5) { + if (instructionNumber == 5) { getInstructionsPanel().add(getCanalAnimationPanel(), BorderLayout.PAGE_START); } else { @@ -421,12 +425,11 @@ * @return */ private String getGeneralInstructions(int pageNumber, int pagesTraversed) { - return clientDataModel.getServerConfiguration().getGeneralInstructions(pageNumber, pagesTraversed, client.getClientDataModel().getPriority()); } private String getGeneralInstructions(int pageNumber) { - return client.getServerConfiguration().getGeneralInstructions(pageNumber); + return clientDataModel.getServerConfiguration().getGeneralInstructions(pageNumber); } private JTextField getInvestedTokensTextField() { @@ -645,7 +648,7 @@ "showup fee, for a grand total of $%3.2f", (float)dollarsPerToken*clientData.getTotalTokensEarned(), (float)dollarsPerToken*clientData.getTotalTokens(), - (float)dollarsPerToken*clientData.getTotalTokens() + client.getServerConfiguration().getShowUpPayment() + (float)dollarsPerToken*clientData.getTotalTokens() + clientDataModel.getServerConfiguration().getShowUpPayment() )); //append the added practice round instructions if(clientDataModel.getRoundConfiguration().isPracticeRound()) { @@ -665,7 +668,8 @@ public void run() { instructionsEditorPane.setText(instructions); instructionsEditorPane.setCaretPosition(0); - instructionsScrollPane.requestFocusInWindow(); + instructionsScrollPane.requestFocusInWindow(); + ExperimentGameWindow.this.repaint(); } }); } @@ -900,7 +904,6 @@ addCenterComponent(getInstructionsPanel()); } - private ChatPanel chatPanel; private ChatPanel getChatPanel() { if (chatPanel == null) { chatPanel = new ChatPanel(); Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java 2009-10-17 22:23:23 UTC (rev 300) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java 2009-10-19 18:58:17 UTC (rev 301) @@ -69,7 +69,7 @@ public IrrigationClient(EventChannel channel, ServerConfiguration serverConfiguration) { this.channel = channel; - this.serverConfiguration = serverConfiguration; + setServerConfiguration(serverConfiguration); this.clientDispatcher = DispatcherFactory.getInstance().createClientDispatcher(channel); } @@ -158,9 +158,12 @@ } private void initEventProcessors() { + // registration events are sent before the start of each round and contain the configuration + // for that round, including all instructions, parameters, for that round. channel.add(this, new EventTypeProcessor<RegistrationEvent>(RegistrationEvent.class) { public void handle(RegistrationEvent event) { RoundConfiguration configuration = event.getRoundConfiguration(); + clientDataModel.setGroupDataModel(event.getClientData().getGroupDataModel()); clientDataModel.setRoundConfiguration(configuration); experimentGameWindow.updateRoundInstructions(configuration); } @@ -224,7 +227,7 @@ public ServerConfiguration getServerConfiguration() { return serverConfiguration; } - + public void setServerConfiguration(ServerConfiguration serverConfiguration) { this.serverConfiguration = serverConfiguration; } Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java 2009-10-17 22:23:23 UTC (rev 300) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java 2009-10-19 18:58:17 UTC (rev 301) @@ -65,10 +65,9 @@ } /** - * getting the general welcome instructions + * Returns the appropriate general instructions text, performing logic for adding + * positions and quizzes. * - * FIXME: Refactor this method. - * * @param instructionPageNumber * @param pagesTraversed * @return @@ -150,5 +149,9 @@ public String getFinalInstructions() { return assistant.getProperty("final-instructions", "<b>The experiment is now over. Thanks for participating!</b>"); } + + public String getInvestmentInstructions() { + return assistant.getProperty("investment-instructions"); + } } Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/RegistrationEvent.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/RegistrationEvent.java 2009-10-17 22:23:23 UTC (rev 300) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/RegistrationEvent.java 2009-10-19 18:58:17 UTC (rev 301) @@ -17,15 +17,25 @@ private RoundConfiguration roundConfiguration; private final ClientData clientData; - public RegistrationEvent(Identifier target, RoundConfiguration configuration) { - this(target, configuration, null); + /** + * Constructor used by the facilitator, which doesn't need any ClientData objects. + * + * @param id + * @param roundConfiguration + */ + public RegistrationEvent(Identifier id, RoundConfiguration roundConfiguration) { + this(id, roundConfiguration, null); } - public RegistrationEvent(Identifier target, RoundConfiguration roundConfiguration, ClientData clientData) { - super(target, roundConfiguration.getInstructions()); - this.roundConfiguration = roundConfiguration; + public RegistrationEvent(Identifier id, RoundConfiguration roundConfiguration, ClientData clientData) { + super(id, roundConfiguration.getInstructions()); this.clientData = clientData; } + + public RegistrationEvent(ClientData clientData, RoundConfiguration roundConfiguration) { + this(clientData.getId(), roundConfiguration, clientData); + this.roundConfiguration = roundConfiguration; + } public RoundConfiguration getRoundConfiguration() { return roundConfiguration; Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/FacilitatorWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/FacilitatorWindow.java 2009-10-17 22:23:23 UTC (rev 300) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/FacilitatorWindow.java 2009-10-19 18:58:17 UTC (rev 301) @@ -1,6 +1,3 @@ -/** - * - */ package edu.asu.commons.irrigation.facilitator; import java.awt.BorderLayout; @@ -33,13 +30,12 @@ */ public class FacilitatorWindow extends JPanel { + private static final long serialVersionUID = 3607885359444962888L; + private Facilitator facilitator; private Dimension windowDimension; - private static final long serialVersionUID = 1L; - - private JButton startRoundButton = null; private JButton beginChatButton; @@ -47,7 +43,7 @@ private HtmlEditorPane editorPane; private JScrollPane scrollPane; - private JButton enableInstructionButton; + private JButton showInstructionsButton; /** * This is the default constructor */ @@ -58,15 +54,7 @@ initialize(); } - /* - public IrrigationFacilitatorWindow(){ - super(); - initialize(); - } - */ - /** - * This method initializes this * * @return void */ @@ -77,7 +65,7 @@ buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); buttonPanel.add(getStartRoundButton()); buttonPanel.add(getBeginChatButton()); - buttonPanel.add(getEnableInstructionButton()); + buttonPanel.add(getShowInstructionsButton()); add(buttonPanel, BorderLayout.NORTH); JPanel informationPanel = new JPanel(); editorPane = new HtmlEditorPane(); @@ -86,18 +74,17 @@ add(informationPanel, BorderLayout.CENTER); } - private JButton getEnableInstructionButton() { - // TODO Auto-generated method stub - if (enableInstructionButton == null) { - enableInstructionButton = new JButton("Enable Instruction"); - enableInstructionButton.addActionListener(new ActionListener() { + private JButton getShowInstructionsButton() { + if (showInstructionsButton == null) { + showInstructionsButton = new JButton("Show Instructions"); + showInstructionsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { - enableInstructionButton.setEnabled(false); +// enableInstructionButton.setEnabled(false); facilitator.transmit(new ShowInstructionsRequest(facilitator.getId())); } }); } - return enableInstructionButton; + return showInstructionsButton; } /** @@ -124,7 +111,7 @@ return beginChatButton; } - public Facilitator getFacilitator(){ + public Facilitator getFacilitator() { return facilitator; } @@ -143,9 +130,8 @@ startRoundButton = new JButton(); startRoundButton.setBounds(new Rectangle(180, 16, 136, 24)); startRoundButton.setText("Start Round"); - startRoundButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed() + startRoundButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { facilitator.sendBeginRoundRequest(); } }); Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java 2009-10-17 22:23:23 UTC (rev 300) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java 2009-10-19 18:58:17 UTC (rev 301) @@ -186,13 +186,13 @@ clients.put(identifier, clientData); serverDataModel.addClient(clientData); } - transmit(new RegistrationEvent(clientData.getId(), getRoundConfiguration(), clientData)); + transmit(new RegistrationEvent(clientData, getRoundConfiguration())); } }); addEventProcessor(new EventTypeProcessor<DisconnectionRequest>(DisconnectionRequest.class) { @Override public void handle(DisconnectionRequest request) { - getLogger().warning("irrigation server is disconnecting: " + request); + getLogger().warning("irrigation server handling disconnection request: " + request); Identifier disconnectedClientId = request.getId(); synchronized (clients) { clients.remove(disconnectedClientId); @@ -239,8 +239,8 @@ addEventProcessor(new EventTypeProcessor<QuizCompletedEvent>(QuizCompletedEvent.class) { @Override public void handle(QuizCompletedEvent event) { - getLogger().info("Quiz Completed Event:"+event.getId()+" : instruction Number"+event.getInstructionNumber()); numberOfCompletedQuizzes++; + getLogger().info("Completed quizzes: " + numberOfCompletedQuizzes); if(numberOfCompletedQuizzes == clients.size()*8){ getLogger().info("Everyone has finished reading the general instructions successfully"); } @@ -392,9 +392,11 @@ // need to send instructions //Send the end round event to the facilitator //Send the end round event to all the clients - for (ClientData data : clients.values()) { - data.award(); - transmit(new EndRoundEvent(data.getId(), data.getGroupDataModel(), getConfiguration().isLastRound())); + synchronized (clients) { + for (ClientData data : clients.values()) { + data.award(); + transmit(new EndRoundEvent(data.getId(), data.getGroupDataModel(), getConfiguration().isLastRound())); + } } transmit(new FacilitatorEndRoundEvent(facilitatorId, serverDataModel)); @@ -406,13 +408,15 @@ private void cleanupRound() { // reset client data values - for (ClientData clientData: clients.values()) { - if (getConfiguration().getCurrentParameters().isPracticeRound()) { - clientData.resetAllTokens(); + synchronized (clients) { + for (ClientData clientData: clients.values()) { + if (getConfiguration().getCurrentParameters().isPracticeRound()) { + clientData.resetAllTokens(); + } + else { + clientData.reset(); + } } - else { - clientData.reset(); - } } submittedClients = 0; persister.clear(); @@ -425,19 +429,21 @@ RoundConfiguration nextRoundConfiguration = getConfiguration().nextRound(); serverDataModel.setRoundConfiguration(nextRoundConfiguration); // set up the next round - if (nextRoundConfiguration.shouldRandomizeGroup()) { - serverDataModel.clear(); - List<ClientData> clientDataList = new ArrayList<ClientData>(clients.values()); - // randomize the client data list - Collections.shuffle(clientDataList); - // re-add each the clients to the server data model - for (ClientData data: clientDataList) { - serverDataModel.addClient(data); + synchronized (clients) { + if (nextRoundConfiguration.shouldRandomizeGroup()) { + serverDataModel.clear(); + List<ClientData> clientDataList = new ArrayList<ClientData>(clients.values()); + // randomize the client data list + Collections.shuffle(clientDataList); + // re-add each the clients to the server data model + for (ClientData data: clientDataList) { + serverDataModel.addClient(data); + } + } + // send registration events to all participants. + for (ClientData data: clients.values()) { + transmit(new RegistrationEvent(data, nextRoundConfiguration)); } - } - // send registration events to all participants. - for (ClientData data: clients.values()) { - transmit(new RegistrationEvent(data.getId(), nextRoundConfiguration, data)); } // send new round configuration to the facilitator transmit(new RegistrationEvent(facilitatorId, nextRoundConfiguration)); Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml 2009-10-17 22:23:23 UTC (rev 300) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml 2009-10-19 18:58:17 UTC (rev 301) @@ -32,7 +32,7 @@ <entry key="wait-for-participants">true</entry> <entry key="number-of-rounds">22</entry> -<entry key="undisrupted-bandwidth">true</entry> +<entry key="undisrupted-flow-required">true</entry> <entry key="q1">4</entry> <entry key="q2">identity</entry> @@ -41,12 +41,37 @@ <entry key="q5">4</entry> <entry key="q6">5</entry> <entry key="q7">25</entry> -<entry key="q8">4</entry> -<entry key="q9">25</entry> -<entry key="q10">30</entry> -<entry key="q11">1.50</entry> +<entry key="q8">7</entry> +<entry key="q9">19</entry> +<entry key="q10">1.50</entry> +<entry key='final-instructions'> +<![CDATA[ +<p> +The experiment is almost over. We have a brief survey for you to fill out while the +facilitator prepares your payments. When the facilitator has finished preparing +payments and you have all completed your surveys your computer number will be +called. You can then go next door to receive your payment. For privacy reasons we +must pay you one at a time. +</p> +<p> +Thanks for participating! +</p> +]]> +</entry> + +<entry key="initial-instructions"> +<![CDATA[ +<h3>Welcome</h3> +<p> +Please be patient while the experimental environment is set up. +<b>Please do not close this window or open any other windows.</b> +</p> +]]> +</entry> + + <entry key="facilitator-instructions"> <![CDATA[ <h3>Facilitator Instructions</h3> @@ -125,18 +150,27 @@ <entry key="general-instructions2"> <![CDATA[ <h3>Chat</h3> -<p>Each round will start with a chat period of 40 seconds where you can send text -messages to the other participants. You may discuss any aspect of the exercise. -<b>However</b>, you are <b>not allowed</b> to promise the other participants +<p>Before each round you will have a chat period of 40 seconds where you can send +text messages to the other participants. You may discuss any aspect of the exercise +with two important exceptions: +</p> +<ol> +<li>You are <b>not allowed</b> to promise the other participants side-payments or threaten them with any consequence after the experiment is -finished. You are also <b>not allowed</b> to reveal your real identity. We will be -monitoring the chat traffic. If we see any member of a group violating the rules, -we will have to remove that <b>entire group</b> from the experiment room. That -group will have to wait until the entire experiment is finished to receive -their payment.<br><br> - +finished. +</li> +<li>You are <b>not allowed to reveal your real identity</b>.</li> +</ol> +<p> +We will be monitoring the chat traffic. If we detect any violation of these rules, +we will have to remove <b>all members of the group where the violation occurred</b> +from the experiment. That group will have to wait until the entire experiment is +finished to receive their payment. +</p> +<p> You will see a text box appear on your screen when a chat period starts. The amount of time left in the chat period will be shown at the <b>top left of the screen</b>.<br> +</p> ]]> </entry> @@ -160,20 +194,20 @@ <![CDATA[ <h3>Creating Irrigation Infrastructure</h3> <p> -At the beginning of each round you and each other participant will be given 10 -tokens. You must then decide what to do with these tokens. You may decide to invest -in the irrigation infrastructure or to keep the tokens. If you keep the tokens you -will earn at a minimum 10 tokens X 5 cents = $0.50 for each round. If you do this -every round after twenty rounds you will end up with at least $10 (plus any crops -that you may be able to grow as we will discuss later). Your total earnings for -participating in the experiment would then be at least $10 plus your show-up fee of -$5, for a grand total of at least $15. +After the chat period ends you and each other participant will be given 10 tokens. +You must then decide what to do with these tokens. You may decide to invest in the +irrigation infrastructure or to keep the tokens. If you keep the tokens you will +earn at a minimum 10 tokens X 5 cents = $0.50 for each round. If you do this every +round after twenty rounds you will end up with at least $10 (plus any crops that you +may be able to grow as we will discuss later). Your total earnings for +participating in the experiment would then be at least $10 plus your show-up payment +of $5, for a grand total of at least $15. </p> <p> On the other hand, if you invest some of your tokens in the irrigation infrastructure, you may be able to earn more than this amount by growing crops. If -the irrigation infrastructure is operating at near maximum capacity you can grow a -large crop and earn $1.50 each round. If you grow crops you can roughly triple your +the irrigation infrastructure is operating at near maximum capacity you can earn +close to $1.50 each round. Thus if you grow crops you can roughly triple your earnings compared to doing nothing. The actual earnings depend on the decisions you and the other participants in your group make in terms of investment and when to grow crops. @@ -238,7 +272,7 @@ <th>Water delivery (cubic feet per second)</th> </thead> <tr> -<td> ≤ 45</td><td>0</td> +<td>≤ 45</td><td>0</td> </tr> <tr> <td>46-51</td><td>5</td> @@ -350,9 +384,12 @@ <entry key="general-instructions5"> <![CDATA[ <h3>Positions A,B,C,D and E</h3> -<p> The animation above illustrates how water flows to each player when their gates are opened and closed. When a player opens -their gate, the black line will rotate to a vertical position, allowing water (represented by white balls) to flow to them. -Note that the available bandwidth downstream of a player with an open port is reduced (illustrated by narrowing of the canal). +<p> +The animation above illustrates how water flows to each player when their gates are +opened and closed. When a player opens their gate, the black line will rotate to a +vertical position, allowing water (represented by white dots) to flow to them. Note +that the water available downstream of a player with an open port is reduced, +illustrated by a narrowing of the canal. </p> <p> Access to water depends on your position as shown in the window. Water originates @@ -361,24 +398,21 @@ participant A is then available to be used by participant B. Water not used by participants A and B is then available for C. Water not used by participants A, B and C is available for D. Finally, water not used by participants A, B, C and D is -available for E. You can only start growing a crop if you have water available to -your position. If water runs out during the growing period of the crop, the partial -grown crop is lost, and you need to start from scratch again. Water can run out if, -for example, one or more people upstream from your position open their gates. <b>You -can only grow a crop successfully when you have access to water for a number of -seconds without disruptions.</b> +available for E. </p> <p> -Assume that the total irrigation capacity available is 40 cfps. If player A opens -their gate, they will take 25 cfps from the canal, leaving 15 cfps for B and -everyone else downstream. If A does not open the gate however, then a total of 40 -cfps is left for B and everyone else downstream. +You can only get water to your field if you have water available to your position. +Suppose that the total irrigation capacity available is 40 cfps and 40 cfps of water +is available. If player A opens their gate they will consume 25 cfps of water and 15 +cfps is left for B. Suppose on the other hand, A does not open the gate, then a +total of 40 cfps is left for B, allowing B to extract water at the maximum rate of +25 cfps. </p> <p> -As another example, suppose that the canal system has been allowed to deteriorate so -that the total irrigation capacity available is 20 cfps. While player A's gate is -open, no water is available for B. If A is NOT using water, 20 cfps is available -for B. +As another example, suppose that the canal system has been allowed to deteriorate +so that the total irrigation capacity available is 20 cfps. While player A’s gate is +open, no water is available for B. If A is NOT using water, 20 cfps is available for +B. </p> ]]> </entry> @@ -388,14 +422,23 @@ <br><br> To continue to the next page, please answer the following question:<br> <form> -What is the minimum time to deliver 500 cubic feet to your field when your maximum -water flow capacity is available? +Suppose the irrigation efficiency is between 71 and 80% so that the canal flow +capacity is 30 cfps. If A opens their gate and diverts water at 25 cfps what is the +available water flow for B? <br> -<input type="radio" name="q6" value="12.5">12.5 seconds<br> -<input type="radio" name="q6" value="20">20 seconds<br> -<input type="radio" name="q6" value="25">25 seconds<br> -<input type="radio" name="q6" value="50">50 seconds<br> +<input type="radio" name="q6" value="30">30 cfps<br> +<input type="radio" name="q6" value="25">25 cfps<br> +<input type="radio" name="q6" value="15">15 cfps<br> +<input type="radio" name="q6" value="5">5 cfps<br> <br><br> +If the canal flow capacity available is 25 cfps and A,B,C and D are not using water, +what is the available water for E? +<br> +<input type="radio" name="q7" value="40">40 cfps<br> +<input type="radio" name="q7" value="25">25 cfps<br> +<input type="radio" name="q7" value="15">15 cfps<br> +<input type="radio" name="q7" value="0">0 cfps<br> + <input type="submit" name="submit" value="Submit"> <br><br> </form> @@ -405,21 +448,88 @@ <entry key="general-instructions6"> <![CDATA[ <h3>How to grow crops</h3> -<p>To start growing crops, click on one of the boxes labeled "Grow this crop".<br> <p> -<img src = "http://sod19.asu.edu/irrigation/images/fileScreenShotNew.JPG"><br> +To start growing crops, click on the yellow button labeled "open gate". +This will open your irrigation gate and allow water to flow to your field if it is +available. The text on the button will change to "close gate" - if +you would like to close the gate and stop extracting water from the canal, just +click on the yellow button again. Your gate will close and the text on the button +will change back to "open gate". </p> -The crop receiving water will turn red. When the crop is successfully grown and -harvested it the box will turn green. If water becomes unavailable for a period of -5 seconds after starting to grow a crop, the crop will be lost and you will have to -click the button again to re-irrigate that crop. -<br> -The percentage of the water needed for the crop at any point in time is indicated by the progress bar <br> -<img src = "http://sod19.asu.edu/irrigation/images/fileProgressBarScreenShot.JPG"><br> <p> -You cannot grow multiple crops at the same time. -<img src = "http://sod19.asu.edu/irrigation/images/pauseButtonScreenShot.JPG"><br> +The amount of water units (cubic feet) your field has received is shown on the +screen, as well as the resulting amount of tokens earned from growing a crop. +The number of tokens earned in each round depends on how much water you have +diverted to your field. If you receive less than 150 cubic feet (cf) the crop has +not received enough water to grow a crop and you will thus not receive any tokens. +The maximum earnings are received when between 500 cf and 549 cf are diverted to +your field. If more than 549 cf water is diverted to your field, this will +negatively affect the growth of the crop (i.e. overwatering) and less tokens will be +earned. In the table below you can see the amount of tokens earned for amount of +water applied to your field. </p> +<b>Table 2</b>: Earnings resulting from the amount of water applied to your field. + +<table border="1" cellspacing="2" cellpadding="2"> +<thead> +<th>Water units received (cubic feet)</th> +<th>Tokens earned</th> +</thead> +<tr> +<td>< 150</td><td>0</td> +</tr> +<tr> +<td>150-199</td><td>1</td> +</tr> +<tr> +<td>200-249</td><td>4</td> +</tr> +<tr> +<td>250-299</td><td>10</td> +</tr> +<tr> +<td>300-349</td><td>15</td> +</tr> +<tr> +<td>350-399</td><td>18</td> +</tr> +<tr> +<td>400-499</td><td>19</td> +</tr> +<tr> +<td>500-549</td><td>20</td> +</tr> +<tr> +<td>550-649</td><td>19</td> +</tr> +<tr> +<td>650-699</td><td>18</td> +</tr> +<tr> +<td>700-749</td><td>15</td> +</tr> +<tr> +<td>750-799</td><td>10</td> +</tr> +<tr> +<td>800-849</td><td>4</td> +</tr> +<tr> +<td>850-899</td><td>1</td> +</tr> +<tr> +<td>> 899</td><td>0</td> +</tr> +</table> + +Your earnings at the end of the round depend on your investment and the number of +tokens received for the crop. For example, suppose you invest 6 out of the 10 +tokens you are endowed with at the start of the round and you receive 333 cubic feet +of water. Your total earnings will be the amount of tokens leftover from your +initial endowment (10 - 6) plus the tokens you earned from your crop (15 tokens for +333 cubic feet of water, see Table 2). The total number of tokens earned is 19 +($0.85 since each token is $0.05). + ]]> </entry> @@ -428,12 +538,20 @@ <br><br> To continue to the next page, please answer the following question:<br> <form> -If there are 4 green boxes and one red box, how many crops have you grown and harvested successfully?<br> -<input type="radio" name="q8" value="1">1<br> +If you invest 7 of the 10 tokens you started with, and you put 202 cf of water on +your field, what is the total number of tokens you will have earned for that round? +<input type="radio" name="q8" value="3">3<br> <input type="radio" name="q8" value="4">4<br> -<input type="radio" name="q8" value="5">5<br> -<input type="radio" name="q8" value="10">10<br> +<input type="radio" name="q8" value="7">7<br> +<input type="radio" name="q8" value="13">13<br> <br><br> +If you invest all 10 tokens you start with, and you put 555 cf of water on your +field, what is the total number of tokens your will have earned for that round? +<input type="radio" name="q9" value="10">10<br> +<input type="radio" name="q9" value="19">19<br> +<input type="radio" name="q9" value="20">20<br> +<input type="radio" name="q9" value="29">29<br> +<br><br> <input type="submit" name="submit" value="Submit"> </form> ]]> @@ -441,44 +559,20 @@ <entry key="general-instructions7"> <![CDATA[ -<h3>Earnings</h3> -<p>The number of tokens earned in each round depends on how many crops have been grown and harvested in that round. -The earnings reflect the net profit of growing crops, taking into account the costs -of fertilization, labor, and equipment. The first few crops you grow don't generate -any net profit in terms of tokens earned because your costs must be covered first. -You must have grown at last two crops before you cover your fixed costs and begin to -generate tokens as shown in the following graph. -</p> +<h3>Scores</h3> +<p> +The total number of tokens collected during a round is shown on the screen with the +message: +<br><br> +Total tokens earned this round: 0 +<br><br> +This the total of tokens not invested in irrigation structure plus additional +tokens earned by growing a crop. <br> -<img src = "http://sod19.asu.edu/irrigation/images/fileTokenGraphScreenShot.JPG"><br> -<p> -The amount of tokens earned by growing crops files can also be represented as the following table. -</p> -<table border="1" cellspacing="2" cellpadding="2"> -<tr> - <td>Number of crops grown</td> - <td>0</td> - <td>1</td> - <td>2</td> - <td>3</td> - <td>4</td> - <td>5</td> -</tr> -<tr> - <td>Tokens earned</td> - <td>0</td> - <td>0</td> - <td>6</td> - <td>22</td> - <td>28</td> - <td>30</td> -</tr> -</table> -Your earnings at the end of the round depend on your investment and the number of crops grown. -Recall that you get 10 tokens to start with. Suppose you invest 6 tokens in the irrigation -infrastructure and you grow 4 crops. You would have earned 28 tokens from your -crops, added to your leftover tokens, i.e., 28 + (10-6) = 32 tokens. Each token is -worth 5 cents, translating to an actual dollar amount of $1.60.<br> +You will also see the scores of the other participants summarized on the screen. +Finally, you will see the water flow capacity of each player at any given moment, as +illustrated in the figure below. + ]]> </entry> @@ -488,85 +582,50 @@ <br><br> To continue to the next page, please answer the following question:<br> <form> -If you invest 7 tokens out of the 10 tokens you start with, and you grow 3 crops, how many total tokens would you have earned that round? +Each token is worth 5 cents, thus if you collected 30 tokens in a round you earned: <br> -<input type="radio" name="q9" value="3">3<br> -<input type="radio" name="q9" value="7">7<br> -<input type="radio" name="q9" value="22">22<br> -<input type="radio" name="q9" value="25">25<br> +<input type="radio" name="q10" value=".15">$0.15<br> +<input type="radio" name="q10" value=".50">$0.50<br> +<input type="radio" name="q10" value="1.50">$1.50<br> +<input type="radio" name="q10" value="2.50">$2.50<br> <br><br> - -If you invest 10 tokens out of the 10 tokens you start with, and you grow 5 crops, how many total tokens would you have earned that round? -<br> -<input type="radio" name="q10" value="10">10<br> -<input type="radio" name="q10" value="20">20<br> -<input type="radio" name="q10" value="25">25<br> -<input type="radio" name="q10" value="30">30<br> -<br><br> <input type="submit" name="submit" value="Submit"> <br><br> </form> ]]> </entry> -<entry key="general-instructions8"> +<entry key="general-instructionsq9"> <![CDATA[ -<h3>Scores</h3> -<p>The total number of tokens collected during the experiment is shown as:<br> <p> -<img src = "http://sod19.asu.edu/irrigation/images/tokensCollectedScreenShot.JPG"><br> +We will now start with two practice rounds. This practice round will not contribute to your earnings – +it is intended to acquaint you with the functioning of the exercise environment. </p> -This is the total of tokens not invested in irrigation infrastructure plus the -additional tokens you've earned by growing crops<br> -You can see the scores of the other participants summarized on the screen. You can -also see the percentage of each player's water being used at any given moment, -as illustrated in the figure below. <p> -<img src = "http://sod19.asu.edu/irrigation/images/scoreScreenShotNew.JPG"><br> +You will first chat via text with other participants in your group for 40 seconds, +then decide how much you wish to invest in irrigation infrastructure +maintenance. After all investment decisions have been made you will begin the +actual round and make real-time decisions on when to open your gates and irrigate +your fields. </p> -]]> -</entry> - -<entry key="general-instructionsq8"> -<![CDATA[ -<br><br> -To continue to the next page, please answer the following question:<br> -<form> -Each token is worth 5 cents. If you collected 30 tokens in a round you would have earned:<br> -<input type="radio" name="q11" value="0.15">0.15<br> -<input type="radio" name="q11" value="0.50">0.50<br> -<input type="radio" name="q11" value="1.50">1.50<br> -<input type="radio" name="q11" value="2.50">2.50<br> -<br><br> -<input type="submit" name="submit" value="Submit"> -</form> -]]> -</entry> - -<entry key="general-instructionsq9"> -<![CDATA[ -We will now start with two practice rounds. This practice round will not contribute to your earnings – -it is intended to acquaint you with the functioning of the exercise environment.<br><br> - +<p> If you have any questions feel free to raise your hand and to ask your question. <b>Do you have any questions so far?</b> +</p> ]]> </entry> -<entry key="general-instructions-undisruptedBandwidth"> +<entry key="undisrupted-flow-instructions"> <![CDATA[ -<br> -You can only start downloading a file if you have bandwidth available at your position. If the bandwidth connection -is broken during the downloading of a file, the downloaded part of the file is lost, and you need to start from scratch -again to download this file. The bandwidth connection can be broken if, for example, one or more people to the left of -your position starts downloading files, using up the all available bandwidth. Only when you have continuous access to -bandwidth without disruptions for a length of time sufficient to download an entire file can you download a file -successfully. +<p> +If the flow of water is disrupted while your gate is open your crop growing progress +will be halted. +</p> ]]> </entry> -<entry key="general-instructions11"> +<entry key="investment-instructions"> <![CDATA[ <h3>Invest tokens in the irrigation infrastructure</h3> <p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2009-10-22 08:06:44
|
Revision: 319 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=319&view=rev Author: alllee Date: 2009-10-22 08:06:27 +0000 (Thu, 22 Oct 2009) Log Message: ----------- - updated configuration for first pretest, 10 actual rounds, 3 normal constant decline 25% and 5 fluctuating between 10 and 85%. - made GroupDataModel hold its own copy of the RoundConfiguration instead of delegating to its transient ServerDataModel which causes NPEs when invoked on the client side. Modified Paths: -------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/ServerDataModel.java irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round0.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round1.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round10.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round11.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round2.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round6.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round7.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round8.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round9.xml Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java 2009-10-22 07:02:10 UTC (rev 318) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java 2009-10-22 08:06:27 UTC (rev 319) @@ -599,6 +599,15 @@ } else { instructionsBuilder.append(roundConfiguration.getInstructions()); + instructionsBuilder.append("<hr/>"); + int irrigationCapacity = clientDataModel.getGroupDataModel().getFlowCapacity(); + int clientCapacity = roundConfiguration.getMaximumClientFlowCapacity(); + + instructionsBuilder.append( + String.format("<p><b>The irrigation capacity is %d and the maximum available water to you is %d cfps.</b></p>", + irrigationCapacity, + Math.min(irrigationCapacity, clientCapacity) + )); setInstructions(instructionsBuilder.toString()); } addCenterComponent(getInstructionsPanel()); Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java 2009-10-22 07:02:10 UTC (rev 318) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java 2009-10-22 08:06:27 UTC (rev 319) @@ -101,7 +101,7 @@ } public boolean shouldResetInfrastructureEfficiency() { - return getBooleanProperty("reset-infrastructure-efficiency", false); + return isPracticeRound() || getBooleanProperty("reset-infrastructure-efficiency", false); } public String getInstructions() { Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java 2009-10-22 07:02:10 UTC (rev 318) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java 2009-10-22 08:06:27 UTC (rev 319) @@ -6,7 +6,6 @@ import java.util.Set; import java.util.logging.Logger; -import edu.asu.commons.event.EventChannel; import edu.asu.commons.experiment.DataModel; import edu.asu.commons.irrigation.conf.RoundConfiguration; import edu.asu.commons.net.Identifier; @@ -28,8 +27,11 @@ private transient ServerDataModel serverDataModel; - private transient Logger logger = Logger.getLogger(GroupDataModel.class.getName()); + private RoundConfiguration roundConfiguration; + + private transient Logger logger = Logger.getLogger(GroupDataModel.class.getName()); + private int currentlyAvailableFlowCapacity = 0; private int maximumAvailableFlowCapacity = 0; @@ -41,6 +43,7 @@ public GroupDataModel(ServerDataModel serverDataModel) { this.serverDataModel = serverDataModel; + setRoundConfiguration(serverDataModel.getRoundConfiguration()); } public ClientData getClientData(Identifier id) { @@ -80,27 +83,27 @@ } public boolean isFull() { - return clients.size() == serverDataModel.getRoundConfiguration().getClientsPerGroup(); + return clients.size() == getRoundConfiguration().getClientsPerGroup(); } public void clear() { clients.clear(); } - public void setServerDataModel(ServerDataModel state) { - this.serverDataModel = state; + public void setServerDataModel(ServerDataModel serverDataModel) { + this.serverDataModel = serverDataModel; } public Map<Identifier, ClientData> getClientDataMap() { return Collections.unmodifiableMap(clients); } - public int getAvailableClientFlowCapacity(){ + public int getAvailableClientFlowCapacity() { return Math.min(currentlyAvailableFlowCapacity, getRoundConfiguration().getMaximumClientFlowCapacity()); } public RoundConfiguration getRoundConfiguration() { - return serverDataModel.getRoundConfiguration(); + return roundConfiguration; } public int getTotalContributedTokens() { @@ -213,10 +216,6 @@ public int getMaximumAvailableFlowCapacity() { return maximumAvailableFlowCapacity; } - - public EventChannel getEventChannel() { - return serverDataModel.getEventChannel(); - } public int getInfrastructureEfficiency() { return infrastructureEfficiency; @@ -232,6 +231,11 @@ } return logger; } + + + public void setRoundConfiguration(RoundConfiguration roundConfiguration) { + this.roundConfiguration = roundConfiguration; + } } Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/ServerDataModel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/ServerDataModel.java 2009-10-22 07:02:10 UTC (rev 318) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/ServerDataModel.java 2009-10-22 08:06:27 UTC (rev 319) @@ -36,6 +36,9 @@ public void setRoundConfiguration(RoundConfiguration roundConfiguration) { this.roundConfiguration = roundConfiguration; + for (GroupDataModel group: clientsToGroups.values()) { + group.setRoundConfiguration(roundConfiguration); + } } public synchronized void addClient(ClientData clientData) { Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml 2009-10-22 07:02:10 UTC (rev 318) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml 2009-10-22 08:06:27 UTC (rev 319) @@ -30,7 +30,7 @@ <entry key="wait-for-participants">true</entry> -<entry key="number-of-rounds">22</entry> +<entry key="number-of-rounds">12</entry> <entry key="undisrupted-flow-required">true</entry> @@ -689,15 +689,16 @@ <![CDATA[ <h3>Invest tokens in the irrigation infrastructure</h3> <p> -You have 10 tokens to invest. You must make a decision about how much you wish to -invest [0,10] in the irrigation infrastructure. As a reminder we have included the -table relating irrigation infrastructure and the total available flow capacity in -the figure below. After you have entered the number of tokens you'd like to invest, -hit the enter key or click the submit button to confirm your investment. When -everybody has made their decision, the total investment will be calculated and the -overall irrigation infrastructure will be displayed. Each token you invest -corresponds to one percent of infrastructure efficiency, so if you invest 10 tokens -you are contributing 10% to the overall infrastructure efficiency. +You have been endowed with 10 tokens to invest. You must make a decision about +how much you wish to invest [0,10] in the irrigation infrastructure. You can +see the relationship between total investment and irrigation infrastructure in +the table below. After you have entered the number of tokens you'd like to +invest, hit the enter key or click the submit button to confirm your +investment. When everybody has made their decision, the total investment will +be calculated and the overall irrigation infrastructure will be displayed. +Each token you invest corresponds to one percent of infrastructure efficiency, +so if you invest 10 tokens you are contributing 10% to the overall +infrastructure efficiency. </p> <table border="1" cellspacing="2" cellpadding="2"> <thead> Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round0.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round0.xml 2009-10-22 07:02:10 UTC (rev 318) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round0.xml 2009-10-22 08:06:27 UTC (rev 319) @@ -4,9 +4,7 @@ <comment>Irrigation experiment round configuration</comment> <entry key='max-canal-flow-capacity'>40</entry> <entry key='max-client-flow-capacity'>25</entry> -<entry key="max-total-token-contribution">50</entry> <entry key="practice-round">true</entry> -<entry key="clients-per-group">5</entry> <entry key="instructions"> <![CDATA[ Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round1.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round1.xml 2009-10-22 07:02:10 UTC (rev 318) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round1.xml 2009-10-22 08:06:27 UTC (rev 319) @@ -2,7 +2,6 @@ <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <comment>Irrigation experiment round configuration</comment> -<entry key="max-total-token-contribution">50</entry> <entry key="practice-round">true</entry> <entry key="instructions"> Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round10.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round10.xml 2009-10-22 07:02:10 UTC (rev 318) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round10.xml 2009-10-22 08:06:27 UTC (rev 319) @@ -2,16 +2,15 @@ <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <comment>Irrigation experiment round configuration</comment> -<entry key="max-total-token-contribution">50</entry> -<entry key="practice-round">false</entry> -<entry key="clients-per-group">5</entry> +<entry key='infrastructure-degradation-factor'>10</entry> + <entry key="instructions"> <![CDATA[ <h3>Round 9 Instructions</h3> <p> -This round is the same as the previous round, but the infrastructure irrigation has -been decreased by 25%. +This round is the same as the previous round, but the irrigation +infrastructure efficiency has declined by 10%. </p> ]]> </entry> Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round11.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round11.xml 2009-10-22 07:02:10 UTC (rev 318) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round11.xml 2009-10-22 08:06:27 UTC (rev 319) @@ -2,14 +2,15 @@ <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <comment>Irrigation experiment round configuration</comment> -<entry key="max-total-token-contribution">50</entry> +<entry key='infrastructure-degradation-factor'>85</entry> + <entry key="instructions"> <![CDATA[ <h3>Round 10 Instructions</h3> <p> -This round is the same as the previous round, but the infrastructure irrigation has -been decreased by 25%. +This round is the same as the previous round, but the infrastructure +irrigation efficiency has experienced a severe decline of 85%. </p> ]]> Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round2.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round2.xml 2009-10-22 07:02:10 UTC (rev 318) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round2.xml 2009-10-22 08:06:27 UTC (rev 319) @@ -9,12 +9,12 @@ <![CDATA[ <h3>Round 1 Instructions</h3> <p> -This is the first round of twenty. Before this round begins you will have the -opportunity to text chat with the other participant for forty seconds, then -decide on your level of investment in the irrigation infrastructure. After -the total irrigation infrastructure investment has been determined you will -begin the experiment and make decisions on when to open your irrigation gates -and grow crops. +This is the first actual round of the experiment. Before this round begins +you will have the opportunity to text chat with the other participant for +forty seconds, then decide on your level of investment in the irrigation +infrastructure. After the total irrigation infrastructure investment has been +determined you will begin the experiment and make decisions on when to open +your irrigation gates and grow crops. </p> ]]> </entry> Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round6.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round6.xml 2009-10-22 07:02:10 UTC (rev 318) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round6.xml 2009-10-22 08:06:27 UTC (rev 319) @@ -3,14 +3,28 @@ <properties> <comment>Irrigation experiment round configuration</comment> +<entry key='infrastructure-degradation-factor'>10</entry> + <entry key="instructions"> <![CDATA[ <h3>Round 5 Instructions</h3> <p> -This round is the same as the previous round, but the infrastructure irrigation has -been decreased by 25%. +In the past rounds the infrastructure efficiency declined from one round to +the next at a constant amount of 25%. In the following rounds the <b>average +decline</b> of the infrastructure efficiency will remain the same, but the +<b>actual amount</b> of decline can vary from round to round. This means that +in some rounds the decline will be larger than 25% and some rounds the decline +will be smaller than 25%. Before each round begins you will continue to make a +decision on how much to invest in the irrigation infrastructure. After all of +your investment contributions have been submitted the resulting level of +infrastructure efficiency will be displayed and then the round will begin. If +you have any questions, please ask them now. </p> +<p> +In this round, the infrastructure has declined by 10%. +</p> + ]]> </entry> </properties> Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round7.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round7.xml 2009-10-22 07:02:10 UTC (rev 318) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round7.xml 2009-10-22 08:06:27 UTC (rev 319) @@ -3,14 +3,14 @@ <properties> <comment>Irrigation experiment round configuration</comment> -<entry key="max-total-token-contribution">50</entry> +<entry key='infrastructure-degradation-factor'>85</entry> <entry key="instructions"> <![CDATA[ <h3>Round 6 Instructions</h3> <p> -This round is the same as the previous round, but the infrastructure irrigation has -been decreased by 25%. +This round is the same as the previous round, but the irrigation +infrastructure efficiency has experienced a severe decline of 85%. </p> ]]> Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round8.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round8.xml 2009-10-22 07:02:10 UTC (rev 318) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round8.xml 2009-10-22 08:06:27 UTC (rev 319) @@ -2,15 +2,15 @@ <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <comment>Irrigation experiment round configuration</comment> -<entry key="max-total-token-contribution">50</entry> -<entry key="clients-per-group">5</entry> +<entry key='infrastructure-degradation-factor'>30</entry> + <entry key="instructions"> <![CDATA[ <h3>Round 7 Instructions</h3> <p> -This round is the same as the previous round, but the infrastructure irrigation has -been decreased by 25%. +This round is the same as the previous round, but the irrigation +infrastructure efficiency has declined by 30%. </p> ]]> </entry> Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round9.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round9.xml 2009-10-22 07:02:10 UTC (rev 318) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round9.xml 2009-10-22 08:06:27 UTC (rev 319) @@ -2,15 +2,15 @@ <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <comment>Irrigation experiment round configuration</comment> -<entry key="max-total-token-contribution">50</entry> -<entry key="clients-per-group">5</entry> +<entry key='infrastructure-degradation-factor'>10</entry> + <entry key="instructions"> <![CDATA[ <h3>Round 8 Instructions</h3> <p> -This round is the same as the previous round, but the infrastructure irrigation has -been decreased by 25%. +This round is the same as the previous round, but the irrigation +infrastructure efficiency has declined by 10%. </p> ]]> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2009-10-22 17:08:22
|
Revision: 321 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=321&view=rev Author: alllee Date: 2009-10-22 17:08:13 +0000 (Thu, 22 Oct 2009) Log Message: ----------- updating progress bar color for windows boxes (need to find a cross platform way to do this for both) and updated general instructions Modified Paths: -------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalAnimationPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalAnimationPanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalAnimationPanel.java 2009-10-22 08:20:12 UTC (rev 320) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalAnimationPanel.java 2009-10-22 17:08:13 UTC (rev 321) @@ -67,7 +67,7 @@ private void initialize() { this.setPreferredSize(new Dimension(1098,150)); this.setLayout(new GridBagLayout()); - this.setBackground(Color.white); + this.setBackground(Color.WHITE); //initializing the constructor for Gates for(int i=0;i<6;i++){ gate[i] = new Gate(totalContributedBandwidth,i); @@ -113,8 +113,8 @@ protected void paintComponent(Graphics graphics){ + super.paintComponent(graphics); // needed! updateGUI(); - super.paintComponent(graphics); // needed! Graphics2D graphics2D = (Graphics2D)graphics; graphics2D.setColor(Color.BLUE); graphics2D.fillRect(0,0,100,100); Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java 2009-10-22 08:20:12 UTC (rev 320) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java 2009-10-22 17:08:13 UTC (rev 321) @@ -435,8 +435,8 @@ clientData.getMaximumTokenInvestment(), clientData.getInvestedTokens(), clientData.getUninvestedTokens(), + clientData.getTokensEarnedFromWaterCollected(), clientData.getAllTokensEarnedThisRound(), - clientData.getTokensEarnedFromWaterCollected(), clientData.getTotalDollarsEarnedThisRound(), clientData.getTotalDollarsEarned() + showUpBonus )); @@ -604,7 +604,7 @@ int clientCapacity = roundConfiguration.getMaximumClientFlowCapacity(); instructionsBuilder.append( - String.format("<p><b>The irrigation capacity is %d and the maximum available water to you is %d cfps.</b></p>", + String.format("<p><b>The irrigation capacity is %d cfps and the maximum amount of water you can collect per second is %d cfps.</b></p>", irrigationCapacity, Math.min(irrigationCapacity, clientCapacity) )); Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java 2009-10-22 08:20:12 UTC (rev 320) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java 2009-10-22 17:08:13 UTC (rev 321) @@ -402,11 +402,15 @@ return waterCollectedToTokensScrollPane; } - private Color getProgressBarColor(int timeLeft) { + private void setProgressBarColor(int timeLeft) { if (timeLeft < 10) { - return Color.RED; +// timeLeftProgressBar.setForeground( Color.RED ); + timeLeftProgressBar.setBackground( Color.RED ); +// return Color.RED; } - return Color.BLACK; + else { + timeLeftProgressBar.setBackground( Color.GREEN ); + } } /** * Should be invoked every second throughout the experiment, from a ClientUpdateEvent sent by the server. @@ -418,7 +422,7 @@ String timeLeftString = String.format("%d sec", timeLeft); timeLeftProgressBar.setValue( timeLeft ); timeLeftProgressBar.setString(timeLeftString); - timeLeftProgressBar.setForeground( getProgressBarColor(timeLeft) ); + setProgressBarColor(timeLeft); for (final ClientData clientData : clientDataModel.getClientDataMap().values()) { if (clientData.isGateOpen()) { canalPanel.openGate(clientData.getPriority()); Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml 2009-10-22 08:20:12 UTC (rev 320) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml 2009-10-22 17:08:13 UTC (rev 321) @@ -332,36 +332,33 @@ <entry key="general-instructions4"> <![CDATA[ <h3>Growing crops</h3> -<p>There are FIVE participants in each group, each of which is randomly assigned to -one of the five positions, A, B, C, D or E. Below is a schematic representing the -irrigation system. Water comes from the box to the left and the five players -are located from upstream (leftmost) to downstream (rightmost) accordingly. To -illustrate the game, assume you are in position B. The black lines represent "gates" -that you control (i.e, open and close). -<p> -<img src="http://dev.commons.asu.edu/irrigation/images/irrigation-example-screenshot.jpg"><br><br> +<p>There are <b>five</b> participants in each group, each of which is randomly assigned to +one of the five positions, A, B, C, D or E. Below is a screenshot of the +graphical interface representation of the irrigation system. Water comes from +the box to the left and the five players are located from upstream (leftmost) +to downstream (rightmost) accordingly. To illustrate, assume you are in +position C. The black lines represent "gates" that you open and close by +clicking on the large button on the lower left corner of the screen. +Each round consists of 50 seconds and the amount of time left in the +experiment is indicated by a bar at the top of the screen. </p> -Each round will take 50 seconds and the amount of time left in the experiment -is indicated at the top of the screen. +<img src="http://dev.commons.asu.edu/irrigation/images/game-interface-screenshot.jpg"> +<br><br> <p> -<img src = "http://dev.commons.asu.edu/irrigation/images/time-remaining-screenshot.jpg"><br> +You can irrigate your field during the round by opening your gate. Your +earnings depend on the amount of water you can draw onto your fields and will +be explained in more detail on the next page. The speed at which you can grow +a crop depends on the amount of water available to you <b>at the time that you +open your gate</b>. The maximum flow capacity of the main canal shared by A, +B, C, D, and E is forty cubic feet per second. </p> <p> -During this round you can irrigate your field. Your earnings depend on the amount -of water you can draw onto your fields and will be explained in more detail in the -next screen. The speed at which you can grow a crop depends on the amount of water -available to you <b>at the time that you open your gate</b>. The maximum flow -capacity of the main canal shared by A, B, C, D, and E is forty cubic feet per second. +The maximum amount of water that can flow through your gate when it is opened +is 25 cubic feet per second. If other people are using the canal, the water +flow available to you might be less, and it may take longer to get water to +your field since you are also limited by the amount of water that is flowing +through the shared canal. </p> -<p> -The maximum capacity that can flow through your gate when it is opened is -twenty-five cubic feet per second. If other people are using the canal, the water -flow available to you might be less, and it may take longer to get water to your -field (you are limited by the flow capacity of the shared canal). -</p> -<p> -The water flow capacity available for your field is shown as a number. -</p> ]]> </entry> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2009-10-23 00:28:06
|
Revision: 327 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=327&view=rev Author: alllee Date: 2009-10-23 00:27:56 +0000 (Fri, 23 Oct 2009) Log Message: ----------- interface improvements, getting rid of timer, not creating new canal panels every time. Modified Paths: -------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalAnimationPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalAnimationPanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalAnimationPanel.java 2009-10-22 20:12:59 UTC (rev 326) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalAnimationPanel.java 2009-10-23 00:27:56 UTC (rev 327) @@ -245,6 +245,13 @@ repaint(); } } + + public void stopTimer() { + if (timer != null) { + timer.stop(); + timer = null; + } + } /* * This will process the balls according to their position Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java 2009-10-22 20:12:59 UTC (rev 326) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java 2009-10-23 00:27:56 UTC (rev 327) @@ -40,7 +40,7 @@ private Random generator = new Random(); - private boolean enableBallAnimation = true; + private final static boolean enableBallAnimation = true; private int maximumIrrigationCapacity; @@ -61,10 +61,17 @@ public CanalPanel(ClientDataModel clientDataModel) { super(); //when totalContributed bandwidth = 1.0, you dont see the canal line - this.maximumIrrigationCapacity = clientDataModel.getGroupDataModel().getMaximumAvailableFlowCapacity(); - this.clientDataModel = clientDataModel; - initialize(); + setClientDataModel(clientDataModel); } + + public void setClientDataModel(ClientDataModel clientDataModel) { + if (timer != null) { + timer.stop(); + } + this.maximumIrrigationCapacity = clientDataModel.getGroupDataModel().getMaximumAvailableFlowCapacity(); + this.clientDataModel = clientDataModel; + initialize(); + } /** * @@ -112,25 +119,23 @@ graphics2D.fillRect(gate[5].getX(), gate[5].getY(),10,gate[5].getHeight()); //////////////////////Animation Logic//////////////////////////// - if (enableBallAnimation) { - graphics.setColor(Color.white); - // int ballCounter = 0; - for(int i=0;i<BALLCOUNT;i++){ - if((balls[i].getPosition() == 1)||(balls[i].getPosition() == 2) || (balls[i].getPosition()==3) - || (balls[i].getPosition() == 4) || (balls[i].getPosition() == 5)){ - if(!((!gate[balls[i].getPosition()-1].isOpenGate())&& balls[i].getY() >= (gate[balls[i].getPosition()-1].getY()+gate[balls[i].getPosition()-1].getHeight()))) - graphics.fillOval(balls[i].x,balls[i].y,balls[i].getBallSize(), balls[i].getBallSize()); - } - else{ - if(balls[i].getPosition() != 0){ - if(gate[balls[i].getPosition() - 6].getHeight() != 0) - graphics.fillOval(balls[i].x,balls[i].y,balls[i].getBallSize(), balls[i].getBallSize()); - } - else{ - graphics.fillOval(balls[i].x,balls[i].y,balls[i].getBallSize(), balls[i].getBallSize()); - } - } - } + graphics.setColor(Color.white); + // int ballCounter = 0; + for(int i=0;i<BALLCOUNT;i++){ + if((balls[i].getPosition() == 1)||(balls[i].getPosition() == 2) || (balls[i].getPosition()==3) + || (balls[i].getPosition() == 4) || (balls[i].getPosition() == 5)){ + if(!((!gate[balls[i].getPosition()-1].isOpenGate())&& balls[i].getY() >= (gate[balls[i].getPosition()-1].getY()+gate[balls[i].getPosition()-1].getHeight()))) + graphics.fillOval(balls[i].x,balls[i].y,balls[i].getBallSize(), balls[i].getBallSize()); + } + else{ + if(balls[i].getPosition() != 0){ + if(gate[balls[i].getPosition() - 6].getHeight() != 0) + graphics.fillOval(balls[i].x,balls[i].y,balls[i].getBallSize(), balls[i].getBallSize()); + } + else{ + graphics.fillOval(balls[i].x,balls[i].y,balls[i].getBallSize(), balls[i].getBallSize()); + } + } } } @@ -412,7 +417,10 @@ } public void endRound() { - initializeBalls(); + if (timer != null) { + timer.stop(); + } + timer = null; closeAllGates(); } Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java 2009-10-22 20:12:59 UTC (rev 326) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java 2009-10-23 00:27:56 UTC (rev 327) @@ -1,9 +1,7 @@ package edu.asu.commons.irrigation.client; import java.awt.BorderLayout; -import java.awt.Color; import java.awt.Dimension; -import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; @@ -13,12 +11,12 @@ import java.util.List; import java.util.Map; -import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JEditorPane; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.JProgressBar; import javax.swing.JScrollPane; import javax.swing.JTextField; import javax.swing.JTextPane; @@ -72,6 +70,7 @@ } private class TextEntryPanel extends JPanel { + private JProgressBar timeLeftProgressBar; private JLabel timeLeftLabel; private JTextField chatField; private Identifier targetIdentifier = Identifier.ALL; @@ -94,12 +93,17 @@ } }); JPanel timeLeftPanel = new JPanel(); - timeLeftPanel.setLayout(new BoxLayout(timeLeftPanel, BoxLayout.LINE_AXIS)); - timeLeftLabel = new JLabel("40"); - timeLeftLabel.setFont(new Font("Arial", Font.BOLD, 14)); - timeLeftLabel.setForeground(new Color(0x0000dd)); - timeLeftPanel.add(new JLabel(" Time left: ")); - timeLeftPanel.add(timeLeftLabel); +// timeLeftPanel.setLayout(new BoxLayout(timeLeftPanel, BoxLayout.LINE_AXIS)); + +// timeLeftLabel = new JLabel("40"); +// timeLeftLabel.setFont(new Font("Arial", Font.BOLD, 14)); +// timeLeftLabel.setForeground(new Color(0x0000dd)); +// timeLeftPanel.add(new JLabel(" Time left: ")); +// timeLeftPanel.add(timeLeftLabel); + timeLeftProgressBar = new JProgressBar(0, 60); + timeLeftProgressBar.setStringPainted(true); + timeLeftPanel.setLayout(new BorderLayout()); + timeLeftPanel.add(timeLeftProgressBar, BorderLayout.CENTER); add(timeLeftPanel, BorderLayout.PAGE_START); add(chatField, BorderLayout.CENTER); @@ -118,8 +122,10 @@ chatField.requestFocusInWindow(); } - private void setTimeRemaining(long timeRemaining) { - timeLeftLabel.setText(String.format(" %d s", timeRemaining / 1000L)); + private void setTimeLeft(long timeLeft) { + int timeLeftInSeconds = (int) (timeLeft / 1000L); + timeLeftProgressBar.setValue(timeLeftInSeconds); + timeLeftProgressBar.setString(String.format("%d sec", timeLeftInSeconds)); } } @@ -166,8 +172,8 @@ .addStyle("italic", defaultStyle), true); } - public void setTimeRemaining(long timeRemaining) { - textEntryPanel.setTimeRemaining(timeRemaining); + public void setTimeLeft(long timeLeft) { + textEntryPanel.setTimeLeft(timeLeft); } private String getChatHandle(Identifier identifier) { Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java 2009-10-22 20:12:59 UTC (rev 326) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java 2009-10-23 00:27:56 UTC (rev 327) @@ -40,7 +40,6 @@ * * The root experiment window placed in the client's JFrame. * - * FIXME: refactor this class. * * @author <a href='mailto:All...@as...'>Allen Lee</a> * @version $Rev$ @@ -107,8 +106,6 @@ private int numberOfGeneralInstructionPages; - private JLabel infrastructureEfficiencyLabel = new JLabel("Current infrastructure efficiency: "); - public ExperimentGameWindow(IrrigationClient client) { this.client = client; this.clientDataModel = client.getClientDataModel(); @@ -142,30 +139,14 @@ tokenInstructionsEditorPane = createInstructionsEditorPane(); tokenInstructionsScrollPane = new JScrollPane(tokenInstructionsEditorPane); investTokensPanel.add(tokenInstructionsScrollPane, BorderLayout.CENTER); - tokenInstructionsEditorPane.setText(getServerConfiguration().getInvestmentInstructions()); tokenInstructionsEditorPane.setCaretPosition(0); tokenInstructionsEditorPane.repaint(); investTokensPanel.add(getSubmitTokenPanel(), BorderLayout.SOUTH); - investTokensPanel.add(infrastructureEfficiencyLabel, BorderLayout.NORTH); investTokensPanel.setBackground(Color.WHITE); } return investTokensPanel; } - public void updateInfrastructureEfficiencyLabel() { - GroupDataModel group = clientDataModel.getGroupDataModel(); - RoundConfiguration roundConfiguration = clientDataModel.getRoundConfiguration(); - int infrastructureEfficiency = 0; - if (roundConfiguration.isPracticeRound() || roundConfiguration.isFirstRound()) { - infrastructureEfficiency = roundConfiguration.getInitialInfrastructureEfficiency(); - } - else { - System.err.println("group was not null, efficiency is: " + group.getInfrastructureEfficiency() + " degrading by " + clientDataModel.getRoundConfiguration().getInfrastructureDegradationFactor()); - infrastructureEfficiency = group.getInfrastructureEfficiency() - roundConfiguration.getInfrastructureDegradationFactor(); - } - infrastructureEfficiencyLabel.setText("Current infrastructure efficiency: " + infrastructureEfficiency); - } - private JPanel getSubmitTokenPanel() { if (submitTokenPanel == null) { submitTokenPanel = new JPanel(); @@ -233,6 +214,7 @@ getInstructionsPanel().add(getCanalAnimationPanel(), BorderLayout.PAGE_START); } else { + getInstructionsPanel().remove(getCanalAnimationPanel()); } getInstructionsPanel().revalidate(); @@ -272,7 +254,7 @@ return nextButton; } - private JPanel getCanalAnimationPanel() { + private CanalAnimationPanel getCanalAnimationPanel() { if (canalAnimationPanel == null) { canalAnimationPanel = new CanalAnimationPanel(40); } @@ -337,7 +319,7 @@ else { investedTokensTextField.setText(""); instructionsBuilder.delete(0, instructionsBuilder.length()); - instructionsBuilder.append("\nPlease enter your tokens within the range 0 - 10"); + instructionsBuilder.append("<h3>Please enter your tokens within the range 0 - 10</h3>"); instructionsBuilder.append(getServerConfiguration().getInvestmentInstructions()); tokenInstructionsEditorPane.setText(instructionsBuilder.toString()); } @@ -345,7 +327,7 @@ catch(NumberFormatException e){ investedTokensTextField.setText(""); instructionsBuilder.delete(0, instructionsBuilder.length()); - instructionsBuilder.append("\nYou only have between 0 and 10 to invest. Please choose a number between 0 and 10 and try again."); + instructionsBuilder.append("<h3>You only have between 0 and 10 to invest. Please choose a number between 0 and 10 and try again.</h3>"); instructionsBuilder.append(getServerConfiguration().getInvestmentInstructions()); tokenInstructionsEditorPane.setText(instructionsBuilder.toString()); } @@ -380,6 +362,7 @@ public void startRound(final RoundConfiguration configuration) { Runnable runnable = new Runnable() { public void run() { + getCanalAnimationPanel().stopTimer(); disableInstructions(); addCenterComponent(irrigationGamePanel); irrigationGamePanel.startRound(); @@ -394,7 +377,7 @@ /* * updates the mainIrrigationGameWindow Panel and adds - * instructionsScrollPane with the debreifing information + * instructionsScrollPane with the debriefing information */ public void endRound(final EndRoundEvent event) { irrigationGamePanel.endRound(); @@ -583,8 +566,25 @@ public void updateSubmitTokenScreenDisplay() { Runnable runnable = new Runnable() { public void run() { + GroupDataModel group = clientDataModel.getGroupDataModel(); + RoundConfiguration roundConfiguration = clientDataModel.getRoundConfiguration(); + int infrastructureEfficiency = 0; + if (roundConfiguration.isPracticeRound() || roundConfiguration.isFirstRound()) { + infrastructureEfficiency = roundConfiguration.getInitialInfrastructureEfficiency(); + } + else { + System.err.println("group was not null, efficiency is: " + group.getInfrastructureEfficiency() + " degrading by " + clientDataModel.getRoundConfiguration().getInfrastructureDegradationFactor()); + infrastructureEfficiency = group.getInfrastructureEfficiency() - roundConfiguration.getInfrastructureDegradationFactor(); + } addCenterComponent(getInvestTokensPanel()); - updateInfrastructureEfficiencyLabel(); + StringBuilder builder = new StringBuilder(); + builder.append( + String.format("<h2>The current infrastructure efficiency is %d%%, with an irrigation flow capacity of %d cubic feet per second.</h2>", + infrastructureEfficiency, + group.calculateFlowCapacity(infrastructureEfficiency) + )); + builder.append(getServerConfiguration().getInvestmentInstructions()); + tokenInstructionsEditorPane.setText(builder.toString()); getInvestedTokensTextField().requestFocusInWindow(); } }; @@ -647,18 +647,9 @@ timer = null; } else { - chatPanel.setTimeRemaining(timeRemaining); + chatPanel.setTimeLeft(timeRemaining); } } - - private void sleep() { - long prevTime = System.currentTimeMillis(); - while((System.currentTimeMillis() - prevTime) < 5000) { - - chatPanel.setEnabled(false); - } - - } }); timer.start(); } Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java 2009-10-22 20:12:59 UTC (rev 326) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java 2009-10-23 00:27:56 UTC (rev 327) @@ -8,7 +8,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.BoxLayout; import javax.swing.GroupLayout; import javax.swing.JButton; import javax.swing.JLabel; @@ -46,19 +45,10 @@ private JPanel jPanelDownStreamWindow = null; private JPanel downloadScreenPanel = null; - private ScoreBoxPanel scoreBoxPanel; + private IrrigationClient client; - /** - * This is the default constructor - */ - public IrrigationClient client; + private JProgressBar timeLeftProgressBar; - public Dimension screenSize; - - public JProgressBar timeLeftProgressBar; - - public JProgressBar timeRemainingjProgressBar = null; - private JLabel timeRemainingjLabel = null; private JTextField timeRemainingjText; @@ -73,7 +63,7 @@ private MiddleWindowPanel middleWindowPanel; - private JLabel dashBoardLabel = null; + private JLabel gateSwitchLabel = null; private JLabel scoreBoardLabel = null; @@ -158,10 +148,10 @@ scoreBoardLabel.setBounds(new Rectangle(582,225+100+35,530,20)); scoreBoardLabel.setHorizontalAlignment(SwingConstants.CENTER); scoreBoardLabel.setText("WATER COLLECTED TO TOKENS EARNED TABLE"); - dashBoardLabel = new JLabel(); - dashBoardLabel.setBounds(new Rectangle(13,225+100+35,530,20)); - dashBoardLabel.setHorizontalAlignment(SwingConstants.CENTER); - dashBoardLabel.setText("YOUR DASHBOARD"); + gateSwitchLabel = new JLabel(); + gateSwitchLabel.setBounds(new Rectangle(13,225+100+35,530,20)); + gateSwitchLabel.setHorizontalAlignment(SwingConstants.CENTER); + gateSwitchLabel.setText("DASHBOARD"); totalContributedBandwidthTextjLabel = new JLabel(); totalContributedBandwidthTextjLabel.setBounds(new Rectangle(200, 18, 55, 17)); totalContributedBandwidthTextjLabel.setText(""); @@ -174,14 +164,10 @@ downloadScreenPanel = new JPanel(); downloadScreenPanel.setLayout(null); downloadScreenPanel.setName("downloadScreenPanel"); - downloadScreenPanel.setBackground(Color.white); + downloadScreenPanel.setBackground(Color.WHITE); downloadScreenPanel.add(getCenterPanel(),null); downloadScreenPanel.add(getTimeLeftProgressBar(), null); - // downloadScreenPanel.add(timeRemainingjLabel, null); - // downloadScreenPanel.add(timeRemainingjText,null); - // downloadScreenPanel.add(totalContributedBandwidthjLabel, null); - // downloadScreenPanel.add(totalContributedBandwidthTextjLabel, null); - downloadScreenPanel.add(dashBoardLabel, null); + downloadScreenPanel.add(gateSwitchLabel, null); downloadScreenPanel.add(scoreBoardLabel, null); } return downloadScreenPanel; @@ -209,10 +195,14 @@ return centerPanel; } - private JPanel createCanalPanel(ClientDataModel clientDataModel) { - canalPanel = new CanalPanel(clientDataModel); - canalPanel.setSize(new Dimension(1098, 123)); - + private JPanel getCanalPanel(ClientDataModel clientDataModel) { + if (canalPanel == null) { + canalPanel = new CanalPanel(clientDataModel); + canalPanel.setSize(new Dimension(1098, 123)); + } + else { + canalPanel.setClientDataModel(clientDataModel); + } return canalPanel; } @@ -227,26 +217,27 @@ jPanelUpStreamWindow.setLayout(new BorderLayout()); jPanelUpStreamWindow.setBackground(new Color(186, 226, 237)); jPanelUpStreamWindow.setBounds(new Rectangle(13, 225+100+50, 530, 326)); - jPanelUpStreamWindow.add(getGateSwitchButton(), BorderLayout.CENTER); + jPanelUpStreamWindow.add(getGateSwitchButton(), BorderLayout.NORTH); + jPanelUpStreamWindow.add(getControlPanel(), BorderLayout.CENTER); } return jPanelUpStreamWindow; } - private final static String OPEN_GATE_LABEL = "Click here to open your gate"; - private final static String CLOSE_GATE_LABEL = "Click here to close your gate"; + private final static String OPEN_GATE_LABEL = "OPEN YOUR GATE"; + private final static String CLOSE_GATE_LABEL = "CLOSE YOUR GATE"; private JButton getGateSwitchButton() { if (gateSwitchButton == null) { gateSwitchButton = new JButton(OPEN_GATE_LABEL); gateSwitchButton.setFont(new Font("sansserif", Font.TRUETYPE_FONT, 18)); - // gateSwitchButton.setPreferredSize(new Dimension(100, 100)); gateSwitchButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { open = !open; - gateSwitchButton.setText( open ? CLOSE_GATE_LABEL : OPEN_GATE_LABEL ); if (open) { client.openGate(); + gateSwitchButton.setText(CLOSE_GATE_LABEL); } else { client.closeGate(); + gateSwitchButton.setText(OPEN_GATE_LABEL); } } }); @@ -255,11 +246,6 @@ } private JPanel getControlPanel() { - JPanel panel = new JPanel(); - panel.setPreferredSize(new Dimension(530, 326)); - panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); - panel.add(getGateSwitchButton()); - JPanel bottomInformationPanel = new JPanel(); GroupLayout layout = new GroupLayout(bottomInformationPanel); bottomInformationPanel.setLayout(layout); @@ -294,8 +280,7 @@ .addComponent(getTotalTokensEarnedLabel()).addComponent(getTotalTokensEarnedTextField())); layout.setVerticalGroup(verticalGroup); - panel.add(bottomInformationPanel); - return panel; + return bottomInformationPanel; } private JTextField getWaterCollectedTextField() { @@ -405,11 +390,11 @@ private void setProgressBarColor(int timeLeft) { if (timeLeft < 10) { // timeLeftProgressBar.setForeground( Color.RED ); - timeLeftProgressBar.setBackground( Color.RED ); +// timeLeftProgressBar.setBackground( Color.RED ); // return Color.RED; } else { - timeLeftProgressBar.setBackground( Color.GREEN ); +// timeLeftProgressBar.setBackground( Color.GREEN ); } } /** @@ -422,7 +407,7 @@ String timeLeftString = String.format("%d sec", timeLeft); timeLeftProgressBar.setValue( timeLeft ); timeLeftProgressBar.setString(timeLeftString); - setProgressBarColor(timeLeft); +// setProgressBarColor(timeLeft); for (final ClientData clientData : clientDataModel.getClientDataMap().values()) { if (clientData.isGateOpen()) { canalPanel.openGate(clientData.getPriority()); @@ -555,8 +540,7 @@ * fills in the panels depending on the priority of the client */ public void fillPanels(ClientDataModel clientDataModel) { - // TODO Auto-generated method stub - centerPanel.add(createCanalPanel(clientDataModel)); + centerPanel.add(getCanalPanel(clientDataModel)); //switch(clientGameState.getPriority()){ downloadScreenPanel.add(getJPanelUpStreamWindow(),null); Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml 2009-10-22 20:12:59 UTC (rev 326) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml 2009-10-23 00:27:56 UTC (rev 327) @@ -312,7 +312,7 @@ Given an existing infrastructure efficiency of 20%, if the five participants invest a <b>total of 29 additional tokens</b>, what is the new irrigation infrastructure efficiency? -<br> +(<b>Note: only enter a number, you don't need to add the % sign</b>)<br> <input type="text" name="q3" value = ""> <br><br> @@ -320,7 +320,7 @@ Given an existing infrastructure efficiency of 50%, if <b>two participants invest 10 tokens each</b> while the <b>three other participants invest 2 tokens each</b>, what is the new irrigation infrastructure efficiency? -<br> +(<b>Note: only enter a number, you don't need to add the % sign</b>)<br> <input type="text" name="q4" value = ""> <br><br> <input type="submit" name="submit" value="Submit"><br> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2009-10-23 04:01:15
|
Revision: 328 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=328&view=rev Author: alllee Date: 2009-10-23 04:01:06 +0000 (Fri, 23 Oct 2009) Log Message: ----------- Final updates before sending first version out to Indiana. Modified Paths: -------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round10.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round5.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round6.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round7.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round8.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round9.xml Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java 2009-10-23 00:27:56 UTC (rev 327) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java 2009-10-23 04:01:06 UTC (rev 328) @@ -14,7 +14,6 @@ import javax.swing.JButton; import javax.swing.JEditorPane; import javax.swing.JFrame; -import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.JScrollPane; @@ -60,6 +59,9 @@ private JEditorPane chatInstructionsPane; + private JTextField chatField; + + public ChatPanel() { initGuiComponents(); } @@ -71,8 +73,6 @@ private class TextEntryPanel extends JPanel { private JProgressBar timeLeftProgressBar; - private JLabel timeLeftLabel; - private JTextField chatField; private Identifier targetIdentifier = Identifier.ALL; public TextEntryPanel() { @@ -93,13 +93,6 @@ } }); JPanel timeLeftPanel = new JPanel(); -// timeLeftPanel.setLayout(new BoxLayout(timeLeftPanel, BoxLayout.LINE_AXIS)); - -// timeLeftLabel = new JLabel("40"); -// timeLeftLabel.setFont(new Font("Arial", Font.BOLD, 14)); -// timeLeftLabel.setForeground(new Color(0x0000dd)); -// timeLeftPanel.add(new JLabel(" Time left: ")); -// timeLeftPanel.add(timeLeftLabel); timeLeftProgressBar = new JProgressBar(0, 60); timeLeftProgressBar.setStringPainted(true); timeLeftPanel.setLayout(new BorderLayout()); @@ -132,13 +125,6 @@ private final static String HANDLE_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - private final static String CHAT_INSTRUCTIONS = "<h3>Chat Instructions</h3><p>You now have the opportunity to chat for 40 seconds." + - " You can discuss whatever you want related to the experiment with some restrictions. You may not promise the other participant(s) side " + - "payments or threaten them with any consequence (e.g., physical violence) after the experiment is finished. Also, you may not reveal your real identity." + - "We are monitoring chat traffic - if we notice a violation of the rules we will remove the group from the room until the other groups are finished with the experiment.</p>" + - "<p>You can send messages by typing in the text field at the bottom of the screen and then hit return or click send. " + - "The time left for the discussion is displayed above the text field at the bottom of the screen.</p>"; - private static String[] HANDLES; private Map<Identifier, String> chatHandles = new HashMap<Identifier, String>(); @@ -195,7 +181,6 @@ chatInstructionsPane.setEditorKit(new HTMLEditorKit()); chatInstructionsPane.setEditable(false); JScrollPane chatInstructionsScrollPane = new JScrollPane(chatInstructionsPane); - chatInstructionsPane.setText(CHAT_INSTRUCTIONS); add(chatInstructionsScrollPane, BorderLayout.PAGE_START); add(messageScrollPane, BorderLayout.CENTER); // add(participantButtonPanel, BorderLayout.EAST); @@ -239,6 +224,7 @@ public void setIrrigationClient(IrrigationClient client) { this.irrigationClient = client; + chatInstructionsPane.setText(irrigationClient.getServerConfiguration().getChatInstructions()); client.getEventChannel().add(this, new EventTypeProcessor<ChatEvent>(ChatEvent.class) { public void handle(final ChatEvent chatEvent) { SwingUtilities.invokeLater(new Runnable() { @@ -252,4 +238,8 @@ }); } + public void setFocusInChatField() { + chatField.requestFocusInWindow(); + } + } Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java 2009-10-23 00:27:56 UTC (rev 327) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java 2009-10-23 04:01:06 UTC (rev 328) @@ -563,7 +563,7 @@ } - public void updateSubmitTokenScreenDisplay() { + public void updateTokenInstructionsPanel() { Runnable runnable = new Runnable() { public void run() { GroupDataModel group = clientDataModel.getGroupDataModel(); @@ -573,7 +573,6 @@ infrastructureEfficiency = roundConfiguration.getInitialInfrastructureEfficiency(); } else { - System.err.println("group was not null, efficiency is: " + group.getInfrastructureEfficiency() + " degrading by " + clientDataModel.getRoundConfiguration().getInfrastructureDegradationFactor()); infrastructureEfficiency = group.getInfrastructureEfficiency() - roundConfiguration.getInfrastructureDegradationFactor(); } addCenterComponent(getInvestTokensPanel()); @@ -602,12 +601,19 @@ instructionsBuilder.append("<hr/>"); int irrigationCapacity = clientDataModel.getGroupDataModel().getFlowCapacity(); int clientCapacity = roundConfiguration.getMaximumClientFlowCapacity(); - - instructionsBuilder.append( - String.format("<p><b>The irrigation capacity is %d cfps and the maximum amount of water you can collect per second is %d cfps.</b></p>", - irrigationCapacity, - Math.min(irrigationCapacity, clientCapacity) - )); + if (roundConfiguration.shouldResetInfrastructureEfficiency()) { + instructionsBuilder.append("The irrigation infrastructure efficiency is currently 75%."); + } + else { + instructionsBuilder.append( + String.format("<p>The current infrastructure efficiency is %d%% but will be degraded by %d%% during this round." + + "The current irrigation capacity is %d cfps with a maximum canal capacity is %d cfps.</p><hr/>", + clientDataModel.getGroupDataModel().getInfrastructureEfficiency(), + roundConfiguration.getInfrastructureDegradationFactor(), + irrigationCapacity, + roundConfiguration.getMaximumCanalFlowCapacity() + )); + } setInstructions(instructionsBuilder.toString()); } addCenterComponent(getInstructionsPanel()); @@ -624,11 +630,11 @@ public void initializeChatWindow() { SwingUtilities.invokeLater(new Runnable() { public void run() { - //canalPanelAnimation.stopTimer(); - startTimer(clientDataModel.getRoundConfiguration().getChatDuration() * 1000L); + startTimer(getServerConfiguration().getChatDuration() * 1000L); ChatPanel chatPanel = getChatPanel(); chatPanel.initialize(clientDataModel.getAllClientIdentifiers()); addCenterComponent( chatPanel ); + chatPanel.setFocusInChatField(); } }); } @@ -641,7 +647,7 @@ public void actionPerformed(ActionEvent event) { final long timeRemaining = endTime - System.currentTimeMillis(); if (timeRemaining < 0) { - addCenterComponent(getInvestTokensPanel()); + updateTokenInstructionsPanel(); getInvestedTokensTextField().requestFocusInWindow(); timer.stop(); timer = null; Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java 2009-10-23 00:27:56 UTC (rev 327) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java 2009-10-23 04:01:06 UTC (rev 328) @@ -109,7 +109,7 @@ IrrigationClient client = new IrrigationClient(); client.initialize(); frame.setTitle("Virtual Commons Experiment Client: " + client.id); - frame.setPreferredSize(new Dimension(1100, 800)); + frame.setPreferredSize(new Dimension(1200, 800)); // frame.setResizable(false); frame.getContentPane().add(client.getExperimentGameWindow()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); @@ -201,7 +201,7 @@ }); channel.add(this, new EventTypeProcessor<DisplaySubmitTokenRequest>(DisplaySubmitTokenRequest.class) { public void handle(DisplaySubmitTokenRequest request) { - experimentGameWindow.updateSubmitTokenScreenDisplay(); + experimentGameWindow.updateTokenInstructionsPanel(); } }); channel.add(this, new EventTypeProcessor<BeginChatRoundRequest>(BeginChatRoundRequest.class) { Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java 2009-10-23 00:27:56 UTC (rev 327) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java 2009-10-23 04:01:06 UTC (rev 328) @@ -145,9 +145,6 @@ return getBooleanProperty("chat-enabled-before-round", true); } - public int getChatDuration() { - return getIntProperty("chat-duration", 40); - } /** * Returns the duration of the round in seconds. Set to default of 50 seconds per round. Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java 2009-10-23 00:27:56 UTC (rev 327) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java 2009-10-23 04:01:06 UTC (rev 328) @@ -161,5 +161,22 @@ public int getNumberOfGeneralInstructionPages() { return assistant.getIntProperty("general-instruction-pages", 8); } + + public int getChatDuration() { + return assistant.getIntProperty("chat-duration", 60); + } + public String getChatInstructions() { + return assistant.getProperty("chat-instructions", + String.format( + "<h3>Chat Instructions</h3><p>You now have the opportunity to chat for %d seconds. You can discuss whatever you want" + + " related to the experiment with some restrictions. You may not promise the other participant(s) side " + + "payments or threaten them with any consequence (e.g., physical violence) after the experiment is finished. Also, you may not reveal your real identity." + + "We are monitoring chat traffic - if we notice a violation of the rules we will remove the group from the room until the other groups are finished with the experiment.</p>" + + "<p>You can send messages by typing in the text field at the bottom of the screen and then hit return or click send. " + + "The time left for the discussion is displayed above the text field at the bottom of the screen.</p>", + getChatDuration()) + ); + } + } Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java 2009-10-23 00:27:56 UTC (rev 327) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java 2009-10-23 04:01:06 UTC (rev 328) @@ -25,11 +25,8 @@ private final Map<Identifier, ClientData> clients = new LinkedHashMap<Identifier, ClientData>(); - private transient ServerDataModel serverDataModel; - private RoundConfiguration roundConfiguration; - private transient Logger logger = Logger.getLogger(GroupDataModel.class.getName()); private int currentlyAvailableFlowCapacity = 0; @@ -42,7 +39,6 @@ private int totalContributedTokens = 0; public GroupDataModel(ServerDataModel serverDataModel) { - this.serverDataModel = serverDataModel; setRoundConfiguration(serverDataModel.getRoundConfiguration()); } @@ -53,21 +49,6 @@ public Set<Identifier> getClientIdentifiers() { return Collections.unmodifiableSet(clients.keySet()); } - /** Here instead of tokens there would be get in general tokens, or the profit earned - * but at present it would be just currentTokens - * - * @param id - * @return - */ - public int getAward(Identifier id) { - ClientData state = (ClientData) clients.get(id); - if (state == null) { - // FIXME: perhaps we should just return 0 instead. - throw new IllegalArgumentException( - "no client state available for: " + id); - } - return state.getAllTokensEarnedThisRound(); - } public void addClient(ClientData clientData) { clients.put(clientData.getId(), clientData); @@ -90,10 +71,6 @@ clients.clear(); } - public void setServerDataModel(ServerDataModel serverDataModel) { - this.serverDataModel = serverDataModel; - } - public Map<Identifier, ClientData> getClientDataMap() { return Collections.unmodifiableMap(clients); } @@ -118,35 +95,26 @@ for(ClientData clientData : getClientDataMap().values()) { totalContributedTokens += clientData.getInvestedTokens(); } - getLogger().info("total contributed tokens: " + totalContributedTokens); updateInfrastructureEfficiency(totalContributedTokens); - currentlyAvailableFlowCapacity = maximumAvailableFlowCapacity = getFlowCapacity(); - getLogger().info("maximum available flow capacity = "+ maximumAvailableFlowCapacity); } private void updateInfrastructureEfficiency(int totalContributedTokens) { RoundConfiguration roundConfiguration = getRoundConfiguration(); - int currentRoundNumber = roundConfiguration.getRoundNumber(); // initialize infrastructure efficiency - System.err.println("current round number: " + currentRoundNumber); - System.err.println("initial infrastructure efficiency: " + infrastructureEfficiency); if ( roundConfiguration.shouldResetInfrastructureEfficiency() ) { - System.err.println("initializing infrastructure efficiency to default initial value: " + roundConfiguration.getInitialInfrastructureEfficiency()); infrastructureEfficiency = roundConfiguration.getInitialInfrastructureEfficiency(); } else { // degrade by infrastructure-degradation-factor, clamp at 0 - getLogger().info("degrading infrastructure efficiency: " + infrastructureEfficiency); infrastructureEfficiency = Math.max(infrastructureEfficiency - roundConfiguration.getInfrastructureDegradationFactor(), 0); - getLogger().info("New infrastructure efficiency: " + infrastructureEfficiency); } // set original infrastructure efficiency before token contributions + getLogger().info("initial infrastructure efficiency: " + infrastructureEfficiency); initialInfrastructureEfficiency = infrastructureEfficiency; // add total invested tokens to infrastructure efficiency, clamp at // 100 infrastructureEfficiency = Math.min(100, totalContributedTokens + infrastructureEfficiency); - System.err.println("total infrastructure efficiency: " + infrastructureEfficiency); } /** Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml 2009-10-23 00:27:56 UTC (rev 327) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/irrigation.xml 2009-10-23 04:01:06 UTC (rev 328) @@ -16,21 +16,9 @@ <entry key="round8">round8.xml</entry> <entry key="round9">round9.xml</entry> <entry key="round10">round10.xml</entry> -<entry key="round11">round11.xml</entry> -<entry key="round12">round12.xml</entry> -<entry key="round13">round13.xml</entry> -<entry key="round14">round14.xml</entry> -<entry key="round15">round15.xml</entry> -<entry key="round16">round16.xml</entry> -<entry key="round17">round17.xml</entry> -<entry key="round18">round18.xml</entry> -<entry key="round19">round19.xml</entry> -<entry key="round20">round20.xml</entry> -<entry key="round21">round21.xml</entry> - <entry key="wait-for-participants">true</entry> -<entry key="number-of-rounds">12</entry> +<entry key="number-of-rounds">11</entry> <entry key="undisrupted-flow-required">true</entry> @@ -538,7 +526,7 @@ <![CDATA[ <table border="1" cellspacing="2" cellpadding="2"> <thead> -<th>Water units received (cubic feet)</th> +<th>Water applied to your field</th> <th>Tokens earned</th> </thead> <tr> @@ -658,15 +646,16 @@ <entry key="general-instructions8"> <![CDATA[ <p> -We will now start with two practice rounds. This practice round will not contribute to your earnings – -it is intended to acquaint you with the functioning of the exercise environment. +We will now start with two practice rounds. This practice round will not +contribute to your earnings – it is intended to acquaint you with the +functioning of the exercise environment. </p> <p> -You will first chat via text with other participants in your group for 40 seconds, -then decide how much you wish to invest in irrigation infrastructure -maintenance. After all investment decisions have been made you will begin the -actual round and make real-time decisions on when to open your gates and irrigate -your fields. +You will first chat via text with other participants in your group and then +decide how much you wish to invest in irrigation infrastructure maintenance. +After all investment decisions have been made you will begin the actual round +and make real-time decisions on when to open your gates and irrigate your +fields. </p> <p> If you have any questions feel free to raise your hand and to ask your question. Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round10.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round10.xml 2009-10-23 00:27:56 UTC (rev 327) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round10.xml 2009-10-23 04:01:06 UTC (rev 328) @@ -9,8 +9,7 @@ <![CDATA[ <h3>Round 9 Instructions</h3> <p> -This round is the same as the previous round, but the irrigation -infrastructure efficiency has declined by 10%. +This round is the same as the previous round. </p> ]]> </entry> Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round5.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round5.xml 2009-10-23 00:27:56 UTC (rev 327) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round5.xml 2009-10-23 04:01:06 UTC (rev 328) @@ -21,10 +21,6 @@ you have any questions, please ask them now. </p> -<p> -In this round, the infrastructure has declined by 10%. -</p> - ]]> </entry> </properties> Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round6.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round6.xml 2009-10-23 00:27:56 UTC (rev 327) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round6.xml 2009-10-23 04:01:06 UTC (rev 328) @@ -3,14 +3,13 @@ <properties> <comment>Irrigation experiment round configuration</comment> -<entry key='infrastructure-degradation-factor'>10</entry> +<entry key='infrastructure-degradation-factor'>85</entry> <entry key="instructions"> <![CDATA[ <h3>Round 5 Instructions</h3> <p> -This round is the same as the previous round. The irrigation infrastructure -efficiency has experienced a decline of 10%. +This round is the same as the previous round. </p> ]]> Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round7.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round7.xml 2009-10-23 00:27:56 UTC (rev 327) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round7.xml 2009-10-23 04:01:06 UTC (rev 328) @@ -3,14 +3,13 @@ <properties> <comment>Irrigation experiment round configuration</comment> -<entry key='infrastructure-degradation-factor'>85</entry> +<entry key='infrastructure-degradation-factor'>10</entry> <entry key="instructions"> <![CDATA[ <h3>Round 6 Instructions</h3> <p> -This round is the same as the previous round, but the irrigation -infrastructure efficiency has experienced a severe decline of 85%. +This round is the same as the previous round. </p> ]]> Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round8.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round8.xml 2009-10-23 00:27:56 UTC (rev 327) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round8.xml 2009-10-23 04:01:06 UTC (rev 328) @@ -9,8 +9,7 @@ <![CDATA[ <h3>Round 7 Instructions</h3> <p> -This round is the same as the previous round, but the irrigation -infrastructure efficiency has declined by 30%. +This round is the same as the previous round. </p> ]]> </entry> Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round9.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round9.xml 2009-10-23 00:27:56 UTC (rev 327) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/round9.xml 2009-10-23 04:01:06 UTC (rev 328) @@ -9,8 +9,7 @@ <![CDATA[ <h3>Round 8 Instructions</h3> <p> -This round is the same as the previous round, but the irrigation -infrastructure efficiency has declined by 10%. +This round is the same as the previous round. </p> ]]> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2009-10-23 16:44:45
|
Revision: 329 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=329&view=rev Author: alllee Date: 2009-10-23 16:44:30 +0000 (Fri, 23 Oct 2009) Log Message: ----------- adding variable canal treatment. Modified Paths: -------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java Added Paths: ----------- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/irrigation.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round0.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round1.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round10.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round11.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round12.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round13.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round14.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round15.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round16.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round2.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round3.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round4.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round5.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round6.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round7.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round8.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round9.xml Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java 2009-10-23 04:01:06 UTC (rev 328) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java 2009-10-23 16:44:30 UTC (rev 329) @@ -293,7 +293,8 @@ private JTextField createTextField() { JTextField textField = new JTextField(); textField.setEditable(false); - textField.setBackground(Color.LIGHT_GRAY); +// textField.setBackground(Color.LIGHT_GRAY); + textField.setBackground(Color.YELLOW); return textField; } @@ -424,7 +425,6 @@ getTokensNotInvestedTextField().setText("" + clientData.getUninvestedTokens()); getTokensEarnedTextField().setText("" + clientData.getTokensEarnedFromWaterCollected()); getTotalTokensEarnedTextField().setText("" + clientData.getAllTokensEarnedThisRound()); - // getScoreBoxPanel().update(clientDataModel); getMiddleWindowPanel().update(clientDataModel); } Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java 2009-10-23 04:01:06 UTC (rev 328) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java 2009-10-23 16:44:30 UTC (rev 329) @@ -44,7 +44,7 @@ } public int getMaximumCanalFlowCapacity() { - return getIntProperty("max-canal-flow-capacity", 40); + return getIntProperty("max-canal-flow-capacity", 30); } public int getMaximumTokenInvestment() { Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java 2009-10-23 04:01:06 UTC (rev 328) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java 2009-10-23 16:44:30 UTC (rev 329) @@ -33,7 +33,7 @@ private int maximumAvailableFlowCapacity = 0; private int infrastructureEfficiency; - + // infrastructure efficiency before investment (but post decline) private int initialInfrastructureEfficiency; private int totalContributedTokens = 0; @@ -156,11 +156,11 @@ } public int getInitialFlowCapacity() { - return calculateFlowCapacity(initialInfrastructureEfficiency); + return Math.min(calculateFlowCapacity(initialInfrastructureEfficiency), getRoundConfiguration().getMaximumCanalFlowCapacity()); } public int getFlowCapacity() { - return calculateFlowCapacity(infrastructureEfficiency); + return Math.min(calculateFlowCapacity(infrastructureEfficiency), getRoundConfiguration().getMaximumCanalFlowCapacity()); } public void resetCurrentlyAvailableFlowCapacity() { Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/irrigation.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/irrigation.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/irrigation.xml 2009-10-23 16:44:30 UTC (rev 329) @@ -0,0 +1,734 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> +<!--<entry key="hostname">localhost</entry>--> +<entry key="hostname">@SERVER_ADDRESS@</entry> +<entry key="port">@PORT_NUMBER@</entry> +<entry key="round0">round0.xml</entry> +<entry key="round1">round1.xml</entry> +<entry key="round2">round2.xml</entry> +<entry key="round3">round3.xml</entry> +<entry key="round4">round4.xml</entry> +<entry key="round5">round5.xml</entry> +<entry key="round6">round6.xml</entry> +<entry key="round7">round7.xml</entry> +<entry key="round8">round8.xml</entry> +<entry key="round9">round9.xml</entry> +<entry key="round10">round10.xml</entry> +<entry key="round11">round11.xml</entry> +<entry key="round12">round12.xml</entry> +<entry key="round13">round13.xml</entry> +<entry key="round14">round14.xml</entry> +<entry key="round15">round15.xml</entry> +<entry key="round16">round16.xml</entry> + +<entry key="wait-for-participants">true</entry> +<entry key="number-of-rounds">17</entry> + +<entry key="undisrupted-flow-required">true</entry> + +<entry key="q1">4</entry> +<entry key="q2">identity</entry> +<entry key="q3">49</entry> +<entry key="q4">76</entry> +<entry key="q5">20</entry> +<entry key="q6">5</entry> +<entry key="q7">25</entry> +<entry key="q8">7</entry> +<entry key="q9">19</entry> +<entry key="q10">1.50</entry> + +<entry key='final-instructions'> +<![CDATA[ +<p> +The experiment is almost over. We have a brief survey for you to fill out while the +facilitator prepares your payments. When the facilitator has finished preparing +payments and you have all completed your surveys your computer number will be +called. You can then go next door to receive your payment. For privacy reasons we +must pay you one at a time. +</p> +<p> +Thanks for participating! +</p> +]]> +</entry> + + +<entry key="initial-instructions"> +<![CDATA[ +<h3>Welcome</h3> +<p> +Please be patient while the experimental environment is set up. +<b>Please do not close this window or open any other windows.</b> +</p> +]]> +</entry> + + +<entry key="facilitator-instructions"> +<![CDATA[ +<h3>Facilitator Instructions</h3> +<p> +Welcome to the facilitator interface. This interface allows you to control +the experiment. You may only modify configuration parameters <b>before</b> +you start the experiment by selecting the Configuration menu. When all the +participants are ready to begin the experiment, you can start the experiment +by selecting Experiment -> Start. After a round has been completed you +will be able to view the statistics for all of the participants. You can +begin the next round by selecting Round -> Start. +</p> +]]> +</entry> + + + +<entry key="general-instructions0"> +<![CDATA[ +<center><h3>Welcome to the experiment. Please do not close this window or open any +other applications.</h3></center> +]]> +</entry> + +<entry key="general-instructions1"> +<![CDATA[ +<h3>General Instructions</h3> +<p>Welcome. You have already earned 5 dollars by showing up for this exercise. +You can earn more, up to an extra 25 dollars, by participating in the exercise +which will last for about one hour. You will participate in this exercise as a +part of a group. Each group has five participants. Your group has been formed +by randomly assigning you to FOUR other participants in the room. The amount +of money you earn will depend on the decisions made by you and the rest of the +group. That is, your earnings will depend on your decisions as well as the +other members of your group. +</p> +<p> +This exercise mimics decisions people make in irrigation systems. In each round you +will receive 10 tokens which you can choose to keep or invest in the irrigation +infrastructure (for example canals and water diversion structures). Depending on the +state of repair of the irrigation infrastructure, it will be capable of directing +water to your field when you use your water diversion structure (called an +irrigation gate). Depending on the amount of water you can get to your field, you +can grow crops. Depending on the number of crops you grow you earn tokens. Each +token is worth 5 cents and you will be paid cash in private at the end of the +experiment based on the number of tokens you earned. +</p> +<p> +The experiment consists of a number of rounds. In each round you will first make a +decision as to how much to invest in the irrigation infrastructure. Without periodic +investment, the irrigation infrastructure will break down over time. Based on the +combined contributions of all 5 participants in your group in each round, as +explained below, your group can maintain the performance of the irrigation +infrastructure. The condition of the irrigation infrastructure determines +its capacity to deliver water which you can use to grow crops. +</p> +]]> +</entry> + +<entry key="general-instructionsq1"> +<![CDATA[ +<br><br> +To continue to the next page, please answer the following question:<br> +<form> +How many OTHER people in the room will be in your group?<br> +<input type="radio" name="q1" value="0">0<br> +<input type="radio" name="q1" value="1">1<br> +<input type="radio" name="q1" value="4">4<br> +<input type="radio" name="q1" value="Everybody">Everybody<br> +<br><br> +<input type="submit" name="submit" value="Submit"> +</form> +]]> +</entry> + +<entry key="general-instructions2"> +<![CDATA[ +<h3>Chat</h3> +<p>Before each round you will have a chat period of 40 seconds where you can send +text messages to the other participants. You may discuss any aspect of the exercise +with two important exceptions: +</p> +<ol> +<li>You are <b>not allowed</b> to promise the other participants +side-payments or threaten them with any consequence after the experiment is +finished. +</li> +<li>You are <b>not allowed to reveal your real identity</b>.</li> +</ol> +<p> +We will be monitoring the chat traffic. If we detect any violation of these rules, +we will have to remove <b>all members of the group where the violation occurred</b> +from the experiment. That group will have to wait until the entire experiment is +finished to receive their payment. +</p> +<p> +You will see a text box appear on your screen when a chat period starts. The amount +of time left in the chat period will be shown at the <b>top left of the screen</b>.<br> +</p> +]]> +</entry> + +<entry key="general-instructionsq2"> +<![CDATA[ +<br><br> +To continue to the next page, please answer the following question:<br> +<form> +Which of the following topics are you <b>not allowed</b> to discuss in chat?<br> +<input type="radio" name="q2" value="weather">the weather<br> +<input type="radio" name="q2" value="identity">your real identity<br> +<input type="radio" name="q2" value="experiment">the experiment<br> +<input type="radio" name="q2" value="earnings">what you will do with the money you earn from this experiment<br> +<br><br> +<input type="submit" name="submit" value="Submit"> +</form> +]]> +</entry> + +<entry key="general-instructions3"> +<![CDATA[ +<h3>Creating Irrigation Infrastructure</h3> +<p> +After the chat period ends you and each other participant will be given 10 tokens. +You must then decide what to do with these tokens. You may decide to invest in the +irrigation infrastructure or to keep the tokens. If you keep the tokens you will +earn at a minimum 10 tokens X 5 cents = $0.50 for each round. If you do this every +round after twenty rounds you will end up with at least $10 (plus any crops that you +may be able to grow as we will discuss later). Your total earnings for +participating in the experiment would then be at least $10 plus your show-up payment +of $5, for a grand total of at least $15. +</p> +<p> +On the other hand, if you invest some of your tokens in the irrigation +infrastructure, you may be able to earn more than this amount by growing crops. If +the irrigation infrastructure is operating at near maximum capacity you can earn +close to $1.50 each round. Thus if you grow crops you can roughly triple your +earnings compared to doing nothing. The actual earnings depend on the decisions you +and the other participants in your group make in terms of investment and when to +grow crops. +</p> +<p> +In each round the condition of the irrigation system declines such that its water +delivery efficiency drops by 25%. Investment is necessary to keep the irrigation +infrastructure from deteriorating. If you decide to invest in irrigation +infrastructure you must decide on the amount to invest out of your initial 10 +tokens. Keep in mind that the irrigation infrastructure must exceed a certain level +before you can grow crops. The tokens invested by all participants in your group +are added together and will total up to an amount 0 and 50 tokens. Each token +invested increases the irrigation infrastructure efficiency by one percentage point, +up to a <b>maximum of 100%</b>. This means that if the irrigation infrastructure +efficiency is at 80% it would not make sense for your group to invest a total of 50 +tokens, as any investment beyond 20 tokens would be wasted. In the table below you +can see the water delivery capacity measured in water units per second as a function +of the condition of the irrigation infrastructure. When the infrastructure is at +100% efficiency, 40 cubic feet of water per second (cfps) will be available. When the +irrigation infrastructure efficiency falls below 45%, there is no capacity left for +transporting water and thus there is no water available for anyone. +</p> +<p> +Your initial irrigation infrastructure will start at 75% efficiency but <b>will +carry over from round to round</b>. As an example, let's say that no one in a +group invests any tokens in the first round. The irrigation infrastructure +efficiency will be set at 75% for that first round. The table below lists the water +delivery in cubic feet per second (cfps) corresponding to the irrigation infrastructure +efficiency. If you look at the second to last row you can see that at 75% +efficiency the irrigation infrastructure will deliver 35 cfps. So in the first +round the group will have 35 cfps of water available to them. +</p> +<p> +Recall that each round the irrigation infrastructure efficiency deteriorates by 25%, +so at the start of the second round the infrastructure efficiency decreases to 50%. +At this point all five members of the group decide to invest 7 tokens each. This +increases the infrastructure efficiency by 35%, resulting in a total infrastructure +efficiency of 85%. If you look at the table again you can see that an +infrastructure efficiency of 85% will deliver 40 cfps. +</p> +<p> +The actual amount of water that is available for the group depends on the amount of +water available. Your group might have created an irrigation infrastructure with a +capacity of 40 cfps, but due to lack of rainfall only 30 cfps is available. On the +other hand, if the infrastructure capacity allows 30 cfps and 40 cfps of water is available +to the system, only 30 cfps can be delivered. +</p> + +<p> +To recap, at the beginning of each round you will be informed of the current +irrigation infrastructure efficiency. You will then decide how many tokens (between +0 and 10) to invest in the irrigation infrastructure. After everybody has made +their decision, you will be notified of the condition of the irrigation +infrastructure and the corresponding water delivery capacity. +</p> + +<b>Table 1:</b> The water delivery capacity as a function of the irrigation +infrastructure condition +<table border="1" cellspacing="2" cellpadding="2"> +<thead> +<th>Infrastructure efficiency (percent)</th> +<th>Water delivery (cubic feet per second)</th> +</thead> +<tr> +<td>≤ 45</td><td>0</td> +</tr> +<tr> +<td>46-51</td><td>5</td> +</tr> +<tr> +<td>52-55</td><td>10</td> +</tr> +<tr> +<td>56-58</td><td>15</td> +</tr> +<tr> +<td>59-61</td><td>20</td> +</tr> +<tr> +<td>62-65</td><td>25</td> +</tr> +<tr> +<td>66-70</td><td>30</td> +</tr> +<tr> +<td>71-80</td><td>35</td> +</tr> +<tr> +<td>81-100</td><td>40</td> +</tr> +</table> + +]]> +</entry> + +<entry key="general-instructionsq3"> +<![CDATA[ +<br><br> +To continue to the next page, please answer the following questions:<br> +<form> +Question 1:<br> +Given an existing infrastructure efficiency of 20%, if the five participants invest +a <b>total of 29 additional tokens</b>, what is the new irrigation infrastructure +efficiency? +(<b>Note: only enter a number, you don't need to add the % sign</b>)<br> +<input type="text" name="q3" value = ""> +<br><br> + +Question 2:<br> +Given an existing infrastructure efficiency of 50%, if <b>two participants invest 10 tokens each</b> +while the <b>three other participants invest 2 tokens each</b>, what is the new +irrigation infrastructure efficiency? +(<b>Note: only enter a number, you don't need to add the % sign</b>)<br> +<input type="text" name="q4" value = ""> +<br><br> +<input type="submit" name="submit" value="Submit"><br> +<br> +</form> +]]> +</entry> + +<entry key="general-instructions4"> +<![CDATA[ +<h3>Growing crops</h3> +<p>There are <b>five</b> participants in each group, each of which is randomly assigned to +one of the five positions, A, B, C, D or E. Below is a screenshot of the +graphical interface representation of the irrigation system. Water comes from +the box to the left and the five players are located from upstream (leftmost) +to downstream (rightmost) accordingly. To illustrate, assume you are in +position C. The black lines represent "gates" that you open and close by +clicking on the large button on the lower left corner of the screen. +Each round consists of 50 seconds and the amount of time left in the +experiment is indicated by a bar at the top of the screen. +</p> +<img src="http://dev.commons.asu.edu/irrigation/images/game-interface-screenshot.jpg"> +<br><br> +<p> +You can irrigate your field during the round by opening your gate. Your +earnings depend on the amount of water you can draw onto your fields and will +be explained in more detail on the next page. The speed at which you can grow +a crop depends on the amount of water available to you <b>at the time that you +open your gate</b>. The maximum flow capacity of the main canal shared by A, +B, C, D, and E is forty cubic feet per second. +</p> +<p> +The maximum amount of water that can flow through your gate when it is opened +is 25 cubic feet per second. If other people are using the canal, the water +flow available to you might be less, and it may take longer to get water to +your field since you are also limited by the amount of water that is flowing +through the shared canal. +</p> +]]> +</entry> + +<entry key="general-instructionsq4"> +<![CDATA[ +<br><br> +To continue to the next page, please answer the following question:<br> +Question 3:<br> +<form> +What is the minimum time to deliver 500 cubic feet of water to your field when +your maximum water flow capacity is available? +<br> +<input type="radio" name="q5" value="12.5">12.5 seconds<br> +<input type="radio" name="q5" value="20">20 seconds<br> +<input type="radio" name="q5" value="25">25 seconds<br> +<input type="radio" name="q5" value="50">50 seconds<br> +<br><br> +<input type="submit" name="submit" value="Submit"> +</form> +]]> +</entry> + + +<entry key="general-instructions5"> +<![CDATA[ +<h3>Positions A,B,C,D and E</h3> +<p> +The animation above illustrates how water flows to each player when their gates are +opened and closed. When a player opens their gate, the black line will rotate to a +vertical position, allowing water (represented by white dots) to flow to them. Note +that the water available downstream of a player with an open port is reduced, +illustrated by a narrowing of the canal. +</p> +<p> +Access to water depends on your position as shown in the window. Water originates +in the box at the upper left part of the screen and travels to the right. Thus, +participant A will have first access to the available water. Water not used by +participant A is then available to be used by participant B. Water not used by +participants A and B is then available for C. Water not used by participants A, B +and C is available for D. Finally, water not used by participants A, B, C and D is +available for E. +</p> +<p> +You can only get water to your field if you have water available to your position. +Suppose that the total irrigation capacity available is 40 cfps and 40 cfps of water +is available. If player A opens their gate they will consume 25 cfps of water and 15 +cfps is left for B. Suppose on the other hand, A does not open the gate, then a +total of 40 cfps is left for B, allowing B to extract water at the maximum rate of +25 cfps. +</p> +<p> +As another example, suppose that the canal system has been allowed to deteriorate +so that the total irrigation capacity available is 20 cfps. While player A’s gate is +open, no water is available for B. If A is NOT using water, 20 cfps is available for +B. +</p> +]]> +</entry> + +<entry key="general-instructionsq5"> +<![CDATA[ +<br><br> +To continue to the next page, please answer the following question:<br> +<form> +Suppose the irrigation efficiency is between 71 and 80% so that the canal flow +capacity is 30 cfps. If A opens their gate and diverts water at 25 cfps what is the +available water flow for B? +<br> +<input type="radio" name="q6" value="30">30 cfps<br> +<input type="radio" name="q6" value="25">25 cfps<br> +<input type="radio" name="q6" value="15">15 cfps<br> +<input type="radio" name="q6" value="5">5 cfps<br> +<br><br> +If the canal flow capacity available is 25 cfps and A,B,C and D are not using water, +what is the available water for E? +<br> +<input type="radio" name="q7" value="40">40 cfps<br> +<input type="radio" name="q7" value="25">25 cfps<br> +<input type="radio" name="q7" value="15">15 cfps<br> +<input type="radio" name="q7" value="0">0 cfps<br> + +<input type="submit" name="submit" value="Submit"> +<br><br> +</form> +]]> +</entry> + +<entry key="general-instructions6"> +<![CDATA[ +<h3>How to grow crops</h3> +<p> +To start growing crops, click on the yellow button labeled "open gate". +This will open your irrigation gate and allow water to flow to your field if it is +available. The text on the button will change to "close gate" - if +you would like to close the gate and stop extracting water from the canal, just +click on the yellow button again. Your gate will close and the text on the button +will change back to "open gate". +</p> +<p> +The amount of water units (cubic feet) your field has received is shown on the +screen, as well as the resulting amount of tokens earned from growing a crop. +The number of tokens earned in each round depends on how much water you have +diverted to your field. If you receive less than 150 cubic feet (cf) the crop has +not received enough water to grow a crop and you will thus not receive any tokens. +The maximum earnings are received when between 500 cf and 549 cf are diverted to +your field. If more than 549 cf water is diverted to your field, this will +negatively affect the growth of the crop (i.e. overwatering) and less tokens will be +earned. In the table below you can see the amount of tokens earned for amount of +water applied to your field. +</p> +<b>Table 2</b>: Earnings resulting from the amount of water applied to your field. + +<table border="1" cellspacing="2" cellpadding="2"> +<thead> +<th>Water units received (cubic feet)</th> +<th>Tokens earned</th> +</thead> +<tr> +<td>< 150</td><td>0</td> +</tr> +<tr> +<td>150-199</td><td>1</td> +</tr> +<tr> +<td>200-249</td><td>4</td> +</tr> +<tr> +<td>250-299</td><td>10</td> +</tr> +<tr> +<td>300-349</td><td>15</td> +</tr> +<tr> +<td>350-399</td><td>18</td> +</tr> +<tr> +<td>400-499</td><td>19</td> +</tr> +<tr> +<td>500-549</td><td>20</td> +</tr> +<tr> +<td>550-649</td><td>19</td> +</tr> +<tr> +<td>650-699</td><td>18</td> +</tr> +<tr> +<td>700-749</td><td>15</td> +</tr> +<tr> +<td>750-799</td><td>10</td> +</tr> +<tr> +<td>800-849</td><td>4</td> +</tr> +<tr> +<td>850-899</td><td>1</td> +</tr> +<tr> +<td>> 899</td><td>0</td> +</tr> +</table> + +Your earnings at the end of the round depend on your investment and the number of +tokens received for the crop. For example, suppose you invest 6 out of the 10 +tokens you are endowed with at the start of the round and you receive 333 cubic feet +of water. Your total earnings will be the amount of tokens leftover from your +initial endowment (10 - 6) plus the tokens you earned from your crop (15 tokens for +333 cubic feet of water, see Table 2). The total number of tokens earned is 19 +($0.85 since each token is $0.05). + +]]> +</entry> + +<entry key='water-collected-to-tokens-table'> +<![CDATA[ +<table border="1" cellspacing="2" cellpadding="2"> +<thead> +<th>Water applied to your field</th> +<th>Tokens earned</th> +</thead> +<tr> +<td>< 150</td><td>0</td> +</tr> +<tr> +<td>150-199</td><td>1</td> +</tr> +<tr> +<td>200-249</td><td>4</td> +</tr> +<tr> +<td>250-299</td><td>10</td> +</tr> +<tr> +<td>300-349</td><td>15</td> +</tr> +<tr> +<td>350-399</td><td>18</td> +</tr> +<tr> +<td>400-499</td><td>19</td> +</tr> +<tr> +<td>500-549</td><td>20</td> +</tr> +<tr> +<td>550-649</td><td>19</td> +</tr> +<tr> +<td>650-699</td><td>18</td> +</tr> +<tr> +<td>700-749</td><td>15</td> +</tr> +<tr> +<td>750-799</td><td>10</td> +</tr> +<tr> +<td>800-849</td><td>4</td> +</tr> +<tr> +<td>850-899</td><td>1</td> +</tr> +<tr> +<td>> 899</td><td>0</td> +</tr> +</table> +]]> +</entry> + + +<entry key="general-instructionsq6"> +<![CDATA[ +<br><br> +To continue to the next page, please answer the following question:<br> +<form> +If you invest 7 of the 10 tokens you started with, and you put 202 cf of water on +your field, what is the total number of tokens you will have earned for that round? +<br> +<input type="radio" name="q8" value="3">3<br> +<input type="radio" name="q8" value="4">4<br> +<input type="radio" name="q8" value="7">7<br> +<input type="radio" name="q8" value="13">13<br> +<br><br> +If you invest all 10 tokens you start with, and you put 555 cf of water on your +field, what is the total number of tokens your will have earned for that round? +<br> +<input type="radio" name="q9" value="10">10<br> +<input type="radio" name="q9" value="19">19<br> +<input type="radio" name="q9" value="20">20<br> +<input type="radio" name="q9" value="29">29<br> +<br><br> +<input type="submit" name="submit" value="Submit"> +</form> +]]> +</entry> + +<entry key="general-instructions7"> +<![CDATA[ +<h3>Scores</h3> +<p> +The total number of tokens collected during a round is shown on the screen with the +message: +<br><br> +Total tokens earned this round: 0 +<br><br> +This the total of tokens not invested in irrigation structure plus additional +tokens earned by growing a crop. +<br> +You will also see the scores of the other participants summarized on the screen. +Finally, you will see the water flow capacity of each player at any given moment, as +illustrated in the figure below. + +]]> +</entry> + + +<entry key="general-instructionsq7"> +<![CDATA[ +<br><br> +To continue to the next page, please answer the following question:<br> +<form> +Each token is worth 5 cents, thus if you collected 30 tokens in a round you earned: +<br> +<input type="radio" name="q10" value=".15">$0.15<br> +<input type="radio" name="q10" value=".50">$0.50<br> +<input type="radio" name="q10" value="1.50">$1.50<br> +<input type="radio" name="q10" value="2.50">$2.50<br> +<br><br> +<input type="submit" name="submit" value="Submit"> +<br><br> +</form> +]]> +</entry> + +<entry key="general-instructions8"> +<![CDATA[ +<p> +We will now start with two practice rounds. This practice round will not +contribute to your earnings – it is intended to acquaint you with the +functioning of the exercise environment. +</p> +<p> +You will first chat via text with other participants in your group and then +decide how much you wish to invest in irrigation infrastructure maintenance. +After all investment decisions have been made you will begin the actual round +and make real-time decisions on when to open your gates and irrigate your +fields. +</p> +<p> +If you have any questions feel free to raise your hand and to ask your question. +<b>Do you have any questions so far?</b> +</p> +]]> +</entry> + +<entry key="undisrupted-flow-instructions"> +<![CDATA[ +<p> +If the flow of water is disrupted while your gate is open your crop growing progress +will be halted. +</p> +]]> +</entry> + + +<entry key="investment-instructions"> +<![CDATA[ +<h3>Invest tokens in the irrigation infrastructure</h3> +<p> +You have been endowed with 10 tokens to invest. You must make a decision about +how much you wish to invest [0,10] in the irrigation infrastructure. You can +see the relationship between total investment and irrigation infrastructure in +the table below. After you have entered the number of tokens you'd like to +invest, hit the enter key or click the submit button to confirm your +investment. When everybody has made their decision, the total investment will +be calculated and the overall irrigation infrastructure will be displayed. +Each token you invest corresponds to one percent of infrastructure efficiency, +so if you invest 10 tokens you are contributing 10% to the overall +infrastructure efficiency. +</p> +<table border="1" cellspacing="2" cellpadding="2"> +<thead> +<th>Total Infrastructure Efficiency (percent)</th> +<th>Water delivery (cubic feet per second)</th> +</thead> +<tr> +<td> ≤ 45</td><td>0</td> +</tr> +<tr> +<td>46-51</td><td>5</td> +</tr> +<tr> +<td>52-55</td><td>10</td> +</tr> +<tr> +<td>56-58</td><td>15</td> +</tr> +<tr> +<td>59-61</td><td>20</td> +</tr> +<tr> +<td>62-65</td><td>25</td> +</tr> +<tr> +<td>66-70</td><td>30</td> +</tr> +<tr> +<td>71-80</td><td>35</td> +</tr> +<tr> +<td>81-100</td><td>40</td> +</tr> +</table> +]]> +</entry> + +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round0.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round0.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round0.xml 2009-10-23 16:44:30 UTC (rev 329) @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> +<entry key='max-canal-flow-capacity'>40</entry> +<entry key='max-client-flow-capacity'>25</entry> +<entry key="practice-round">true</entry> + +<entry key="instructions"> +<![CDATA[ +<p> +We will now start with two practice rounds. This practice round will not contribute +to your earnings. If you have any questions feel free to raise your hand and to ask +your question. +<br> +<b>Do you have any questions?</b> +</p> +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round1.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round1.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round1.xml 2009-10-23 16:44:30 UTC (rev 329) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> +<entry key="practice-round">true</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Practice Round 2</h3> +<p> +This is the second practice round of the experiment. If you have any questions +after participating in the first round, please ask them now. +</p> +]]> +</entry> +</properties> + Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round10.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round10.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round10.xml 2009-10-23 16:44:30 UTC (rev 329) @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key='max-canal-flow-capacity'>36</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 9 Instructions</h3> +<p> +This round is the same as the previous round. +</p> +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round11.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round11.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round11.xml 2009-10-23 16:44:30 UTC (rev 329) @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + + +<entry key='max-canal-flow-capacity'>25</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 10 Instructions</h3> +<p> +This round is the same as the previous round. +</p> + +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round12.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round12.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round12.xml 2009-10-23 16:44:30 UTC (rev 329) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key='max-canal-flow-capacity'>32</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 11 Instructions</h3> +<p> +This round is the same as the previous rounds. +</p> + +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round13.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round13.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round13.xml 2009-10-23 16:44:30 UTC (rev 329) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key='max-canal-flow-capacity'>38</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 12 Instructions</h3> +<p> +This round is the same as previous rounds. +</p> + +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round14.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round14.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round14.xml 2009-10-23 16:44:30 UTC (rev 329) @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key='max-canal-flow-capacity'>21</entry> + + +<entry key="instructions"> +<![CDATA[ +<h3>Round 13 Instructions</h3> +<p> +This round is the same as previous rounds. +</p> + +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round15.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round15.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round15.xml 2009-10-23 16:44:30 UTC (rev 329) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key='max-canal-flow-capacity'>29</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 14 Instructions</h3> +<p> +This is round 14/20. The infrastructure has been degraded by 10%. +</p> + +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round16.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round16.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round16.xml 2009-10-23 16:44:30 UTC (rev 329) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key='max-canal-flow-capacity'>39</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 15 Instructions</h3> +<p> +This is the final round. +</p> + +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round2.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round2.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round2.xml 2009-10-23 16:44:30 UTC (rev 329) @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key='reset-infrastructure-efficiency'>true</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 1 Instructions</h3> +<p> +This is the first actual round of the experiment. Before this round begins +you will have the opportunity to text chat with the other participant for +forty seconds, then decide on your level of investment in the irrigation +infrastructure. After the total irrigation infrastructure investment has been +determined you will begin the experiment and make decisions on when to open +your irrigation gates and grow crops. +</p> +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round3.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round3.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round3.xml 2009-10-23 16:44:30 UTC (rev 329) @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 2 Instructions</h3> +<p> +This round is the same as the previous round. +</p> + +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round4.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round4.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round4.xml 2009-10-23 16:44:30 UTC (rev 329) @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 3 Instructions</h3> +<p> +This round is the same as the previous round. +</p> +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round5.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round5.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round5.xml 2009-10-23 16:44:30 UTC (rev 329) @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 4 Instructions</h3> +<p> +This round is the same as previous rounds. +</p> + +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round6.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round6.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round6.xml 2009-10-23 16:44:30 UTC (rev 329) @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 5 Instructions</h3> +<p> +This round is the same as the previous round. +</p> + +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round7.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round7.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round7.xml 2009-10-23 16:44:30 UTC (rev 329) @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key='max-canal-flow-capacity'>27</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 6 Instructions</h3> +<p> +In the past rounds the water supply was stable at a level of 30 cubic +feet per second for each round. In the following rounds the average water +supply remains 30 cfps, but the actual water supply varies each round +between 25 cfps and 35 cfps. After you have made your investment decisions, +the infrastructure level is announced as well as the actual water supply for +that round. Please remember that the water supply is independent of your +irrigation capacity. If you develop an irrigation capacity of 30 cfps but the +water supply is only 20 cfps, you are only getting 20 cfps down your canal. +</p> + +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round8.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round8.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round8.xml 2009-10-23 16:44:30 UTC (rev 329) @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key='max-canal-flow-capacity'>31</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 7 Instructions</h3> +<p> +This round is the same as the previous round. +</p> +]]> +</entry> +</properties> Added: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round9.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round9.xml (rev 0) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/round9.xml 2009-10-23 16:44:30 UTC (rev 329) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Irrigation experiment round configuration</comment> + +<entry key='max-canal-flow-capacity'>22</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 8 Instructions</h3> +<p> +This round is the same as the previous round. +</p> + +]]> +</entry> +</properties> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2009-10-27 05:49:17
|
Revision: 336 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=336&view=rev Author: alllee Date: 2009-10-27 05:49:09 +0000 (Tue, 27 Oct 2009) Log Message: ----------- fixing spacing between irrigation capacity and water supply labels. Modified Paths: -------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/irrigation.xml Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java 2009-10-27 02:20:01 UTC (rev 335) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java 2009-10-27 05:49:09 UTC (rev 336) @@ -8,6 +8,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.GroupLayout; import javax.swing.JButton; @@ -45,7 +46,7 @@ //this contains the upstream and downstream Panel private JPanel jPanelUpStreamWindow = null; private JPanel jPanelDownStreamWindow = null; - private JPanel downloadScreenPanel = null; + private JPanel mainInterfacePanel = null; private IrrigationClient client; @@ -128,12 +129,11 @@ this.setLayout(new BorderLayout(4,4)); this.setSize(1130, 558); - this.add(getJPanelMain(),null); + this.add(getPanel(),null); } - private JPanel getJPanelMain() { - // TODO Auto-generated method stub + private JPanel getPanel() { if(jPanelMain == null){ jPanelMain = new JPanel(); jPanelMain.setLayout(new BorderLayout(4,4)); @@ -142,16 +142,17 @@ JPanel upperPanel = new JPanel(); upperPanel.setLayout(new BoxLayout(upperPanel, BoxLayout.X_AXIS)); upperPanel.add(getIrrigationCapacityLabel()); + upperPanel.add(Box.createHorizontalGlue()); upperPanel.add(getWaterSupplyLabel()); jPanelMain.add(upperPanel, BorderLayout.NORTH); - jPanelMain.add(getDownloadScreenPanel(), BorderLayout.CENTER); + jPanelMain.add(getMainInterfacePanel(), BorderLayout.CENTER); return jPanelMain; } return jPanelMain; } - private JPanel getDownloadScreenPanel() { - if(downloadScreenPanel == null){ + private JPanel getMainInterfacePanel() { + if(mainInterfacePanel == null){ scoreBoardLabel = new JLabel(); scoreBoardLabel.setBounds(new Rectangle(582,225+100+35,530,20)); scoreBoardLabel.setHorizontalAlignment(SwingConstants.CENTER); @@ -169,16 +170,16 @@ priorityjLabel = new JLabel(); priorityjLabel.setBounds(new Rectangle(780, 16, 44, 16)); priorityjLabel.setText(""); - downloadScreenPanel = new JPanel(); - downloadScreenPanel.setLayout(null); - downloadScreenPanel.setName("downloadScreenPanel"); - downloadScreenPanel.setBackground(Color.WHITE); - downloadScreenPanel.add(getCenterPanel(),null); - downloadScreenPanel.add(getTimeLeftProgressBar(), null); - downloadScreenPanel.add(gateSwitchLabel, null); - downloadScreenPanel.add(scoreBoardLabel, null); + mainInterfacePanel = new JPanel(); + mainInterfacePanel.setLayout(null); + mainInterfacePanel.setName("Main interface panel"); + mainInterfacePanel.setBackground(Color.WHITE); + mainInterfacePanel.add(getCenterPanel(),null); + mainInterfacePanel.add(getTimeLeftProgressBar(), null); + mainInterfacePanel.add(gateSwitchLabel, null); + mainInterfacePanel.add(scoreBoardLabel, null); } - return downloadScreenPanel; + return mainInterfacePanel; } private JProgressBar getTimeLeftProgressBar() { @@ -561,10 +562,10 @@ centerPanel.add(getCanalPanel(clientDataModel)); //switch(clientGameState.getPriority()){ - downloadScreenPanel.add(getJPanelUpStreamWindow(),null); - downloadScreenPanel.add(getJPanelDownStreamWindow(),null); + mainInterfacePanel.add(getJPanelUpStreamWindow(),null); + mainInterfacePanel.add(getJPanelDownStreamWindow(),null); //adding the in between Panel - downloadScreenPanel.add(getMiddleWindowPanel(),null); + mainInterfacePanel.add(getMiddleWindowPanel(),null); /*case 0 : downloadScreenPanel.add(getJPanelUpStreamWindow(0),null); downloadScreenPanel.add(getJPanelDownStreamWindow(0),null); //Assigning the Priorities on the Priority Label Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/irrigation.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/irrigation.xml 2009-10-27 02:20:01 UTC (rev 335) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/irrigation.xml 2009-10-27 05:49:09 UTC (rev 336) @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> -<comment>Irrigation experiment round configuration</comment> -<!--<entry key="hostname">localhost</entry>--> +<comment>Irrigation experiment server configuration</comment> <entry key="hostname">@SERVER_ADDRESS@</entry> <entry key="port">@PORT_NUMBER@</entry> <entry key="round0">round0.xml</entry> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2009-11-13 00:50:32
|
Revision: 358 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=358&view=rev Author: alllee Date: 2009-11-13 00:23:33 +0000 (Fri, 13 Nov 2009) Log Message: ----------- removing unused events + other code hygiene / cleanup. Added quiz logic and display logic / events for facilitator to perform new data flow. Still need to implement facilitator sending the appropriate requests to the server and have the server dispatch those requests to all clients. Modified Paths: -------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/CloseGateEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/FacilitatorEndRoundEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/FacilitatorWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/ClientData.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/irrigation.xml Added Paths: ----------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/QuizResponseEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ShowGameScreenshotRequest.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ShowQuizRequest.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ShowTokenInvestmentScreenRequest.java Removed Paths: ------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/DisplaySubmitTokenRequest.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ExperimentDurationEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/FileDownloadCompleteEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/FileDownloadedEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/QuizCompletedEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ServerGameStateEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/StartDownload.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/TransferFileInformationEvent.java Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java 2009-11-12 22:22:15 UTC (rev 357) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java 2009-11-13 00:23:33 UTC (rev 358) @@ -11,14 +11,15 @@ import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; +import java.util.TreeMap; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JButton; -import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; @@ -29,7 +30,7 @@ import edu.asu.commons.irrigation.conf.RoundConfiguration; import edu.asu.commons.irrigation.conf.ServerConfiguration; import edu.asu.commons.irrigation.events.EndRoundEvent; -import edu.asu.commons.irrigation.events.QuizCompletedEvent; +import edu.asu.commons.irrigation.events.QuizResponseEvent; import edu.asu.commons.irrigation.server.ClientData; import edu.asu.commons.irrigation.server.GroupDataModel; import edu.asu.commons.util.HtmlEditorPane; @@ -39,7 +40,6 @@ * $Id$ * * The root experiment window placed in the client's JFrame. - * * * @author <a href='mailto:All...@as...'>Allen Lee</a> * @version $Rev$ @@ -56,15 +56,15 @@ private HtmlEditorPane instructionsEditorPane; - private JPanel investTokensPanel = null; + private JPanel tokenInvestmentPanel; - private JPanel graphPanel; + private JPanel contributionInformationPanel; private JTextField investedTokensTextField; private JButton submitTokensButton; - private InfrastructureEfficiencyChartPanel infrastructureEfficiencyChartPanel = null; + private InfrastructureEfficiencyChartPanel infrastructureEfficiencyChartPanel; private IrrigationClient client; @@ -84,7 +84,7 @@ private JPanel instructionsPanel; - private int instructionNumber = 1; + private int currentQuizPageNumber = 1; private JPanel submitTokenPanel; @@ -92,59 +92,58 @@ private JScrollPane tokenInstructionsScrollPane; - private JLabel quizMessageLabel; + private int quizzesAnswered = 0; - private int pagesTraversed = 0; - private JPanel pieChartPanel; private TokenInvestmentPieChartPanel pieChart; - private CanalAnimationPanel canalAnimationPanel; +// private CanalAnimationPanel canalAnimationPanel; private CardLayout cardLayout; - private int numberOfGeneralInstructionPages; + private int numberOfQuestionPages; + + private Map<Integer, String> quizPageResponses = new HashMap<Integer, String>(); + public ExperimentGameWindow(IrrigationClient client) { this.client = client; this.clientDataModel = client.getClientDataModel(); - this.numberOfGeneralInstructionPages = getServerConfiguration().getNumberOfGeneralInstructionPages(); + this.numberOfQuestionPages = getServerConfiguration().getNumberOfQuestionPages(); } void initialize() { cardLayout = new CardLayout(); setLayout(cardLayout); - - setInstructions(getGeneralInstructions(0)); - + setInstructions(getServerConfiguration().getWelcomeInstructions()); addToCardLayout(getInstructionsPanel()); // irrigationGamePanel = new IrrigationGamePanel(client); irrigationGamePanel = new MainIrrigationGameWindow(client); addToCardLayout(irrigationGamePanel); - addToCardLayout(getInvestTokensPanel()); + addToCardLayout(getTokenInvestmentPanel()); addToCardLayout(getChatPanel()); - addToCardLayout(getGraphPanel()); + addToCardLayout(getContributionInformationPanel()); } private void addToCardLayout(Component component) { add(component, component.getName()); } - private JPanel getInvestTokensPanel() { - if (investTokensPanel == null) { - investTokensPanel = new JPanel(); - investTokensPanel.setName("Invest tokens panel"); - investTokensPanel.setLayout(new BorderLayout()); + private JPanel getTokenInvestmentPanel() { + if (tokenInvestmentPanel == null) { + tokenInvestmentPanel = new JPanel(); + tokenInvestmentPanel.setName("Token investment panel"); + tokenInvestmentPanel.setLayout(new BorderLayout()); tokenInstructionsEditorPane = createInstructionsEditorPane(); tokenInstructionsScrollPane = new JScrollPane(tokenInstructionsEditorPane); - investTokensPanel.add(tokenInstructionsScrollPane, BorderLayout.CENTER); + tokenInvestmentPanel.add(tokenInstructionsScrollPane, BorderLayout.CENTER); tokenInstructionsEditorPane.setCaretPosition(0); tokenInstructionsEditorPane.repaint(); - investTokensPanel.add(getSubmitTokenPanel(), BorderLayout.SOUTH); - investTokensPanel.setBackground(Color.WHITE); + tokenInvestmentPanel.add(getSubmitTokenPanel(), BorderLayout.SOUTH); + tokenInvestmentPanel.setBackground(Color.WHITE); } - return investTokensPanel; + return tokenInvestmentPanel; } private JPanel getSubmitTokenPanel() { @@ -173,21 +172,17 @@ instructionsPanel.setName("Instructions panel"); instructionsPanel.setLayout(new BorderLayout()); instructionsPanel.add(getInstructionsScrollPane(), BorderLayout.CENTER); - instructionsPanel.add(getInstructionsNavigationPanel(), BorderLayout.PAGE_END); + instructionsPanel.add(getQuizNavigationPanel(), BorderLayout.PAGE_END); } return instructionsPanel; } - private JPanel getInstructionsNavigationPanel() { + private JPanel getQuizNavigationPanel() { if (instructionsNavigationPanel == null) { instructionsNavigationPanel = new JPanel(); instructionsNavigationPanel.setLayout(new BorderLayout()); instructionsNavigationPanel.add(getPreviousButton(), BorderLayout.LINE_START); instructionsNavigationPanel.add(getNextButton(), BorderLayout.LINE_END); - // displays quiz messages (correct/incorrect answer). - quizMessageLabel = new JLabel(); - quizMessageLabel.setHorizontalAlignment(JLabel.CENTER); - instructionsNavigationPanel.add(quizMessageLabel, BorderLayout.CENTER); } return instructionsNavigationPanel; } @@ -199,25 +194,13 @@ previousButton.setEnabled(false); previousButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - quizMessageLabel.setText(""); // getting the next instruction Number - if (instructionNumber > 1) { - instructionNumber--; + if (currentQuizPageNumber > 1) { + currentQuizPageNumber--; + setInstructions(getQuizPage()); } - previousButton.setEnabled(instructionNumber > 1); + previousButton.setEnabled(currentQuizPageNumber > 1); nextButton.setEnabled(true); - setInstructions(getGeneralInstructions(instructionNumber,pagesTraversed)); - // FIXME: get rid of hardcoded animation on page 5. Should instead - // just be an animated gif or something more like - // if instructions.hasAnimation() - if (instructionNumber == 5) { - getInstructionsPanel().add(getCanalAnimationPanel(), BorderLayout.PAGE_START); - } - else { - - getInstructionsPanel().remove(getCanalAnimationPanel()); - } - getInstructionsPanel().revalidate(); } }); } @@ -231,22 +214,14 @@ nextButton.setEnabled(false); nextButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - quizMessageLabel.setText(""); previousButton.setEnabled(true); - if (instructionNumber >= pagesTraversed){ + if (currentQuizPageNumber >= quizzesAnswered){ nextButton.setEnabled(false); } - if (instructionNumber < numberOfGeneralInstructionPages) { - instructionNumber++; - setInstructions(getGeneralInstructions(instructionNumber,pagesTraversed)); + if (currentQuizPageNumber < numberOfQuestionPages) { + currentQuizPageNumber++; + setInstructions(getQuizPage()); } - if(instructionNumber == 5) { - getInstructionsPanel().add(getCanalAnimationPanel(), BorderLayout.PAGE_START); - } - else { - getInstructionsPanel().remove(getCanalAnimationPanel()); - } - getInstructionsPanel().revalidate(); } }); @@ -254,26 +229,21 @@ return nextButton; } - private CanalAnimationPanel getCanalAnimationPanel() { - if (canalAnimationPanel == null) { - canalAnimationPanel = new CanalAnimationPanel(40); - } - return canalAnimationPanel; - } +// private CanalAnimationPanel getCanalAnimationPanel() { +// if (canalAnimationPanel == null) { +// canalAnimationPanel = new CanalAnimationPanel(40); +// } +// return canalAnimationPanel; +// } - /** - * This returns the string of general instructions from the irrigation.xml file - * where the general instructions are stored - * @param pagesTraversed - * - * @return - */ - private String getGeneralInstructions(int pageNumber, int pagesTraversed) { - return getServerConfiguration().getGeneralInstructions(pageNumber, pagesTraversed, clientDataModel.getPriority()); - } - private String getGeneralInstructions(int pageNumber) { - return getServerConfiguration().getGeneralInstructions(pageNumber); + private String getQuizPage() { + StringBuilder builder = new StringBuilder(getServerConfiguration().getQuizPage(currentQuizPageNumber)); + String quizPageResponse = quizPageResponses.get(currentQuizPageNumber); + if (quizPageResponse != null) { + builder.append(quizPageResponse); + } + return builder.toString(); } private ServerConfiguration getServerConfiguration() { @@ -356,19 +326,15 @@ private void addCenterComponent(Component newCenterComponent) { cardLayout.show(this, newCenterComponent.getName()); revalidate(); - repaint(); } public void startRound(final RoundConfiguration configuration) { - Runnable runnable = new Runnable() { + SwingUtilities.invokeLater(new Runnable() { public void run() { - getCanalAnimationPanel().stopTimer(); - disableInstructions(); addCenterComponent(irrigationGamePanel); irrigationGamePanel.startRound(); } - }; - SwingUtilities.invokeLater(runnable); + }); } public void update() { @@ -445,64 +411,69 @@ private void setInstructions(final String instructions) { SwingUtilities.invokeLater(new Runnable() { public void run() { - getInstructionsEditorPane().setText(instructions); - getInstructionsEditorPane().setCaretPosition(0); + instructionsEditorPane.setText(instructions); + instructionsEditorPane.setCaretPosition(0); + addCenterComponent(getInstructionsPanel()); getInstructionsScrollPane().revalidate(); } }); } - + private ActionListener createQuizListener(final ServerConfiguration configuration) { return new ActionListener() { private Map<String, String> quizAnswers = configuration.getQuizAnswers(); - public void actionPerformed(ActionEvent e){ + public synchronized void actionPerformed(ActionEvent e) { + if (quizPageResponses.containsKey(currentQuizPageNumber)) { + // this form has already been submit. + // FIXME: report to user? + return; + } FormActionEvent formEvent = (FormActionEvent) e; Properties responses = formEvent.getData(); List<String> incorrectAnswers = new ArrayList<String>(); responses.list(System.err); + StringBuilder builder = new StringBuilder(); + TreeMap<String, String> sortedResponses = new TreeMap<String, String>(); + // sort responses so we can put them in order. for (Map.Entry<Object, Object> entry : responses.entrySet()) { + sortedResponses.put((String) entry.getKey(), (String) entry.getValue()); + } + + builder.append("<h3>Results</h3>"); + for (Map.Entry<String, String> entry : sortedResponses.entrySet()) { String questionNumber = (String) entry.getKey(); if (questionNumber.charAt(0) == 'q') { + String number = questionNumber.substring(1, questionNumber.length()); String response = (String) entry.getValue(); String correctAnswer = quizAnswers.get(questionNumber); + builder.append(String.format("<p><b>Question %s</b><br/>", number)); + String color = "blue"; if (! response.equals(correctAnswer)) { incorrectAnswers.add(questionNumber); + color = "red"; } + builder.append(String.format("Your answer: <font color='%s'>%s</font><br/>", color, response)); + builder.append(String.format("Correct answer: %s<br/>", correctAnswer)); + builder.append(quizAnswers.get( "qDescriptiveAnswer" + number )).append("</p>"); } + else { + System.err.println("weird stuff in form data: " + questionNumber + ":" + entry.getValue()); + } } - printIncorrectAnswerList(incorrectAnswers); - if (incorrectAnswers.isEmpty()) { + quizPageResponses.put(currentQuizPageNumber, builder.toString()); + // no matter what we move on to the next question page + // tell them what was right and what was wrong. + if (currentQuizPageNumber < numberOfQuestionPages) { nextButton.setEnabled(true); - pagesTraversed++; - //System.out.println("quiz :instruction number : "+instructionNumber+" pages traversed"+pagesTraversed); - setInstructions(getGeneralInstructions(instructionNumber,pagesTraversed)); - addCenterComponent(getInstructionsPanel()); - quizMessageLabel.setForeground(Color.BLUE); - quizMessageLabel.setText("You answered the question(s) correctly. Please continue to the next page by clicking 'Next'"); - // notify the server and also notify the participant. - //StringBuilder builder = new StringBuilder(configuration.getInstructions()); - //builder.append("<br><b>Congratulations!</b> You have answered all questions correctly."); - //setInstructions(builder.toString()); - client.transmit(new QuizCompletedEvent(client.getId(),instructionNumber)); } - else { - nextButton.setEnabled(false); - quizMessageLabel.setForeground(Color.RED); - quizMessageLabel.setText("You did not answer the question(s) correctly. Please try again."); - } + quizzesAnswered++; + client.transmit(new QuizResponseEvent(client.getId(), currentQuizPageNumber, responses, incorrectAnswers)); } - - private void printIncorrectAnswerList(List<String> incorrectAnswers) { - System.out.println("Size of the incorrect answers is :"+incorrectAnswers.size()); - for(int i=0;i<incorrectAnswers.size();i++){ - System.out.println("Incorrect Answers :"+incorrectAnswers.get(i)); - } - } }; } - public void displayTokenContributions(final ClientData clientData) { + public void displayContributionInformation(final ClientData clientData) { GroupDataModel groupDataModel = clientData.getGroupDataModel(); int totalContributedTokens = groupDataModel.getTotalContributedTokens(); final StringBuilder builder = new StringBuilder(); @@ -527,25 +498,24 @@ contributionInformationTextArea.setText(builder.toString()); infrastructureEfficiencyChartPanel.initialize(); pieChart.setClientData(clientData); - addCenterComponent(getGraphPanel()); + addCenterComponent(getContributionInformationPanel()); } }); irrigationGamePanel.setClientDataModel(clientDataModel); } - public JPanel getGraphPanel() { - if (graphPanel == null) { - graphPanel = new JPanel(); - graphPanel.setName("Graph panel"); - graphPanel.setLayout(new BoxLayout(graphPanel, BoxLayout.Y_AXIS)); - graphPanel.add(getPieChartPanel()); - graphPanel.add(Box.createVerticalStrut(15)); + public JPanel getContributionInformationPanel() { + if (contributionInformationPanel == null) { + contributionInformationPanel = new JPanel(); + contributionInformationPanel.setName("Graph panel"); + contributionInformationPanel.setLayout(new BoxLayout(contributionInformationPanel, BoxLayout.Y_AXIS)); + contributionInformationPanel.add(getPieChartPanel()); + contributionInformationPanel.add(Box.createVerticalStrut(15)); contributionInformationTextArea = new JTextArea(); contributionInformationTextArea.setEditable(false); - - graphPanel.add(contributionInformationTextArea); + contributionInformationPanel.add(contributionInformationTextArea); } - return graphPanel; + return contributionInformationPanel; } private JPanel getPieChartPanel() { @@ -564,19 +534,19 @@ } - public void updateTokenInstructionsPanel() { + public void showTokenInvestmentScreen() { Runnable runnable = new Runnable() { public void run() { GroupDataModel group = clientDataModel.getGroupDataModel(); RoundConfiguration roundConfiguration = clientDataModel.getRoundConfiguration(); int infrastructureEfficiency = 0; - if (roundConfiguration.isPracticeRound() || roundConfiguration.isFirstRound()) { + if (roundConfiguration.shouldResetInfrastructureEfficiency()) { infrastructureEfficiency = roundConfiguration.getInitialInfrastructureEfficiency(); } else { infrastructureEfficiency = group.getInfrastructureEfficiency() - roundConfiguration.getInfrastructureDegradationFactor(); } - addCenterComponent(getInvestTokensPanel()); + addCenterComponent(getTokenInvestmentPanel()); StringBuilder builder = new StringBuilder(); builder.append( String.format( @@ -594,16 +564,11 @@ } public void updateRoundInstructions(RoundConfiguration roundConfiguration) { - info("Updating round instructions: " + roundConfiguration.getInstructions()); - // if this is the first round, show the general instructions. - if (roundConfiguration.isFirstRound()) { - - } - else { + if (! roundConfiguration.isFirstRound()) { instructionsBuilder.append(roundConfiguration.getInstructions()); instructionsBuilder.append("<hr/>"); int irrigationCapacity = clientDataModel.getGroupDataModel().getIrrigationCapacity(); - int clientCapacity = roundConfiguration.getMaximumClientFlowCapacity(); +// int clientCapacity = roundConfiguration.getMaximumClientFlowCapacity(); if (roundConfiguration.shouldResetInfrastructureEfficiency()) { instructionsBuilder.append("The irrigation infrastructure efficiency is currently 75%."); } @@ -619,7 +584,6 @@ } setInstructions(instructionsBuilder.toString()); } - addCenterComponent(getInstructionsPanel()); } private ChatPanel getChatPanel() { @@ -650,7 +614,7 @@ public void actionPerformed(ActionEvent event) { final long timeRemaining = endTime - System.currentTimeMillis(); if (timeRemaining < 0) { - updateTokenInstructionsPanel(); + showTokenInvestmentScreen(); getInvestedTokensTextField().requestFocusInWindow(); timer.stop(); timer = null; @@ -664,13 +628,37 @@ } } - private void disableInstructions() { - quizMessageLabel.setText(""); - getInstructionsPanel().remove(getInstructionsNavigationPanel()); + public void showQuiz() { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + getInstructionsPanel().add(getQuizNavigationPanel(), BorderLayout.PAGE_END); + getInstructionsPanel().revalidate(); + } + }); + setInstructions(getQuizPage()); } + + /** + * Should only be invoked when the instructions navigation panel is done. + * How do we know when it's done? When the user adds a new + */ + public void disableQuiz() { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + getInstructionsPanel().remove(getQuizNavigationPanel()); + getInstructionsPanel().revalidate(); + } + }); + } + + public void showGameScreenshot() { + setInstructions(getServerConfiguration().getGameScreenshotInstructions()); + } - public void enableInstructions() { - setInstructions(getGeneralInstructions(1,pagesTraversed)); - addCenterComponent(getInstructionsPanel()); + /** + * Invoked when the show instructions button is pressed. + */ + public void showInstructions() { + setInstructions(getServerConfiguration().getInitialInstructions()); } } Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java 2009-11-12 22:22:15 UTC (rev 357) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java 2009-11-13 00:23:33 UTC (rev 358) @@ -15,7 +15,6 @@ import edu.asu.commons.irrigation.events.BeginChatRoundRequest; import edu.asu.commons.irrigation.events.ClientUpdateEvent; import edu.asu.commons.irrigation.events.CloseGateEvent; -import edu.asu.commons.irrigation.events.DisplaySubmitTokenRequest; import edu.asu.commons.irrigation.events.EndRoundEvent; import edu.asu.commons.irrigation.events.InfrastructureUpdateEvent; import edu.asu.commons.irrigation.events.InvestedTokensEvent; @@ -23,7 +22,10 @@ import edu.asu.commons.irrigation.events.PauseRequest; import edu.asu.commons.irrigation.events.RegistrationEvent; import edu.asu.commons.irrigation.events.RoundStartedEvent; +import edu.asu.commons.irrigation.events.ShowGameScreenshotRequest; import edu.asu.commons.irrigation.events.ShowInstructionsRequest; +import edu.asu.commons.irrigation.events.ShowQuizRequest; +import edu.asu.commons.irrigation.events.ShowTokenInvestmentScreenRequest; import edu.asu.commons.net.ClientDispatcher; import edu.asu.commons.net.DispatcherFactory; import edu.asu.commons.net.Identifier; @@ -169,7 +171,7 @@ public void handle(InfrastructureUpdateEvent event) { System.err.println("Received group update event: " + event); clientDataModel.setGroupDataModel(event.getGroupDataModel()); - experimentGameWindow.displayTokenContributions(event.getClientData()); + experimentGameWindow.displayContributionInformation(event.getClientData()); } }); channel.add(this, new EventTypeProcessor<RoundStartedEvent>(RoundStartedEvent.class) { @@ -191,9 +193,9 @@ experimentGameWindow.update(); } }); - channel.add(this, new EventTypeProcessor<DisplaySubmitTokenRequest>(DisplaySubmitTokenRequest.class) { - public void handle(DisplaySubmitTokenRequest request) { - experimentGameWindow.updateTokenInstructionsPanel(); + channel.add(this, new EventTypeProcessor<ShowTokenInvestmentScreenRequest>(ShowTokenInvestmentScreenRequest.class) { + public void handle(ShowTokenInvestmentScreenRequest request) { + experimentGameWindow.showTokenInvestmentScreen(); } }); channel.add(this, new EventTypeProcessor<BeginChatRoundRequest>(BeginChatRoundRequest.class) { @@ -204,9 +206,19 @@ }); channel.add(this, new EventTypeProcessor<ShowInstructionsRequest>(ShowInstructionsRequest.class) { public void handle(ShowInstructionsRequest request) { - experimentGameWindow.enableInstructions(); + experimentGameWindow.showInstructions(); } }); + channel.add(this, new EventTypeProcessor<ShowQuizRequest>(ShowQuizRequest.class) { + public void handle(ShowQuizRequest request) { + experimentGameWindow.showQuiz(); + } + }); + channel.add(this, new EventTypeProcessor<ShowGameScreenshotRequest>(ShowGameScreenshotRequest.class) { + public void handle(ShowGameScreenshotRequest request) { + experimentGameWindow.showGameScreenshot(); + } + }); } public ClientDataModel getClientDataModel() { Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java 2009-11-12 22:22:15 UTC (rev 357) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java 2009-11-13 00:23:33 UTC (rev 358) @@ -122,8 +122,8 @@ } public Map<String, String> getQuizAnswers() { - Properties properties = getProperties(); if (isQuizEnabled()) { + Properties properties = getProperties(); Map<String, String> answers = new HashMap<String, String>(); for (int i = 1; properties.containsKey("q" + i); i++) { String key = "q" + i; Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java 2009-11-12 22:22:15 UTC (rev 357) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java 2009-11-13 00:23:33 UTC (rev 358) @@ -64,41 +64,6 @@ return CONFIGURATION_FILE_NAME; } - /** - * Returns the appropriate general instructions text, performing logic for adding - * positions and quizzes. - * - * @param instructionPageNumber - * @param pagesTraversed - * @return - */ - public String getGeneralInstructions( - int instructionPageNumber, - int pagesTraversed, - int clientPosition) - { - // FIXME: get rid of hard coded instruction page constants. - if (instructionPageNumber < 11) { - StringBuilder builder = new StringBuilder(); - if (instructionPageNumber == 4) { - builder.append("Your position: ").append(toPriorityString(clientPosition)); - } - builder.append(getGeneralInstructions(instructionPageNumber)); -// if (isUndisruptedFlowRequired()) { -// builder.append(getUndisruptedFlowInstructions()); -// } - // if the current instruction page number is greater than the number of pages traversed, then - // we need to render the quizzes. Otherwise, we don't. - if (instructionPageNumber > pagesTraversed) { - builder.append( getQuizQuestion(instructionPageNumber) ); - } - return builder.toString(); - } - else { - return getGeneralInstructions(instructionPageNumber); - } - } - private final static String[] PRIORITY_STRINGS = { "A", "B", "C", "D", "E" }; public String toPriorityString(int clientPriority) { @@ -124,6 +89,10 @@ public String getInitialInstructions() { return assistant.getProperty("initial-instructions"); } + + public String getWelcomeInstructions() { + return assistant.getProperty("welcome-instructions"); + } public Map<String, String> getQuizAnswers() { Properties properties = assistant.getProperties(); @@ -132,6 +101,9 @@ String key = "q" + i; String answer = properties.getProperty(key); answers.put(key, answer); + String quizDescriptiveAnswerKey = "qDescriptiveAnswer" + i; + String quizDescriptiveAnswer = properties.getProperty(quizDescriptiveAnswerKey); + answers.put(quizDescriptiveAnswerKey, quizDescriptiveAnswer); } return answers; } @@ -140,10 +112,8 @@ return assistant.getProperty("general-instructionsq" + pageNumber); } - public String getGeneralInstructions(int pageNumber) { - return assistant.getProperty( - "general-instructions"+pageNumber, - "<b>No instructions available for this round</b>"); + public String getQuizPage(int pageNumber) { + return assistant.getProperty("quiz-page"+pageNumber); } public String getWaterCollectedToTokensTable() { @@ -158,8 +128,8 @@ return assistant.getProperty("investment-instructions"); } - public int getNumberOfGeneralInstructionPages() { - return assistant.getIntProperty("general-instruction-pages", 8); + public int getNumberOfQuestionPages() { + return assistant.getIntProperty("question-pages", 8); } public int getChatDuration() { @@ -179,4 +149,8 @@ ); } + public String getGameScreenshotInstructions() { + return assistant.getProperty("game-screenshot-instructions"); + } + } Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/CloseGateEvent.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/CloseGateEvent.java 2009-11-12 22:22:15 UTC (rev 357) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/CloseGateEvent.java 2009-11-13 00:23:33 UTC (rev 358) @@ -1,12 +1,16 @@ package edu.asu.commons.irrigation.events; +import edu.asu.commons.event.AbstractPersistableEvent; import edu.asu.commons.net.Identifier; /** - * @author Sanket + * $Id$ + * * + * @author <a href='mailto:All...@as...'>Allen Lee</a> + * @version $Rev$ */ -public class CloseGateEvent extends TransferFileInformationEvent { +public class CloseGateEvent extends AbstractPersistableEvent { private static final long serialVersionUID = -6932559955912875464L; Deleted: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/DisplaySubmitTokenRequest.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/DisplaySubmitTokenRequest.java 2009-11-12 22:22:15 UTC (rev 357) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/DisplaySubmitTokenRequest.java 2009-11-13 00:23:33 UTC (rev 358) @@ -1,14 +0,0 @@ -package edu.asu.commons.irrigation.events; - -import edu.asu.commons.event.AbstractEvent; -import edu.asu.commons.event.FacilitatorRequest; -import edu.asu.commons.net.Identifier; - -public class DisplaySubmitTokenRequest extends AbstractEvent implements FacilitatorRequest { - - private static final long serialVersionUID = -4133284727930840712L; - - public DisplaySubmitTokenRequest(Identifier id) { - super(id); - } -} Deleted: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ExperimentDurationEvent.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ExperimentDurationEvent.java 2009-11-12 22:22:15 UTC (rev 357) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ExperimentDurationEvent.java 2009-11-13 00:23:33 UTC (rev 358) @@ -1,28 +0,0 @@ -package edu.asu.commons.irrigation.events; - -import edu.asu.commons.event.AbstractEvent; -import edu.asu.commons.event.ExperimentUpdateEvent; -import edu.asu.commons.net.Identifier; - -/** - * @author Sanket - * - */ -public class ExperimentDurationEvent extends AbstractEvent implements ExperimentUpdateEvent { - - private static final long serialVersionUID = 5074385986630790547L; - - private final long time; - - public ExperimentDurationEvent(Identifier id,long time) { - super(id); - this.time = time; - } - - public long getTime(){ - return time; - } - - - -} Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/FacilitatorEndRoundEvent.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/FacilitatorEndRoundEvent.java 2009-11-12 22:22:15 UTC (rev 357) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/FacilitatorEndRoundEvent.java 2009-11-13 00:23:33 UTC (rev 358) @@ -5,8 +5,11 @@ import edu.asu.commons.net.Identifier; /** + * $Id$ + * + * Updates the facilitator with the end of the round information (used to build the debriefing). + * * @author Sanket - * */ public class FacilitatorEndRoundEvent extends AbstractEvent { @@ -23,7 +26,7 @@ } public boolean isLastRound(){ - return serverDataModel.getRoundConfiguration().getParentConfiguration().isLastRound(); + return serverDataModel.getRoundConfiguration().isLastRound(); } } Deleted: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/FileDownloadCompleteEvent.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/FileDownloadCompleteEvent.java 2009-11-12 22:22:15 UTC (rev 357) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/FileDownloadCompleteEvent.java 2009-11-13 00:23:33 UTC (rev 358) @@ -1,20 +0,0 @@ -package edu.asu.commons.irrigation.events; - -import edu.asu.commons.event.AbstractEvent; -import edu.asu.commons.net.Identifier; - -/** - * @author Sanket - * - */ -public class FileDownloadCompleteEvent extends AbstractEvent { - - private static final long serialVersionUID = 2566276891605754835L; - - public FileDownloadCompleteEvent(Identifier id) { - super(id); - } - - - -} Deleted: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/FileDownloadedEvent.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/FileDownloadedEvent.java 2009-11-12 22:22:15 UTC (rev 357) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/FileDownloadedEvent.java 2009-11-13 00:23:33 UTC (rev 358) @@ -1,23 +0,0 @@ -package edu.asu.commons.irrigation.events; - -import edu.asu.commons.event.AbstractPersistableEvent; -import edu.asu.commons.net.Identifier; - - - -public class FileDownloadedEvent extends AbstractPersistableEvent { - - private static final long serialVersionUID = 1061602349717830635L; - - private final String fileNumber; - - public FileDownloadedEvent(Identifier id, String fileNumber) { - super(id); - this.fileNumber = fileNumber; - } - - public String getFileNumber() { - return fileNumber; - } - -} Deleted: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/QuizCompletedEvent.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/QuizCompletedEvent.java 2009-11-12 22:22:15 UTC (rev 357) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/QuizCompletedEvent.java 2009-11-13 00:23:33 UTC (rev 358) @@ -1,31 +0,0 @@ -/** - * - */ -package edu.asu.commons.irrigation.events; - -import edu.asu.commons.event.AbstractEvent; -import edu.asu.commons.net.Identifier; - -/** - * @author Sanket - * - */ -public class QuizCompletedEvent extends AbstractEvent { - - /** - * - */ - private static final long serialVersionUID = -7081410122722056083L; - - private int instructionNumber = 0; - - public QuizCompletedEvent(Identifier id,int instructionNumber){ - super(id); - this.instructionNumber = instructionNumber; - } - - public int getInstructionNumber(){ - return instructionNumber; - } - -} Copied: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/QuizResponseEvent.java (from rev 356, irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/QuizCompletedEvent.java) =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/QuizResponseEvent.java (rev 0) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/QuizResponseEvent.java 2009-11-13 00:23:33 UTC (rev 358) @@ -0,0 +1,47 @@ +package edu.asu.commons.irrigation.events; + +import java.util.List; +import java.util.Properties; + +import edu.asu.commons.event.AbstractPersistableEvent; +import edu.asu.commons.event.ClientRequest; +import edu.asu.commons.net.Identifier; + +/** + * $Id$ + * + * A client's quiz responses for a given quiz page. + * + * + * @author <a href='mailto:All...@as...'>Allen Lee</a> + * @version $Rev$ + */ +public class QuizResponseEvent extends AbstractPersistableEvent implements ClientRequest { + + private static final long serialVersionUID = -7081410122722056083L; + + private int quizPage; + + private Properties responses; + + private List<String> incorrectAnswers; + + public QuizResponseEvent(Identifier id, int quizPage, Properties responses, List<String> incorrectAnswers) { + super(id); + this.quizPage = quizPage; + this.responses = responses; + this.incorrectAnswers = incorrectAnswers; + } + + public int getQuizPage(){ + return quizPage; + } + + public Properties getResponses() { + return responses; + } + + public List<String> getIncorrectAnswers() { + return incorrectAnswers; + } +} Deleted: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ServerGameStateEvent.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ServerGameStateEvent.java 2009-11-12 22:22:15 UTC (rev 357) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ServerGameStateEvent.java 2009-11-13 00:23:33 UTC (rev 358) @@ -1,35 +0,0 @@ -package edu.asu.commons.irrigation.events; - - -import edu.asu.commons.event.AbstractEvent; -import edu.asu.commons.irrigation.server.ServerDataModel; -import edu.asu.commons.net.Identifier; - -/** - * @author Sanket - * - */ -public class ServerGameStateEvent extends AbstractEvent { - /** - * - */ - private static final long serialVersionUID = 6430739901754414073L; - - private ServerDataModel serverGameState; - - private long timeLeft; - - public ServerGameStateEvent(Identifier id, ServerDataModel serverGameState, long timeLeft) { - super(id); - this.serverGameState = serverGameState; - this.timeLeft = timeLeft; - } - - public ServerDataModel getServerGameState(){ - return serverGameState; - } - - public long getTimeLeft(){ - return timeLeft; - } -} Added: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ShowGameScreenshotRequest.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ShowGameScreenshotRequest.java (rev 0) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ShowGameScreenshotRequest.java 2009-11-13 00:23:33 UTC (rev 358) @@ -0,0 +1,15 @@ +package edu.asu.commons.irrigation.events; + +import edu.asu.commons.event.AbstractEvent; +import edu.asu.commons.event.FacilitatorRequest; +import edu.asu.commons.net.Identifier; + +public class ShowGameScreenshotRequest extends AbstractEvent implements FacilitatorRequest { + + private static final long serialVersionUID = -344715300306788401L; + + public ShowGameScreenshotRequest(Identifier id) { + super(id); + } + +} Added: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ShowQuizRequest.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ShowQuizRequest.java (rev 0) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ShowQuizRequest.java 2009-11-13 00:23:33 UTC (rev 358) @@ -0,0 +1,23 @@ +package edu.asu.commons.irrigation.events; + +import edu.asu.commons.event.AbstractEvent; +import edu.asu.commons.event.FacilitatorRequest; +import edu.asu.commons.net.Identifier; + +/** + * $Id$ + * + * Facilitator request to display the quiz. + * + * @author <a href='mailto:All...@as...'>Allen Lee</a> + * @version $Rev$ + */ +public class ShowQuizRequest extends AbstractEvent implements FacilitatorRequest { + + private static final long serialVersionUID = 383560843031641044L; + + public ShowQuizRequest(Identifier id) { + super(id); + } + +} Copied: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ShowTokenInvestmentScreenRequest.java (from rev 356, irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/DisplaySubmitTokenRequest.java) =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ShowTokenInvestmentScreenRequest.java (rev 0) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/ShowTokenInvestmentScreenRequest.java 2009-11-13 00:23:33 UTC (rev 358) @@ -0,0 +1,14 @@ +package edu.asu.commons.irrigation.events; + +import edu.asu.commons.event.AbstractEvent; +import edu.asu.commons.event.FacilitatorRequest; +import edu.asu.commons.net.Identifier; + +public class ShowTokenInvestmentScreenRequest extends AbstractEvent implements FacilitatorRequest { + + private static final long serialVersionUID = -4133284727930840712L; + + public ShowTokenInvestmentScreenRequest(Identifier id) { + super(id); + } +} Deleted: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/StartDownload.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/StartDownload.java 2009-11-12 22:22:15 UTC (rev 357) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/StartDownload.java 2009-11-13 00:23:33 UTC (rev 358) @@ -1,29 +0,0 @@ -package edu.asu.commons.irrigation.events; - -import edu.asu.commons.event.AbstractEvent; -import edu.asu.commons.net.Identifier; - -/** - * @author Sanket - * - */ -public class StartDownload extends AbstractEvent { - - private static final long serialVersionUID = 2790726104971226910L; - private int fileSelected; - - public StartDownload(Identifier id) { - super(id); - } - - public void setFileSelected(int fileSelected){ - this.fileSelected = fileSelected; - } - - public int getFileSelected() { - return fileSelected; - } - - - -} Deleted: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/TransferFileInformationEvent.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/TransferFileInformationEvent.java 2009-11-12 22:22:15 UTC (rev 357) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/TransferFileInformationEvent.java 2009-11-13 00:23:33 UTC (rev 358) @@ -1,32 +0,0 @@ -/** - * - */ -package edu.asu.commons.irrigation.events; - - -import edu.asu.commons.event.AbstractPersistableEvent; -import edu.asu.commons.net.Identifier; - -/** -* @author Sanket -* -*/ -public abstract class TransferFileInformationEvent extends AbstractPersistableEvent { - - private static final long serialVersionUID = -5241129364032790383L; - - private String fileNumber; - - public TransferFileInformationEvent(Identifier id) { - super(id); - } - - public void setFileNumber(String fileNumber) { - this.fileNumber = fileNumber; - } - - public String getFileNumber(){ - return fileNumber; - } - -} Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/FacilitatorWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/FacilitatorWindow.java 2009-11-12 22:22:15 UTC (rev 357) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/facilitator/FacilitatorWindow.java 2009-11-13 00:23:33 UTC (rev 358) @@ -14,7 +14,7 @@ import javax.swing.SwingUtilities; import edu.asu.commons.irrigation.events.BeginChatRoundRequest; -import edu.asu.commons.irrigation.events.DisplaySubmitTokenRequest; +import edu.asu.commons.irrigation.events.ShowTokenInvestmentScreenRequest; import edu.asu.commons.irrigation.events.FacilitatorEndRoundEvent; import edu.asu.commons.irrigation.events.ShowInstructionsRequest; import edu.asu.commons.irrigation.server.ClientData; @@ -133,7 +133,7 @@ displayInvestmentButton = new JButton("Show Investment Screen"); displayInvestmentButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { - facilitator.transmit(new DisplaySubmitTokenRequest(facilitator.getId())); + facilitator.transmit(new ShowTokenInvestmentScreenRequest(facilitator.getId())); } }); } Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/ClientData.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/ClientData.java 2009-11-12 22:22:15 UTC (rev 357) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/ClientData.java 2009-11-13 00:23:33 UTC (rev 358) @@ -74,6 +74,7 @@ return getAssignedNumber() - 1; } + // FIXME: logic duplicated with ServerConfiguration.toPriorityString(int priority); private final static String[] PRIORITY_STRINGS = { "A", "B", "C", "D", "E" }; public String getPriorityString() { Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java 2009-11-12 22:22:15 UTC (rev 357) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java 2009-11-13 00:23:33 UTC (rev 358) @@ -21,14 +21,14 @@ import edu.asu.commons.irrigation.events.BeginChatRoundRequest; import edu.asu.commons.irrigation.events.ClientUpdateEvent; import edu.asu.commons.irrigation.events.CloseGateEvent; -import edu.asu.commons.irrigation.events.DisplaySubmitTokenRequest; +import edu.asu.commons.irrigation.events.ShowTokenInvestmentScreenRequest; import edu.asu.commons.irrigation.events.EndRoundEvent; import edu.asu.commons.irrigation.events.FacilitatorEndRoundEvent; import edu.asu.commons.irrigation.events.InfrastructureUpdateEvent; import edu.asu.commons.irrigation.events.InvestedTokensEvent; import edu.asu.commons.irrigation.events.OpenGateEvent; import edu.asu.commons.irrigation.events.PauseRequest; -import edu.asu.commons.irrigation.events.QuizCompletedEvent; +import edu.asu.commons.irrigation.events.QuizResponseEvent; import edu.asu.commons.irrigation.events.RegistrationEvent; import edu.asu.commons.irrigation.events.RoundStartedEvent; import edu.asu.commons.irrigation.events.ShowInstructionsRequest; @@ -157,12 +157,12 @@ } } }); - addEventProcessor(new EventTypeProcessor<DisplaySubmitTokenRequest>(DisplaySubmitTokenRequest.class) { + addEventProcessor(new EventTypeProcessor<ShowTokenInvestmentScreenRequest>(ShowTokenInvestmentScreenRequest.class) { @Override - public void handle(DisplaySubmitTokenRequest request) { + public void handle(ShowTokenInvestmentScreenRequest request) { synchronized (clients) { for (Identifier id: clients.keySet()) { - transmit(new DisplaySubmitTokenRequest(id)); + transmit(new ShowTokenInvestmentScreenRequest(id)); } } } @@ -239,9 +239,9 @@ } } }); - addEventProcessor(new EventTypeProcessor<QuizCompletedEvent>(QuizCompletedEvent.class) { + addEventProcessor(new EventTypeProcessor<QuizResponseEvent>(QuizResponseEvent.class) { @Override - public void handle(QuizCompletedEvent event) { + public void handle(QuizResponseEvent event) { numberOfCompletedQuizzes++; getLogger().info("Completed quizzes: " + numberOfCompletedQuizzes); if(numberOfCompletedQuizzes == clients.size()*8){ Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/irrigation.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/irrigation.xml 2009-11-12 22:22:15 UTC (rev 357) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/irrigation.xml 2009-11-13 00:23:33 UTC (rev 358) @@ -2,6 +2,7 @@ <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <comment>Irrigation experiment server configuration</comment> +<!--<entry key="hostname">localhost</entry>--> <entry key="hostname">@SERVER_ADDRESS@</entry> <entry key="port">@PORT_NUMBER@</entry> <entry key="round0">round0.xml</entry> @@ -54,15 +55,113 @@ <entry key="initial-instructions"> <![CDATA[ -<h3>Welcome</h3> <p> -Please be patient while the experimental environment is set up. -<b>Please do not close this window or open any other windows.</b> +You have already earned 5 dollars by showing up for this exercise. You can earn +more, up to an extra 25 dollars. You will participate in this exercise as a part of +a group of five participants. Your group has been formed by randomly assigning you +to FOUR other participants in the room. </p> +<p> +The amount of money you earn will depend on the decisions made by you and the other +members of your group. This exercise mimics decisions people make in irrigation +systems. In each round you will receive 10 tokens which you can invest in the +irrigation infrastructure. Given the capacity of the irrigation infrastructure and +the availability of water, you can grow crops. Tokens earned in a round is the sum +of tokens not invested plus tokens earned by growing crops. Each token is worth 5 +cents. In each round you will first make a decision as to how much to invest in the +irrigation infrastructure. Based on the combined contributions of all 5 participants +in your group in each round, your group can maintain the capacity of the irrigation +infrastructure for growing crops. +</p> + +<p> +We will now start a practice round to help illustrate the experiment. Before each +round in this experiment you will have a chat period of 60 seconds where you can +send text messages to the other participants. You may discuss any aspect of the +exercise with two important exceptions: +</p> +<ol> +<li>You are <b>not allowed</b> to promise the other participants +side-payments or threaten them with any consequence after the experiment is +finished. +</li> +<li>You are <b>not allowed to reveal your real identity</b>.</li> +</ol> +<p> +We will be monitoring the chat traffic. If we detect any violation of these rules, +we will have to remove <b>all members of the group where the violation occurred</b> +from the experiment. That group will have to wait until the entire experiment is +finished to receive their payment. +</p> +<p> +You will see a text box appear on your screen when a chat period starts. The amount +of time left in the chat period will be shown at the <b>top left of the screen</b>.<br> +</p> ]]> </entry> +<entry key='game-screenshot-instructions'> +<![CDATA[ +<img src="http://dev.commons.asu.edu/irrigation/images/game-interface-screenshot.jpg"> +<b>Table 2</b>: Earnings resulting from the amount of water applied to your field. + +<table border="1" cellspacing="2" cellpadding="2"> +<thead> +<th>Water units received (cubic feet)</th> +<th>Tokens earned</th> +</thead> +<tr> +<td>< 150</td><td>0</td> +</tr> +<tr> +<td>150-199</td><td>1</td> +</tr> +<tr> +<td>200-249</td><td>4</td> +</tr> +<tr> +<td>250-299</td><td>10</td> +</tr> +<tr> +<td>300-349</td><td>15</td> +</tr> +<tr> +<td>350-399</td><td>18</td> +</tr> +<tr> +<td>400-499</td><td>19</td> +</tr> +<tr> +<td>500-549</td><td>20</td> +</tr> +<tr> +<td>550-649</td><td>19</td> +</tr> +<tr> +<td>650-699</td><td>18</td> +</tr> +<tr> +<td>700-749</td><td>15</td> +</tr> +<tr> +<td>750-799</td><td>10</td> +</tr> +<tr> +<td>800-849</td><td>4</td> +</tr> +<tr> +<td>850-899</td><td>1</td> +</tr> +<tr> +<td>> 899</td><td>0</td> +</tr> +</table> + +]]> +</entry> + + <entry key="facilitator-instructions"> <![CDATA[ <h3>Facilitator Instructions</h3> @@ -80,49 +179,15 @@ -<entry key="general-instructions0"> +<entry key="welcome-instructions"> <![CDATA[ <center><h3>Welcome to the experiment. Please do not close this window or open any other applications.</h3></center> ]]> </entry> -<entry key="general-instructions1"> -<![CDATA[ -<h3>General Instructions</h3> -<p>Welcome. You have already earned 5 dollars by showing up for this exercise. -You can earn more, up to an extra 25 dollars, by participating in the exercise -which will last for about one hour. You will participate in this exercise as a -part of a group. Each group has five participants. Your group has been formed -by randomly assigning you to FOUR other participants in the room. The amount -of money you earn will depend on the decisions made by you and the rest of the -group. That is, your earnings will depend on your decisions as well as the -other members of your group. -</p> -<p> -This exercise mimics decisions people make in irrigation systems. In each round you -will receive 10 tokens which you can choose to keep or invest in the irrigation -infrastructure (for example canals and water diversion structures). Depending on the -state of repair of the irrigation infrastructure, it will be capable of directing -water to your field when you use your water diversion structure (called an -irrigation gate). Depending on the amount of water you can get to your field, you -can grow crops. Depending on the number of crops you grow you earn tokens. Each -token is worth 5 cents and you will be paid cash in private at the end of the -experiment based on the number of tokens you earned. -</p> -<p> -The experiment consists of a number of rounds. In each round you will first make a -decision as to how much to invest in the irrigation infrastructure. Without periodic -investment, the irrigation infrastructure will break down over time. Based on the -combined contributions of all 5 participants in your group in each round, as -explained below, your group can maintain the performance of ... [truncated message content] |
From: <al...@us...> - 2009-11-13 05:32:16
|
Revision: 360 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=360&view=rev Author: alllee Date: 2009-11-13 05:32:07 +0000 (Fri, 13 Nov 2009) Log Message: ----------- updating quiz display / configuration parameters Modified Paths: -------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/irrigation.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round0.xml irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round2.xml Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java 2009-11-13 04:17:26 UTC (rev 359) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java 2009-11-13 05:32:07 UTC (rev 360) @@ -459,8 +459,8 @@ color = "red"; } builder.append(String.format("Your answer: <font color='%s'>%s</font><br/>", color, response)); - builder.append(String.format("Correct answer: %s<br/>", correctAnswer)); - builder.append(quizAnswers.get( "qDescriptiveAnswer" + number )).append("</p>"); + builder.append(String.format("Correct answer: %s<br/>", quizAnswers.get("a" + number))); + builder.append(quizAnswers.get( "explanation" + number )).append("</p>"); } } quizPageResponses.put(currentQuizPageNumber, builder.toString()); Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java 2009-11-13 04:17:26 UTC (rev 359) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java 2009-11-13 05:32:07 UTC (rev 360) @@ -101,7 +101,7 @@ } public boolean shouldResetInfrastructureEfficiency() { - return isPracticeRound() || getBooleanProperty("reset-infrastructure-efficiency", false); + return getBooleanProperty("reset-infrastructure-efficiency", false); } public String getInstructions() { Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java 2009-11-13 04:17:26 UTC (rev 359) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java 2009-11-13 05:32:07 UTC (rev 360) @@ -101,9 +101,11 @@ String key = "q" + i; String answer = properties.getProperty(key); answers.put(key, answer); - String quizDescriptiveAnswerKey = "qDescriptiveAnswer" + i; - String quizDescriptiveAnswer = properties.getProperty(quizDescriptiveAnswerKey); - answers.put(quizDescriptiveAnswerKey, quizDescriptiveAnswer); + String quizExplanationKey = "explanation" + i; + String quizExplanation = properties.getProperty(quizExplanationKey); + answers.put(quizExplanationKey, quizExplanation); + String descriptiveAnswerKey = "a" + i; + answers.put(descriptiveAnswerKey, properties.getProperty(descriptiveAnswerKey)); } return answers; } Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/irrigation.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/irrigation.xml 2009-11-13 04:17:26 UTC (rev 359) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/irrigation.xml 2009-11-13 05:32:07 UTC (rev 360) @@ -26,16 +26,39 @@ <entry key="wait-for-participants">true</entry> <entry key="number-of-rounds">17</entry> -<entry key="q1">4</entry> -<entry key="q2">identity</entry> -<entry key="q3">49</entry> -<entry key="q4">76</entry> -<entry key="q5">20</entry> -<entry key="q6">5</entry> -<entry key="q7">25</entry> -<entry key="q8">7</entry> -<entry key="q9">19</entry> -<entry key="q10">1.50</entry> +<entry key="q1">49</entry> +<entry key="a1">49%</entry> +<entry key="explanation1">An existing infrastructure efficiency of 20% + 29 tokens invested = 49% infrastructure efficiency.</entry> +<entry key="q2">5</entry> +<entry key="a2">5 cubic feet per second</entry> +<entry key="explanation2"> +<![CDATA[ +An existing infrastructure efficiency of 35% + 15 tokens invested = 50% infrastructure efficiency for the current round. +An infrastructure efficiency of 50% corresponds to a water delivery capacity +of 5 cubic feet per second. +]]> +</entry> +<entry key="q3">5</entry> +<entry key='a3'>5 cubic feet per second</entry> +<entry key="explanation3">Since there is only 30 cubic feet per second of water +available, the irrigation infrastructure capacity of 35 cubic feet per +second will not be fully used. When A opens their gate, they take 25 of the +30 cubic feet per second out of the canal, leaving 5 cubic feet per second for +B. +</entry> +<entry key="q4">25</entry> +<entry key="a4">25 cubic feet per second</entry> +<entry key="explanation4">If A has 25 cfps available and does not take any +water, the same amount is available for the people downstream. Since B, C and +D do not take water, 25 cfps is available for E.</entry> +<entry key="q5">7</entry> +<entry key="a5">7 tokens</entry> +<entry key="explanation5">If you invest 7 out of 10 tokens, you keep 3 tokens for yourself. If you apply 202 cubic feet of water to your field you will earn 4 tokens. 3 + 4 = 7 tokens </entry> +<entry key="q6">19</entry> +<entry key="a6">19 tokens</entry> +<entry key="explanation6">If you invest all 10 tokens, you keep 0 tokens from +your initial endowment. If you apply 555 cubic feet of water to your field +you will earn 19 tokens. 0 + 19 = 19 tokens.</entry> <entry key='final-instructions'> <![CDATA[ Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round0.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round0.xml 2009-11-13 04:17:26 UTC (rev 359) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round0.xml 2009-11-13 05:32:07 UTC (rev 360) @@ -4,6 +4,7 @@ <comment>Irrigation experiment round configuration</comment> <entry key="practice-round">true</entry> +<entry key='reset-infrastructure-efficiency'>true</entry> <entry key="instructions"> <![CDATA[ Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round2.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round2.xml 2009-11-13 04:17:26 UTC (rev 359) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round2.xml 2009-11-13 05:32:07 UTC (rev 360) @@ -11,7 +11,7 @@ <p> This is the first actual round of the experiment. Before this round begins you will have the opportunity to text chat with the other participant for -forty seconds, then decide on your level of investment in the irrigation +sixty seconds, then decide on your level of investment in the irrigation infrastructure. After the total irrigation infrastructure investment has been determined you will begin the experiment and make decisions on when to open your irrigation gates and grow crops. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2009-11-13 21:03:05
|
Revision: 363 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=363&view=rev Author: alllee Date: 2009-11-13 21:02:56 +0000 (Fri, 13 Nov 2009) Log Message: ----------- updated configuration instructions, simplifying / cleaning up logic for canal panel Modified Paths: -------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ClientDataModel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/InfrastructureEfficiencyChartPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleScorePanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/irrigation.xml Removed Paths: ------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationGamePanel.java Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java 2009-11-13 15:14:42 UTC (rev 362) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java 2009-11-13 21:02:56 UTC (rev 363) @@ -1,7 +1,6 @@ package edu.asu.commons.irrigation.client; import java.awt.Color; -import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridBagLayout; @@ -60,37 +59,35 @@ super(); //when totalContributed bandwidth = 1.0, you dont see the canal line setClientDataModel(clientDataModel); + initialize(); } public void setClientDataModel(ClientDataModel clientDataModel) { - if (timer != null) { - timer.stop(); - } this.maximumIrrigationCapacity = clientDataModel.getGroupDataModel().getMaximumAvailableWaterFlow(); this.clientDataModel = clientDataModel; - initialize(); } /** - * - * @return void + * */ private void initialize() { - this.setSize(new Dimension(1098,150)); +// this.setSize(new Dimension(1098,150)); setLayout(new GridBagLayout()); - this.setBackground(Color.WHITE); + setBackground(Color.WHITE); //initialize each gate - for(int i=0;i<numberOfGates ;i++){ - gate[i] = new Gate(maximumIrrigationCapacity,i); - } - + initializeGates(); initializeBalls(); - timer = new Timer(DELAY, new Rebound()); // setup the Timer to do an action // every DELAY times. timer.start(); // starts the timer. } + + private void initializeGates() { + for(int i=0;i<numberOfGates ;i++){ + gate[i] = new Gate(maximumIrrigationCapacity,i); + } + } protected void paintComponent(Graphics graphics){ super.paintComponent(graphics); // needed! @@ -201,7 +198,7 @@ } // this is the private class the Timer will look at every DELAY seconds - private class Rebound implements ActionListener{ + private class Rebound implements ActionListener { public void actionPerformed(ActionEvent e) { for(int i=0;i<BALLCOUNT;i++){ //updateGUI(); @@ -413,12 +410,14 @@ gate[priority].setHeight(gate[priority-1].getHeight());*/ repaint(); } + + public void startRound() { + initializeGates(); + timer.start(); + } public void endRound() { - if (timer != null) { - timer.stop(); - } - timer = null; + timer.stop(); closeAllGates(); } Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java 2009-11-13 15:14:42 UTC (rev 362) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java 2009-11-13 21:02:56 UTC (rev 363) @@ -1,6 +1,7 @@ package edu.asu.commons.irrigation.client; import java.awt.BorderLayout; +import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; @@ -96,7 +97,7 @@ private void sendMessage() { String message = chatField.getText(); if (message != null && ! message.isEmpty() && targetIdentifier != null) { - displayMessage(String.format("%s -> %s : ", getChatHandle(getClientId()), getChatHandle(targetIdentifier)), + displayMessage(String.format("%s : ", getChatHandle(getClientId())), message); chatField.setText(""); irrigationClient.transmit(new ChatRequest(getClientId(), message, targetIdentifier)); @@ -147,6 +148,7 @@ setLayout(new BorderLayout(4, 4)); messageWindow = new JTextPane(); messageWindow.setEditable(false); + messageWindow.setBackground(Color.WHITE); messageScrollPane = new JScrollPane(messageWindow); addStylesToMessageWindow(); textEntryPanel = new TextEntryPanel(); @@ -154,6 +156,7 @@ chatInstructionsPane.setContentType("text/html"); chatInstructionsPane.setEditorKit(new HTMLEditorKit()); chatInstructionsPane.setEditable(false); + chatInstructionsPane.setBackground(Color.WHITE); JScrollPane chatInstructionsScrollPane = new JScrollPane(chatInstructionsPane); add(chatInstructionsScrollPane, BorderLayout.PAGE_START); add(messageScrollPane, BorderLayout.CENTER); @@ -198,7 +201,7 @@ public void handle(final ChatEvent chatEvent) { SwingUtilities.invokeLater(new Runnable() { public void run() { - displayMessage(String.format("%s -> %s : ", getChatHandle(chatEvent.getSource()), getChatHandle(chatEvent.getTarget())), + displayMessage(String.format("%s : ", getChatHandle(chatEvent.getSource()), getChatHandle(chatEvent.getTarget())), chatEvent.toString()); } }); Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ClientDataModel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ClientDataModel.java 2009-11-13 15:14:42 UTC (rev 362) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ClientDataModel.java 2009-11-13 21:02:56 UTC (rev 363) @@ -62,7 +62,7 @@ public synchronized void initialize(RoundStartedEvent event) { groupDataModel.clear(); setGroupDataModel(event.getGroupDataModel()); - setTimeLeft( (int) (getRoundConfiguration().getRoundDuration().getDelta() / 1000L) ); + setTimeLeft( getRoundConfiguration().getRoundDurationInSeconds() ); } public int getPriority(){ Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java 2009-11-13 15:14:42 UTC (rev 362) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java 2009-11-13 21:02:56 UTC (rev 363) @@ -136,10 +136,10 @@ tokenInvestmentPanel.setName("Token investment panel"); tokenInvestmentPanel.setLayout(new BorderLayout()); tokenInstructionsEditorPane = createInstructionsEditorPane(); + tokenInstructionsEditorPane.setCaretPosition(0); tokenInstructionsScrollPane = new JScrollPane(tokenInstructionsEditorPane); tokenInvestmentPanel.add(tokenInstructionsScrollPane, BorderLayout.CENTER); - tokenInstructionsEditorPane.setCaretPosition(0); - tokenInstructionsEditorPane.repaint(); + tokenInvestmentPanel.add(getSubmitTokenPanel(), BorderLayout.SOUTH); tokenInvestmentPanel.setBackground(Color.WHITE); } @@ -222,6 +222,9 @@ currentQuizPageNumber++; setInstructions(getQuizPage()); } + else { + setInstructions(instructionsBuilder.toString()); + } } }); @@ -236,7 +239,6 @@ // return canalAnimationPanel; // } - private String getQuizPage() { StringBuilder builder = new StringBuilder(); String quizPage = getServerConfiguration().getQuizPage(currentQuizPageNumber); @@ -317,7 +319,6 @@ // create a quiz listener and then initialize the instructions. instructionsEditorPane.setActionListener(createQuizListener(getServerConfiguration())); instructionsEditorPane.setCaretPosition(0); - instructionsEditorPane.setBackground(Color.WHITE); } return instructionsEditorPane; } @@ -325,7 +326,8 @@ private HtmlEditorPane createInstructionsEditorPane() { HtmlEditorPane htmlEditorPane = new HtmlEditorPane(); htmlEditorPane.setEditable(false); - htmlEditorPane.setFont(new Font("sansserif", Font.TRUETYPE_FONT, 14)); + htmlEditorPane.setFont(new Font("sansserif", Font.TRUETYPE_FONT, 16)); + htmlEditorPane.setBackground(Color.WHITE); return htmlEditorPane; } @@ -335,7 +337,7 @@ revalidate(); } - public void startRound(final RoundConfiguration configuration) { + public void startRound() { SwingUtilities.invokeLater(new Runnable() { public void run() { addCenterComponent(irrigationGamePanel); @@ -404,7 +406,7 @@ clientData.getTotalDollarsEarnedThisRound(), clientData.getTotalDollarsEarned()+showUpBonus, showUpBonus)); //append the added practice round instructions - if (roundConfiguration.isPracticeRound() || roundConfiguration.isSecondPracticeRound()) { + if (roundConfiguration.isPracticeRound()) { instructionsBuilder.append(roundConfiguration.getPracticeRoundPaymentInstructions()); } else if (event.isLastRound()) { @@ -587,8 +589,8 @@ } else { instructionsBuilder.append( - String.format("<p>The current infrastructure efficiency is %d%% but will be degraded by %d%% during this round." + - "The current irrigation capacity is %d cfps and the available water supply is %d cfps.</p><hr/>", + String.format("<p>The <b>current infrastructure efficiency is %d%%</b> but will <b>decline by %d%%</b> during this round." + + "The <b>current irrigation capacity is %d cfps</b> and the <b>available water supply is %d cfps</b>.</p><hr/>", clientDataModel.getGroupDataModel().getInfrastructureEfficiency(), roundConfiguration.getInfrastructureDegradationFactor(), irrigationCapacity, Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/InfrastructureEfficiencyChartPanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/InfrastructureEfficiencyChartPanel.java 2009-11-13 15:14:42 UTC (rev 362) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/InfrastructureEfficiencyChartPanel.java 2009-11-13 21:02:56 UTC (rev 363) @@ -76,9 +76,9 @@ // data.addSeries(actualFlowCapacitySeriesY); final JFreeChart chart = ChartFactory.createXYLineChart( - "Total Flow Capacity", + "Water Delivery Capacity vs. Infrastructure Efficiency", "Infrastructure Efficiency", - "Actual Flow Capacity", + "Water Delivery Capacity", data, PlotOrientation.VERTICAL, true, Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java 2009-11-13 15:14:42 UTC (rev 362) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java 2009-11-13 21:02:56 UTC (rev 363) @@ -177,7 +177,7 @@ channel.add(this, new EventTypeProcessor<RoundStartedEvent>(RoundStartedEvent.class) { public void handle(RoundStartedEvent event) { clientDataModel.initialize(event); - experimentGameWindow.startRound(getRoundConfiguration()); + experimentGameWindow.startRound(); } }); channel.add(this, new EventTypeProcessor<EndRoundEvent>(EndRoundEvent.class) { Deleted: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationGamePanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationGamePanel.java 2009-11-13 15:14:42 UTC (rev 362) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationGamePanel.java 2009-11-13 21:02:56 UTC (rev 363) @@ -1,421 +0,0 @@ -package edu.asu.commons.irrigation.client; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Rectangle; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.lang.reflect.InvocationTargetException; - -import javax.swing.BoxLayout; -import javax.swing.GroupLayout; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JProgressBar; -import javax.swing.JTextField; -import javax.swing.SwingUtilities; -import javax.swing.GroupLayout.Alignment; -import javax.swing.GroupLayout.ParallelGroup; - -import edu.asu.commons.irrigation.server.ClientData; -import edu.asu.commons.util.HtmlEditorPane; - -/** - * $Id$ - * - * The game interface screen shown during the round. - * - * FIXME: needs refactoring, should merge IrrigationGameWindow functionality into this panel as well. - * - * @author <a href='mailto:All...@as...'>Allen Lee</a> - * @version $Rev$ - */ -public class IrrigationGamePanel extends JPanel { - - private static final long serialVersionUID = -3878952269498777014L; - -// private IrrigationGameWindow irrigationGameWindow; - - private CanalPanel canalPanel; - - //this contains the CanalPanel - private JPanel centerPanel; - - private IrrigationClient client; - -// private Dimension screenSize; - - private JProgressBar timeLeftProgressBar; - - private JButton gateSwitchButton; - - private JLabel irrigationCapacityLabel; - - // private JLabel maximumAvailableFlowCapacityLabel = null; - - private ClientDataModel clientDataModel; // @jve:decl-index=0: - - private MiddleWindowPanel middleWindowPanel; - - // private JLabel dashBoardLabel = null; - - // private JLabel scoreBoardLabel = null; - - private JLabel totalTokensEarnedLabel; - - private JLabel tokensEarnedLabel; - - private JLabel tokensNotInvestedLabel; - - private JLabel waterCollectedLabel; - - private JTextField waterCollectedTextField; - - private JTextField tokensNotInvestedTextField; - - private JTextField tokensEarnedTextField; - - private JTextField totalTokensEarnedTextField; - - private boolean open; - - private JTextField irrigationCapacityTextField; - - private HtmlEditorPane waterCollectedToTokensTable; - - public IrrigationGamePanel(IrrigationClient client) { - setName("Irrigation Game Panel"); - this.client = client; - initGuiComponents(); - } - /** - * Initializes the main game window. - * @return - */ - private void initGuiComponents() { - - - JPanel topmostPanel = new JPanel(); - topmostPanel.setLayout(new BoxLayout(topmostPanel, BoxLayout.Y_AXIS)); - topmostPanel.add(getIrrigationCapacityLabel()); - topmostPanel.add(getTimeLeftProgressBar()); - - setLayout(new BorderLayout()); - add(topmostPanel, BorderLayout.PAGE_START); - add(getCenterPanel(), BorderLayout.CENTER); - add(getBottomPanel(), BorderLayout.PAGE_END); - } - - private JPanel getBottomPanel() { - JPanel bottomPanel = new JPanel(); - bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.Y_AXIS)); - bottomPanel.add(getGateSwitchButton()); - - JPanel bottomMostPanel = new JPanel(); - bottomMostPanel.setLayout(new BoxLayout(bottomMostPanel, BoxLayout.X_AXIS)); - - - JPanel bottomInformationPanel = new JPanel(); - GroupLayout layout = new GroupLayout(bottomInformationPanel); - bottomInformationPanel.setLayout(layout); - layout.setAutoCreateContainerGaps(true); - layout.setAutoCreateGaps(true); - - GroupLayout.SequentialGroup horizontalGroup = layout.createSequentialGroup(); - ParallelGroup labelsGroup = layout.createParallelGroup(); - labelsGroup.addComponent(getWaterCollectedLabel()).addComponent(getTokensNotInvestedLabel()).addComponent(getTokensEarnedLabel()).addComponent(getTotalTokensEarnedLabel()); - - horizontalGroup.addGroup(labelsGroup); - - ParallelGroup textFieldGroup = layout.createParallelGroup(); - textFieldGroup.addComponent(getWaterCollectedTextField()); - textFieldGroup.addComponent(getTokensNotInvestedTextField()); - textFieldGroup.addComponent(getTokensEarnedTextField()); - textFieldGroup.addComponent(getTotalTokensEarnedTextField()); - horizontalGroup.addGroup(textFieldGroup); - layout.setHorizontalGroup(horizontalGroup); - - GroupLayout.SequentialGroup verticalGroup = layout.createSequentialGroup(); - verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) - .addComponent(getWaterCollectedLabel()).addComponent(getWaterCollectedTextField())); - - verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) - .addComponent(getTokensNotInvestedLabel()).addComponent(getTokensNotInvestedTextField())); - - verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) - .addComponent(getTokensEarnedLabel()).addComponent(getTokensEarnedTextField())); - - verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) - .addComponent(getTotalTokensEarnedLabel()).addComponent(getTotalTokensEarnedTextField())); - - layout.setVerticalGroup(verticalGroup); - - bottomMostPanel.add(bottomInformationPanel); - - bottomMostPanel.add(getWaterCollectedToTokensTable()); - - bottomPanel.add(bottomMostPanel); - return bottomPanel; - } - - - private HtmlEditorPane getWaterCollectedToTokensTable() { - if (waterCollectedToTokensTable == null) { - waterCollectedToTokensTable = new HtmlEditorPane(); - waterCollectedToTokensTable.setEditable(false); - waterCollectedToTokensTable.setText(client.getServerConfiguration().getWaterCollectedToTokensTable()); - } - return waterCollectedToTokensTable; - } - - private JTextField getWaterCollectedTextField() { - if (waterCollectedTextField == null) { - waterCollectedTextField = createTextField(); - } - return waterCollectedTextField; - } - - private JTextField createTextField() { - JTextField textField = new JTextField(); - textField.setEditable(false); - textField.setBackground(Color.LIGHT_GRAY); - return textField; - } - - private JLabel getWaterCollectedLabel() { - if (waterCollectedLabel == null) { - waterCollectedLabel = new JLabel("Total water applied to your field: "); - } - return waterCollectedLabel; - } - - private JTextField getTokensNotInvestedTextField() { - if (tokensNotInvestedTextField == null) { - tokensNotInvestedTextField = createTextField(); - } - return tokensNotInvestedTextField; - } - private JLabel getTokensNotInvestedLabel() { - if (tokensNotInvestedLabel == null) { - tokensNotInvestedLabel = new JLabel("Tokens not invested: "); - } - return tokensNotInvestedLabel; - } - - private JTextField getTokensEarnedTextField() { - if (tokensEarnedTextField == null) { - tokensEarnedTextField = createTextField(); - } - return tokensEarnedTextField; - } - private JLabel getTokensEarnedLabel() { - if (tokensEarnedLabel == null) { - tokensEarnedLabel = new JLabel("Tokens earned by crop production: "); - } - return tokensEarnedLabel; - } - - private JTextField getTotalTokensEarnedTextField() { - if (totalTokensEarnedTextField == null) { - totalTokensEarnedTextField = createTextField(); - } - return totalTokensEarnedTextField; - - } - - private JLabel getTotalTokensEarnedLabel() { - if (totalTokensEarnedLabel == null) { - totalTokensEarnedLabel = new JLabel("Total tokens earned this round: "); - } - return totalTokensEarnedLabel; - } - - private JLabel getIrrigationCapacityLabel() { - if (irrigationCapacityLabel == null) { - irrigationCapacityLabel = new JLabel(); - irrigationCapacityLabel.setLabelFor(getIrrigationCapacityTextField()); - irrigationCapacityLabel.setFont(new Font("sansserif", Font.BOLD, 16)); - } - return irrigationCapacityLabel; - } - - private JTextField getIrrigationCapacityTextField() { - if (irrigationCapacityTextField == null) { - irrigationCapacityTextField = createTextField(); - } - return irrigationCapacityTextField; - } - - private JPanel getCenterPanel() { - if (centerPanel == null) { - centerPanel = new JPanel(); -// centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.Y_AXIS)); -// centerPanel.setLayout(new BorderLayout()); -// centerPanel.add(getMiddleWindowPanel(), BorderLayout.PAGE_END); -// upperPanel.add(getScoreBoxPanel(), BorderLayout.PAGE_END); - } - return centerPanel; - } - - - private JButton getGateSwitchButton() { - if (gateSwitchButton == null) { - gateSwitchButton = new JButton("Open gate"); -// gateSwitchButton.setPreferredSize(new Dimension(100, 100)); - gateSwitchButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { - open = !open; - gateSwitchButton.setText( open ? "Close gate" : "Open gate"); - if (open) { - client.openGate(); - } - else { - client.closeGate(); - } - } - }); - } - return gateSwitchButton; - } - - private JPanel createCanalPanel() { - JPanel panel = new JPanel(); - canalPanel = new CanalPanel(clientDataModel); - canalPanel.setSize(new Dimension(1098, 123)); - panel.add(canalPanel); - panel.setBounds(new Rectangle(13, 64, 1098, 123)); - return panel; - } - - /** - * The time left progress bar. - * - * @return javax.swing.JProgressBar - */ - private JProgressBar getTimeLeftProgressBar() { - if (timeLeftProgressBar == null) { - timeLeftProgressBar = new JProgressBar(0, 50); - timeLeftProgressBar.setStringPainted(true); - } - return timeLeftProgressBar; - } - - private Color getProgressBarColor(int timeLeft) { - if (timeLeft < 10) { - return Color.RED; - } - return Color.BLACK; - } - - /** - * Should be invoked every second throughout the experiment, from a ClientUpdateEvent sent by the server. - */ - public void updateClientStatus(final ClientDataModel clientDataModel) { - SwingUtilities.invokeLater(new Runnable() { - public void run() { - int timeLeft = clientDataModel.getTimeLeft(); - String timeLeftString = String.format("%d sec", timeLeft); - timeLeftProgressBar.setValue( timeLeft ); - timeLeftProgressBar.setString(timeLeftString); - timeLeftProgressBar.setForeground( getProgressBarColor(timeLeft) ); - for (final ClientData clientData : clientDataModel.getClientDataMap().values()) { - if (clientData.isGateOpen()) { - canalPanel.openGate(clientData.getPriority()); - } - else if(clientData.isPaused()){ - canalPanel.closeGate(clientData.getPriority()); - } - else if(clientData.isGateClosed()){ - canalPanel.closeGate(clientData.getPriority()); - } - } - ClientData clientData = clientDataModel.getClientData(); - waterCollectedTextField.setText("" + clientData.getWaterCollected()); - tokensNotInvestedTextField.setText("" + clientData.getUninvestedTokens()); - tokensEarnedTextField.setText("" + clientData.getTokensEarnedFromWaterCollected()); - totalTokensEarnedTextField.setText("" + clientData.getAllTokensEarnedThisRound()); -// getScoreBoxPanel().update(clientDataModel); - getMiddleWindowPanel().update(clientDataModel); - - } - - }); - } - - /** - * changes the file button color to red when started downloading - * @param file - */ - - /* - * updates the irrigation window - */ - public void endRound() { - Runnable createGuiRunnable = new Runnable(){ - public void run() { - gateSwitchButton.setText("Open gate"); - if (canalPanel != null) { - System.err.println("Removing canal panel"); - centerPanel.removeAll(); - canalPanel.endRound(); - } - System.err.println("ending round for canal panel"); - canalPanel = null; - } - }; - open = false; - try { - SwingUtilities.invokeAndWait(createGuiRunnable); - } - catch (InterruptedException e) { - e.printStackTrace(); - } - catch (InvocationTargetException e) { - e.printStackTrace(); - } - - } - - public void setClientDataModel(final ClientDataModel clientDataModel) { - this.clientDataModel = clientDataModel; - } - - - /** - * Updates all GUI related components that are dependent on the client data model being properly initialized - * with the GroupDataModel, RoundConfiguration, ClientData, etc. - */ - public void startRound() { - open = false; - centerPanel.add(createCanalPanel(), null); - centerPanel.add(getMiddleWindowPanel(), null); -// getWaterCollectedToTokensTable().setText(clientDataModel.getServerConfiguration().getWaterCollectedToTokensTable()); -// getScoreBoxPanel().initialize(clientDataModel); - getMiddleWindowPanel().initialize(clientDataModel); - int irrigationCapacity = clientDataModel.getGroupDataModel().getMaximumAvailableWaterFlow(); - irrigationCapacityLabel.setText( - String.format("Irrigation capacity: %d cubic feet per second (cfps)", - irrigationCapacity)); - - revalidate(); - // mainIrrigationPanel.add(getJPanelUpStreamWindow(),null); - // mainIrrigationPanel.add(getJPanelDownStreamWindow(),null); - //adding the in between Panel - // mainIrrigationPanel.add(getJPanelMiddleWindow(),null); - } - - private MiddleWindowPanel getMiddleWindowPanel() { - if(middleWindowPanel == null){ - middleWindowPanel = new MiddleWindowPanel(); - } - return middleWindowPanel; - } - - public ClientDataModel getClientDataModel() { - return clientDataModel; - } -} - Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java 2009-11-13 15:14:42 UTC (rev 362) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java 2009-11-13 21:02:56 UTC (rev 363) @@ -449,12 +449,17 @@ */ public void setClientDataModel(final ClientDataModel clientDataModel) { this.clientDataModel = clientDataModel; - fillPanels(clientDataModel); + } public void startRound() { open = false; getMiddleWindowPanel().initialize(clientDataModel); + centerPanel.add(getCanalPanel(clientDataModel)); + mainInterfacePanel.add(getJPanelUpStreamWindow(),null); + mainInterfacePanel.add(getJPanelDownStreamWindow(),null); + mainInterfacePanel.add(getMiddleWindowPanel(),null); + canalPanel.startRound(); int irrigationCapacity = clientDataModel.getIrrigationCapacity(); int waterSupply = clientDataModel.getWaterSupplyCapacity(); irrigationCapacityLabel.setText( @@ -463,21 +468,9 @@ waterSupplyLabel.setText( String.format("Water supply: %d cubic feet per second (cfps)", waterSupply)); - revalidate(); } - /** - * fills in the panels depending on the priority of the client - */ - public void fillPanels(ClientDataModel clientDataModel) { - centerPanel.add(getCanalPanel(clientDataModel)); - mainInterfacePanel.add(getJPanelUpStreamWindow(),null); - mainInterfacePanel.add(getJPanelDownStreamWindow(),null); - mainInterfacePanel.add(getMiddleWindowPanel(),null); - } - - private MiddleWindowPanel getMiddleWindowPanel() { if(middleWindowPanel == null) { middleWindowPanel = new MiddleWindowPanel(); Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleScorePanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleScorePanel.java 2009-11-13 15:14:42 UTC (rev 362) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleScorePanel.java 2009-11-13 21:02:56 UTC (rev 363) @@ -106,8 +106,8 @@ public void update(ClientData clientData) { this.clientData = clientData; - availableWaterLabel.setText(clientData.getAvailableFlowCapacity() + " cfps"); - waterCollectedLabel.setText(clientData.getWaterCollected() + " cf"); + availableWaterLabel.setText(clientData.getAvailableFlowCapacity() + ""); + waterCollectedLabel.setText(clientData.getWaterCollected() + ""); tokensEarnedLabel.setText(String.valueOf(clientData.getTokensEarnedFromWaterCollected())); if(clientData.isGateOpen() && clientData.getAvailableFlowCapacity() > 0) { Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java 2009-11-13 15:14:42 UTC (rev 362) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java 2009-11-13 21:02:56 UTC (rev 363) @@ -23,10 +23,6 @@ private static final float DEFAULT_DOLLARS_PER_TOKEN = .05f; - public RoundConfiguration() { - super(); - } - public static int getTokensEarned(int waterCollected) { if (waterCollected < 150) { return 0; @@ -75,8 +71,6 @@ } } - - public RoundConfiguration(String resource) { super(resource); } @@ -121,12 +115,7 @@ return getProperty("practice-round-payment-instructions", "This is a practice round so the earnings mentioned are only for illustrative purposes and <b>will not count towards your actual earnings</b>."); } - - // FIXME: horrible hack.. figure out why this is here again. - public boolean isSecondPracticeRound(){ - return getBooleanProperty("second-practice-round",false); - } - + public int getClientsPerGroup() { return getIntProperty("clients-per-group", 5); } @@ -151,7 +140,7 @@ } public boolean shouldResetInfrastructureEfficiency() { - return getBooleanProperty("reset-infrastructure-efficiency", false); + return isFirstRound() || getBooleanProperty("reset-infrastructure-efficiency", false); } public String getInstructions() { @@ -167,8 +156,8 @@ return getBooleanProperty("quiz"); } - public String getQuizInstructions() { - return getStringProperty("quiz-instructions"); + public String getQuizPage() { + return getStringProperty("quiz-page"); } public Map<String, String> getQuizAnswers() { @@ -201,8 +190,12 @@ */ @Override public Duration getRoundDuration() { - return Duration.create(getIntProperty("round-duration", 50)); + return Duration.create(getRoundDurationInSeconds()); } + + public int getRoundDurationInSeconds() { + return getIntProperty("round-duration", 50); + } public boolean shouldRandomizeGroup() { return getBooleanProperty("randomize-groups", false); Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java 2009-11-13 15:14:42 UTC (rev 362) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java 2009-11-13 21:02:56 UTC (rev 363) @@ -267,11 +267,9 @@ addEventProcessor(new EventTypeProcessor<QuizResponseEvent>(QuizResponseEvent.class) { @Override public void handle(QuizResponseEvent event) { - numberOfCompletedQuizzes++; getLogger().info("Completed quizzes: " + numberOfCompletedQuizzes); - if(numberOfCompletedQuizzes == clients.size()*8){ - getLogger().info("Everyone has finished reading the general instructions successfully"); - } + numberOfCompletedQuizzes++; + persister.store(event); } }); addEventProcessor(new EventTypeProcessor<OpenGateEvent>(OpenGateEvent.class) { Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/irrigation.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/irrigation.xml 2009-11-13 15:14:42 UTC (rev 362) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/irrigation.xml 2009-11-13 21:02:56 UTC (rev 363) @@ -118,7 +118,7 @@ </p> <p> You will see a text box appear on your screen when a chat period starts. The amount -of time left in the chat period will be shown at the <b>top left of the screen</b>.<br> +of time left in the chat period will be displayed <b>below the chat messages window</b>.<br> </p> ]]> </entry> @@ -126,62 +126,6 @@ <entry key='game-screenshot-instructions'> <![CDATA[ <img src="http://dev.commons.asu.edu/irrigation/images/game-interface-screenshot.jpg"> - -<p> -<b>Table 2</b>: Number of tokens earned from the water applied to your field. -</p> -<table border="1" cellspacing="2" cellpadding="2"> -<thead> -<th>Water units received (cubic feet)</th> -<th>Tokens earned</th> -</thead> -<tr> -<td>< 150</td><td>0</td> -</tr> -<tr> -<td>150-199</td><td>1</td> -</tr> -<tr> -<td>200-249</td><td>4</td> -</tr> -<tr> -<td>250-299</td><td>10</td> -</tr> -<tr> -<td>300-349</td><td>15</td> -</tr> -<tr> -<td>350-399</td><td>18</td> -</tr> -<tr> -<td>400-499</td><td>19</td> -</tr> -<tr> -<td>500-549</td><td>20</td> -</tr> -<tr> -<td>550-649</td><td>19</td> -</tr> -<tr> -<td>650-699</td><td>18</td> -</tr> -<tr> -<td>700-749</td><td>15</td> -</tr> -<tr> -<td>750-799</td><td>10</td> -</tr> -<tr> -<td>800-849</td><td>4</td> -</tr> -<tr> -<td>850-899</td><td>1</td> -</tr> -<tr> -<td>> 899</td><td>0</td> -</tr> -</table> - ]]> </entry> @@ -214,46 +158,9 @@ <entry key="quiz-page1"> <![CDATA[ <p> -The first two questions deal with irrigation infrastructure investment using Table -1. +The first two questions deal with irrigation infrastructure investment. +<b>Please refer to Table 1 of your handout</b>. </p> -<p> -<b>Table 1</b>: The water delivery capacity as a function of irrigation -infrastructure efficiency -</p> -<table border="1" cellspacing="2" cellpadding="2"> -<thead> -<th>Infrastructure Efficiency (percent)</th> -<th>Water delivery (cubic feet per second)</th> -</thead> -<tr> -<td> ≤ 45</td><td>0</td> -</tr> -<tr> -<td>46-51</td><td>5</td> -</tr> -<tr> -<td>52-55</td><td>10</td> -</tr> -<tr> -<td>56-58</td><td>15</td> -</tr> -<tr> -<td>59-61</td><td>20</td> -</tr> -<tr> -<td>62-65</td><td>25</td> -</tr> -<tr> -<td>66-70</td><td>30</td> -</tr> -<tr> -<td>71-80</td><td>35</td> -</tr> -<tr> -<td>81-100</td><td>40</td> -</tr> -</table> <form> Question 1:<br> @@ -301,68 +208,8 @@ <![CDATA[ <p> The final two questions cover the number of tokens you can earn in within a round. +<b>Please refer to table 2 of your handout</b>. </p> -<b>Table 2</b>: Tokens earned from the amount of water applied to your field. -<table border="1" cellspacing="2" cellpadding="2"> -<thead> -<th>Water units received (cubic feet)</th> -<th>Tokens earned</th> -</thead> -<tr> -<td>< 150</td><td>0</td> -</tr> -<tr> -<td>150-199</td><td>1</td> -</tr> -<tr> -<td>200-249</td><td>4</td> -</tr> -<tr> -<td>250-299</td><td>10</td> -</tr> -<tr> -<td>300-349</td><td>15</td> -</tr> -<tr> -<td>350-399</td><td>18</td> -</tr> -<tr> -<td>400-499</td><td>19</td> -</tr> -<tr> -<td>500-549</td><td>20</td> -</tr> -<tr> -<td>550-649</td><td>19</td> -</tr> -<tr> -<td>650-699</td><td>18</td> -</tr> -<tr> -<td>700-749</td><td>15</td> -</tr> -<tr> -<td>750-799</td><td>10</td> -</tr> -<tr> -<td>800-849</td><td>4</td> -</tr> -<tr> -<td>850-899</td><td>1</td> -</tr> -<tr> -<td>> 899</td><td>0</td> -</tr> -</table> -<p> -Your earnings at the end of the round depend on your investment and the number of -tokens you receive from applying water to your fields and growing a crop. As an -example, suppose you invest 6 tokens out of the 10 tokens you are endowed with at -the start of each round. If you receive 333 cubic feet of water you would receive a -grand total of 19 tokens (4 tokens left over from your 10 token endowment + 15 -tokens for growing a crop with 333 cubic feet of water). Since each token is worth -$0.05, you would have an actual earnings of $0.85 for that round. - <form> Question 5:<br> If you invest 7 of the 10 tokens you start with and you apply 202 cubic feet of This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2009-11-18 07:15:18
|
Revision: 367 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=367&view=rev Author: alllee Date: 2009-11-18 07:15:06 +0000 (Wed, 18 Nov 2009) Log Message: ----------- adding updated screenshot and trying to fix lag in displaying first chat message by "warming up" the interface with an initial message at the start of each round (also serves as a chat round demarcation) Modified Paths: -------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java Added Paths: ----------- irrigation/trunk/src/main/resources/images/irrigation-game-interface-screenshot.png Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java 2009-11-17 01:31:57 UTC (rev 366) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java 2009-11-18 07:15:06 UTC (rev 367) @@ -101,8 +101,7 @@ message); chatField.setText(""); irrigationClient.transmit(new ChatRequest(getClientId(), message, targetIdentifier)); - - } + } chatField.requestFocusInWindow(); } @@ -164,7 +163,7 @@ add(textEntryPanel, BorderLayout.PAGE_END); } - private void displayMessage(String chatHandle, String message) { + public void displayMessage(String chatHandle, String message) { // String chatHandle = getChatHandle(source); final StyledDocument document = messageWindow.getStyledDocument(); try { @@ -188,6 +187,7 @@ HANDLES[i] = " " + HANDLE_STRING.charAt(i) + " "; chatHandles.put(participants.get(i), HANDLES[i]); } + displayMessage("", " ---- chat round starting ---- "); } public Identifier getClientId() { Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java 2009-11-17 01:31:57 UTC (rev 366) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java 2009-11-18 07:15:06 UTC (rev 367) @@ -97,9 +97,10 @@ public ExperimentGameWindow(IrrigationClient client) { this.client = client; this.clientDataModel = client.getClientDataModel(); + initialize(); } - void initialize() { + private void initialize() { cardLayout = new CardLayout(); setLayout(cardLayout); addToCardLayout(getInstructionsPanel()); @@ -121,7 +122,6 @@ tokenInvestmentPanel.setName("Token investment panel"); tokenInvestmentPanel.setLayout(new BorderLayout()); tokenInstructionsEditorPane = createInstructionsEditorPane(); - tokenInstructionsEditorPane.setCaretPosition(0); JScrollPane tokenInstructionsScrollPane = new JScrollPane(tokenInstructionsEditorPane); tokenInvestmentPanel.add(tokenInstructionsScrollPane, BorderLayout.CENTER); tokenInvestmentPanel.add(getSubmitTokenPanel(), BorderLayout.SOUTH); @@ -201,7 +201,7 @@ public void actionPerformed(ActionEvent e) { previousButton.setEnabled(true); currentQuizPageNumber++; - if (currentQuizPageNumber < getServerConfiguration().getNumberOfQuestionPages()) { + if (currentQuizPageNumber <= getServerConfiguration().getNumberOfQuizPages()) { setInstructions(getQuizPage()); } else { @@ -286,7 +286,6 @@ instructionsEditorPane.setName("Instructions editor pane"); // create a quiz listener and then initialize the instructions. instructionsEditorPane.setActionListener(createQuizListener(getServerConfiguration())); - instructionsEditorPane.setCaretPosition(0); } return instructionsEditorPane; } @@ -456,7 +455,7 @@ quizPageResponses.put(currentQuizPageNumber, builder.toString()); // no matter what we move on to the next question page // tell them what was right and what was wrong. - if (currentQuizPageNumber <= getServerConfiguration().getNumberOfQuestionPages()) { + if (currentQuizPageNumber <= getServerConfiguration().getNumberOfQuizPages()) { nextButton.setEnabled(true); } quizzesAnswered++; @@ -595,7 +594,7 @@ SwingUtilities.invokeLater(new Runnable() { public void run() { startTimer(getServerConfiguration().getChatDuration() * 1000L); - ChatPanel chatPanel = getChatPanel(); +// ChatPanel chatPanel = getChatPanel(); chatPanel.initialize(clientDataModel.getAllClientIdentifiers()); addCenterComponent( chatPanel ); chatPanel.setFocusInChatField(); @@ -613,6 +612,7 @@ if (timeRemaining < 0) { showTokenInvestmentScreen(); getInvestedTokensTextField().requestFocusInWindow(); +// chatPanel.displayMessage("", "---- chat round ending ----"); timer.stop(); timer = null; } Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java 2009-11-17 01:31:57 UTC (rev 366) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java 2009-11-18 07:15:06 UTC (rev 367) @@ -71,9 +71,8 @@ } private void initialize() { - clientDataModel = new ClientDataModel(channel, this); + clientDataModel = new ClientDataModel(channel, this); experimentGameWindow = new ExperimentGameWindow(this); - experimentGameWindow.initialize(); connect(); } Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java 2009-11-17 01:31:57 UTC (rev 366) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java 2009-11-18 07:15:06 UTC (rev 367) @@ -130,7 +130,7 @@ return assistant.getProperty("investment-instructions"); } - public int getNumberOfQuestionPages() { + public int getNumberOfQuizPages() { return assistant.getIntProperty("question-pages", 2); } Added: irrigation/trunk/src/main/resources/images/irrigation-game-interface-screenshot.png =================================================================== (Binary files differ) Property changes on: irrigation/trunk/src/main/resources/images/irrigation-game-interface-screenshot.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2009-11-19 07:48:08
|
Revision: 369 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=369&view=rev Author: alllee Date: 2009-11-19 07:48:01 +0000 (Thu, 19 Nov 2009) Log Message: ----------- minor interface improvement, lifted chat instructions to config file. should look into templating language at some point... Modified Paths: -------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/InfrastructureEfficiencyChartPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/irrigation.xml Property Changed: ---------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/InfrastructureEfficiencyChartPanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/InfrastructureEfficiencyChartPanel.java 2009-11-19 03:42:52 UTC (rev 368) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/InfrastructureEfficiencyChartPanel.java 2009-11-19 07:48:01 UTC (rev 369) @@ -48,39 +48,40 @@ } private ChartPanel createChartPanel() { - final XYSeries actualFlowCapacitySeries = new XYSeries("Actual"); - final XYSeries potentialFlowCapacitySeries = new XYSeries("Potential"); - // final XYSeries actualFlowCapacitySeriesY = new XYSeries("Actual"); - final XYSeries initialInfrastructureEfficiencySeries = new XYSeries("Initial"); + final XYSeries postInvestmentInfrastructureEfficiencySeries = new XYSeries("Infrastructure Efficiency After Investment"); + final XYSeries potentialInfrastructureEfficiencySeries = new XYSeries("Infrastructure Efficiency Potential"); + final XYSeries preInvestmentInfrastructureEfficiencySeries = new XYSeries("Infrastructure Efficiency Before Investment"); final XYSeries waterSupplySeries = new XYSeries("Available water supply"); GroupDataModel group = client.getClientDataModel().getGroupDataModel(); final int actualInfrastructureEfficiency = group.getInfrastructureEfficiency(); final int actualFlowCapacity = group.getWaterDeliveryCapacity(); for (int y = 0; y <= actualFlowCapacity; y++) { - actualFlowCapacitySeries.add(actualInfrastructureEfficiency, y); + postInvestmentInfrastructureEfficiencySeries.add(actualInfrastructureEfficiency, y); } RoundConfiguration roundConfiguration = client.getRoundConfiguration(); int maximumInfrastructureEfficiency = roundConfiguration.getMaximumInfrastructureEfficiency(); int waterSupplyCapacity = roundConfiguration.getWaterSupplyCapacity(); for (int x = 0; x <= maximumInfrastructureEfficiency; x++) { int flowCapacity = group.calculateWaterDeliveryCapacity(x); - potentialFlowCapacitySeries.add(x,flowCapacity); + potentialInfrastructureEfficiencySeries.add(x,flowCapacity); waterSupplySeries.add(x, waterSupplyCapacity); } final int infrastructureEfficiencyBeforeInvestment = group.getInfrastructureEfficiencyBeforeInvestment(); final int irrigationCapacityBeforeInvestment = group.getIrrigationCapacityBeforeInvestment(); for (int y = 0; y <= irrigationCapacityBeforeInvestment; y++) { - initialInfrastructureEfficiencySeries.add(infrastructureEfficiencyBeforeInvestment, y); + preInvestmentInfrastructureEfficiencySeries.add(infrastructureEfficiencyBeforeInvestment, y); } final XYSeriesCollection data = new XYSeriesCollection(); - data.addSeries(initialInfrastructureEfficiencySeries); - // the second series gets turned blue. + data.addSeries(potentialInfrastructureEfficiencySeries); data.addSeries(waterSupplySeries); - data.addSeries(actualFlowCapacitySeries); - data.addSeries(potentialFlowCapacitySeries); + data.addSeries(preInvestmentInfrastructureEfficiencySeries); + data.addSeries(postInvestmentInfrastructureEfficiencySeries); + + + final JFreeChart chart = ChartFactory.createXYLineChart( "Water Delivery Capacity vs. Infrastructure Efficiency", "Infrastructure Efficiency (%)", Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java 2009-11-19 03:42:52 UTC (rev 368) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java 2009-11-19 07:48:01 UTC (rev 369) @@ -461,10 +461,10 @@ int irrigationCapacity = clientDataModel.getIrrigationCapacity(); int waterSupply = clientDataModel.getWaterSupplyCapacity(); irrigationCapacityLabel.setText( - String.format("Irrigation capacity: %d cubic feet per second (cfps)", + String.format("Water delivery capacity: %d cubic feet per second (cfps)", irrigationCapacity)); waterSupplyLabel.setText( - String.format("Water supply: %d cubic feet per second (cfps)", + String.format("Available water supply: %d cubic feet per second (cfps)", waterSupply)); revalidate(); } Property changes on: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java ___________________________________________________________________ Added: svn:keywords + Date Id Revision Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java 2009-11-19 03:42:52 UTC (rev 368) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java 2009-11-19 07:48:01 UTC (rev 369) @@ -87,7 +87,11 @@ } public String getInitialInstructions() { - return assistant.getProperty("initial-instructions"); + String initialInstructions = assistant.getProperty("initial-instructions", ""); + if (initialInstructions.contains("%d")) { + return String.format(initialInstructions, getChatDuration()); + } + return initialInstructions; } public String getWelcomeInstructions() { @@ -139,16 +143,11 @@ } public String getChatInstructions() { - return assistant.getProperty("chat-instructions", - String.format( - "<h3>Chat Instructions</h3><p>You now have the opportunity to chat for %d seconds. You can discuss whatever you want" + - " related to the experiment with some restrictions. You may not promise the other participant(s) side " + - "payments or threaten them with any consequence (e.g., physical violence) after the experiment is finished. Also, you may not reveal your real identity." + - "We are monitoring chat traffic - if we notice a violation of the rules we will remove the group from the room until the other groups are finished with the experiment.</p>" + - "<p>You can send messages by typing in the text field at the bottom of the screen and then hit return or click send. " + - "The time left for the discussion is displayed above the text field at the bottom of the screen.</p>", - getChatDuration()) - ); + String chatInstructions = assistant.getProperty("chat-instructions", ""); + if (chatInstructions.contains("%d")) { + return String.format(chatInstructions, getChatDuration()); + } + return chatInstructions; } public String getGameScreenshotInstructions() { Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/irrigation.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/irrigation.xml 2009-11-19 03:42:52 UTC (rev 368) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/irrigation.xml 2009-11-19 07:48:01 UTC (rev 369) @@ -75,7 +75,9 @@ ]]> </entry> - +<!-- FIXME: lots of parameterizable fields here. should make instructions +template-language-pluggable +--> <entry key="initial-instructions"> <![CDATA[ <p> @@ -88,18 +90,19 @@ The amount of money you earn will depend on the decisions made by you and the other members of your group. This exercise mimics decisions people make in irrigation systems. In each round you will receive 10 tokens which you can invest in the -irrigation infrastructure. Given the capacity of the irrigation infrastructure and -the availability of water, you can grow crops. Tokens earned in a round is the sum -of tokens not invested plus tokens earned by growing crops. Each token is worth 5 -cents. In each round you will first make a decision as to how much to invest in the -irrigation infrastructure. Based on the combined contributions of all 5 participants -in your group in each round, your group can maintain the capacity of the irrigation -infrastructure for growing crops. +irrigation infrastructure. Based on the <b>water delivery capacity</b> of the +irrigation infrastructure and the availability of water you will be able to +grow crops. Tokens earned in a round is the sum of tokens not invested plus +tokens earned by growing crops. Each token is worth 5 cents. In each round you +will first decide how much to invest in the irrigation infrastructure. Based +on the combined contributions of all 5 participants in your group in each +round, your group can maintain the capacity of the irrigation infrastructure +for growing crops. </p> <p> We will now start a practice round to help illustrate the experiment. Before each -round in this experiment you will have a chat period of 60 seconds where you can +round in this experiment you will have a chat period of %d seconds where you can send text messages to the other participants. You may discuss any aspect of the exercise with two important exceptions: </p> @@ -114,12 +117,8 @@ We will be monitoring the chat traffic. If we detect any violation of these rules, we will have to remove <b>all members of the group where the violation occurred</b> from the experiment. That group will have to wait until the entire experiment is -finished to receive their payment. +finished to receive payment. </p> -<p> -You will see a text box appear on your screen when a chat period starts. The amount -of time left in the chat period will be displayed <b>below the chat messages window</b>.<br> -</p> ]]> </entry> @@ -284,9 +283,36 @@ ]]> </entry> +<entry key='chat-instructions'> +<![CDATA[ +<h3>Chat Instructions</h3> +You may now chat for %d seconds with the other members of your group. You may +discuss any aspect of the exercise with two important exceptions: +</p> +<ol> +<li>You are <b>not allowed</b> to promise the other participants +side-payments or threaten them with any consequence after the experiment is +finished. +</li> +<li>You are <b>not allowed to reveal your real identity</b>.</li> +</ol> +<p> +We will be monitoring the chat traffic. If we detect any violation of these rules, +we will have to remove <b>all members of the group where the violation occurred</b> +from the experiment. That group will have to wait until the entire experiment is +finished to receive payment. +</p> +<p> +You can send messages by typing in the text field at the bottom of the screen +and then pressing the return key or clicking the send button. The time left +for the discussion is displayed with a progress bar above the text field at +the bottom of the screen. +</p> +]]> +</entry> + <entry key="investment-instructions"> <![CDATA[ -<h3>Invest tokens in the irrigation infrastructure</h3> <p> You have been endowed with 10 tokens to invest. You must make a decision about how much you wish to invest [0,10] in the irrigation infrastructure. You can This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2009-11-20 00:53:28
|
Revision: 371 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=371&view=rev Author: alllee Date: 2009-11-20 00:53:21 +0000 (Fri, 20 Nov 2009) Log Message: ----------- replacing bottom left dashboard with giant button, should add an open / close gate image to it as well. Modified Paths: -------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round0.xml Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java 2009-11-19 22:56:43 UTC (rev 370) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java 2009-11-20 00:53:21 UTC (rev 371) @@ -10,7 +10,6 @@ import javax.swing.Box; import javax.swing.BoxLayout; -import javax.swing.GroupLayout; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; @@ -18,8 +17,6 @@ import javax.swing.JTextField; import javax.swing.SwingConstants; import javax.swing.SwingUtilities; -import javax.swing.GroupLayout.Alignment; -import javax.swing.GroupLayout.ParallelGroup; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; @@ -68,22 +65,15 @@ private boolean open; - private JTextField waterCollectedTextField; - - private JLabel waterCollectedLabel; - - private JTextField tokensNotInvestedTextField; - - private JLabel tokensNotInvestedLabel; - - private JTextField tokensEarnedTextField; - - private JLabel tokensEarnedLabel; - - private JTextField totalTokensEarnedTextField; - - private JLabel totalTokensEarnedLabel; - +// private JTextField waterCollectedTextField; +// private JLabel waterCollectedLabel; +// private JTextField tokensNotInvestedTextField; +// private JLabel tokensNotInvestedLabel; +// private JTextField tokensEarnedTextField; +// private JLabel tokensEarnedLabel; +// private JTextField totalTokensEarnedTextField; +// private JLabel totalTokensEarnedLabel; + private JLabel irrigationCapacityLabel; private JLabel waterSupplyLabel; @@ -186,8 +176,8 @@ jPanelUpStreamWindow.setLayout(new BorderLayout()); jPanelUpStreamWindow.setBackground(new Color(186, 226, 237)); jPanelUpStreamWindow.setBounds(new Rectangle(13, 225+100+50, 530, 326)); - jPanelUpStreamWindow.add(getGateSwitchButton(), BorderLayout.NORTH); - jPanelUpStreamWindow.add(getControlPanel(), BorderLayout.CENTER); + jPanelUpStreamWindow.add(getGateSwitchButton(), BorderLayout.CENTER); +// jPanelUpStreamWindow.add(getControlPanel(), BorderLayout.SOUTH); } return jPanelUpStreamWindow; } @@ -213,108 +203,111 @@ } return gateSwitchButton; } + - private JPanel getControlPanel() { - JPanel bottomInformationPanel = new JPanel(); - GroupLayout layout = new GroupLayout(bottomInformationPanel); - bottomInformationPanel.setLayout(layout); - layout.setAutoCreateContainerGaps(true); - layout.setAutoCreateGaps(true); +// private JPanel getControlPanel() { +// JPanel bottomInformationPanel = new JPanel(); +// GroupLayout layout = new GroupLayout(bottomInformationPanel); +// bottomInformationPanel.setLayout(layout); +// layout.setAutoCreateContainerGaps(true); +// layout.setAutoCreateGaps(true); +// +// GroupLayout.SequentialGroup horizontalGroup = layout.createSequentialGroup(); +// ParallelGroup labelsGroup = layout.createParallelGroup(); +// labelsGroup.addComponent(getWaterCollectedLabel()).addComponent(getTokensNotInvestedLabel()).addComponent(getTokensEarnedLabel()).addComponent(getTotalTokensEarnedLabel()); +// +// horizontalGroup.addGroup(labelsGroup); +// +// ParallelGroup textFieldGroup = layout.createParallelGroup(); +// textFieldGroup.addComponent(getWaterCollectedTextField()); +// textFieldGroup.addComponent(getTokensNotInvestedTextField()); +// textFieldGroup.addComponent(getTokensEarnedTextField()); +// textFieldGroup.addComponent(getTotalTokensEarnedTextField()); +// horizontalGroup.addGroup(textFieldGroup); +// layout.setHorizontalGroup(horizontalGroup); +// +// GroupLayout.SequentialGroup verticalGroup = layout.createSequentialGroup(); +// verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) +// .addComponent(getWaterCollectedLabel()).addComponent(getWaterCollectedTextField())); +// +// verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) +// .addComponent(getTokensNotInvestedLabel()).addComponent(getTokensNotInvestedTextField())); +// +// verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) +// .addComponent(getTokensEarnedLabel()).addComponent(getTokensEarnedTextField())); +// +// verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) +// .addComponent(getTotalTokensEarnedLabel()).addComponent(getTotalTokensEarnedTextField())); +// +// layout.setVerticalGroup(verticalGroup); +// return bottomInformationPanel; +// } - GroupLayout.SequentialGroup horizontalGroup = layout.createSequentialGroup(); - ParallelGroup labelsGroup = layout.createParallelGroup(); - labelsGroup.addComponent(getWaterCollectedLabel()).addComponent(getTokensNotInvestedLabel()).addComponent(getTokensEarnedLabel()).addComponent(getTotalTokensEarnedLabel()); - - horizontalGroup.addGroup(labelsGroup); - - ParallelGroup textFieldGroup = layout.createParallelGroup(); - textFieldGroup.addComponent(getWaterCollectedTextField()); - textFieldGroup.addComponent(getTokensNotInvestedTextField()); - textFieldGroup.addComponent(getTokensEarnedTextField()); - textFieldGroup.addComponent(getTotalTokensEarnedTextField()); - horizontalGroup.addGroup(textFieldGroup); - layout.setHorizontalGroup(horizontalGroup); - - GroupLayout.SequentialGroup verticalGroup = layout.createSequentialGroup(); - verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) - .addComponent(getWaterCollectedLabel()).addComponent(getWaterCollectedTextField())); - - verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) - .addComponent(getTokensNotInvestedLabel()).addComponent(getTokensNotInvestedTextField())); - - verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) - .addComponent(getTokensEarnedLabel()).addComponent(getTokensEarnedTextField())); - - verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) - .addComponent(getTotalTokensEarnedLabel()).addComponent(getTotalTokensEarnedTextField())); - - layout.setVerticalGroup(verticalGroup); - return bottomInformationPanel; - } - - private JTextField getWaterCollectedTextField() { - if (waterCollectedTextField == null) { - waterCollectedTextField = createTextField(); - } - return waterCollectedTextField; - } - - private JTextField createTextField() { - JTextField textField = new JTextField(); - textField.setEditable(false); -// textField.setBackground(Color.LIGHT_GRAY); - textField.setBackground(Color.YELLOW); - return textField; - } - - private JLabel getWaterCollectedLabel() { - if (waterCollectedLabel == null) { - waterCollectedLabel = new JLabel("Total water applied to your field: "); - } - return waterCollectedLabel; - } - - private JTextField getTokensNotInvestedTextField() { - if (tokensNotInvestedTextField == null) { - tokensNotInvestedTextField = createTextField(); - } - return tokensNotInvestedTextField; - } - private JLabel getTokensNotInvestedLabel() { - if (tokensNotInvestedLabel == null) { - tokensNotInvestedLabel = new JLabel("Tokens not invested: "); - } - return tokensNotInvestedLabel; - } - - private JTextField getTokensEarnedTextField() { - if (tokensEarnedTextField == null) { - tokensEarnedTextField = createTextField(); - } - return tokensEarnedTextField; - } - private JLabel getTokensEarnedLabel() { - if (tokensEarnedLabel == null) { - tokensEarnedLabel = new JLabel("Tokens earned by crop production: "); - } - return tokensEarnedLabel; - } - - private JTextField getTotalTokensEarnedTextField() { - if (totalTokensEarnedTextField == null) { - totalTokensEarnedTextField = createTextField(); - } - return totalTokensEarnedTextField; - - } - - private JLabel getTotalTokensEarnedLabel() { - if (totalTokensEarnedLabel == null) { - totalTokensEarnedLabel = new JLabel("Total tokens earned this round: "); - } - return totalTokensEarnedLabel; - } + private JTextField createTextField() { + JTextField textField = new JTextField(); + textField.setEditable(false); +// textField.setBackground(Color.LIGHT_GRAY); + textField.setBackground(Color.YELLOW); + return textField; + } +// private JTextField getWaterCollectedTextField() { +// if (waterCollectedTextField == null) { +// waterCollectedTextField = createTextField(); +// } +// return waterCollectedTextField; +// } +// +// +// +// private JLabel getWaterCollectedLabel() { +// if (waterCollectedLabel == null) { +// waterCollectedLabel = new JLabel("Total water applied to your field: "); +// } +// return waterCollectedLabel; +// } +// +// private JTextField getTokensNotInvestedTextField() { +// if (tokensNotInvestedTextField == null) { +// tokensNotInvestedTextField = createTextField(); +// } +// return tokensNotInvestedTextField; +// } +// private JLabel getTokensNotInvestedLabel() { +// if (tokensNotInvestedLabel == null) { +// tokensNotInvestedLabel = new JLabel("Tokens not invested: "); +// } +// return tokensNotInvestedLabel; +// } +// +// private JTextField getTokensEarnedTextField() { +// if (tokensEarnedTextField == null) { +// tokensEarnedTextField = createTextField(); +// } +// return tokensEarnedTextField; +// } +// private JLabel getTokensEarnedLabel() { +// if (tokensEarnedLabel == null) { +// tokensEarnedLabel = new JLabel("Tokens earned by crop production: "); +// } +// return tokensEarnedLabel; +// } +// +// private JTextField getTotalTokensEarnedTextField() { +// if (totalTokensEarnedTextField == null) { +// totalTokensEarnedTextField = createTextField(); +// } +// return totalTokensEarnedTextField; +// +// } +// +// private JLabel getTotalTokensEarnedLabel() { +// if (totalTokensEarnedLabel == null) { +// totalTokensEarnedLabel = new JLabel("Total tokens earned this round: "); +// } +// return totalTokensEarnedLabel; +// } + private JLabel getIrrigationCapacityLabel() { if (irrigationCapacityLabel == null) { irrigationCapacityLabel = new JLabel(); @@ -412,10 +405,10 @@ } } ClientData clientData = clientDataModel.getClientData(); - getWaterCollectedTextField().setText("" + clientData.getWaterCollected()); - getTokensNotInvestedTextField().setText("" + clientData.getUninvestedTokens()); - getTokensEarnedTextField().setText("" + clientData.getTokensEarnedFromWaterCollected()); - getTotalTokensEarnedTextField().setText("" + clientData.getAllTokensEarnedThisRound()); +// getWaterCollectedTextField().setText("" + clientData.getWaterCollected()); +// getTokensNotInvestedTextField().setText("" + clientData.getUninvestedTokens()); +// getTokensEarnedTextField().setText("" + clientData.getTokensEarnedFromWaterCollected()); +// getTotalTokensEarnedTextField().setText("" + clientData.getAllTokensEarnedThisRound()); getMiddleWindowPanel().update(clientDataModel); currentWaterAppliedSeries.clear(); Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java 2009-11-19 22:56:43 UTC (rev 370) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java 2009-11-20 00:53:21 UTC (rev 371) @@ -61,9 +61,6 @@ private final ServerDataModel serverDataModel; - // private final Object quizSignal = new Object(); - // private int numberOfCompletedQuizzes; - private int submittedClients; private IrrigationPersister persister; @@ -145,9 +142,11 @@ return; } // ignore the request if not every group has submit their tokens. - synchronized (roundSignal) { - roundSignal.notifyAll(); - } + if (isTokenInvestmentComplete()) { + synchronized (roundSignal) { + roundSignal.notifyAll(); + } + } } }); addEventProcessor(new EventTypeProcessor<EndRoundRequest>(EndRoundRequest.class) { @@ -160,10 +159,14 @@ addEventProcessor(new EventTypeProcessor<BeginChatRoundRequest>(BeginChatRoundRequest.class) { @Override public void handle(BeginChatRoundRequest request) { + // XXX: the participants have already been added to the data model at this point + // so we shuffle them around right before the first practice round's chat. if (getRoundConfiguration().isFirstRound()) { shuffleParticipants(); } - persister.clearChatData(); + else { + persister.clearChatData(); + } // pass it on to all the clients synchronized (clients) { for (Identifier id: clients.keySet()) { @@ -204,7 +207,6 @@ Identifier identifier = event.getId(); ClientData clientData = new ClientData(identifier); synchronized (clients) { - // FIXME: shouldn't add to server data model right away... clients.put(identifier, clientData); serverDataModel.addClient(clientData); } @@ -254,10 +256,13 @@ addEventProcessor(new EventTypeProcessor<InvestedTokensEvent>(InvestedTokensEvent.class) { @Override public void handle(InvestedTokensEvent event) { - ClientData clientData = clients.get(event.getId()); - clientData.setInvestedTokens(event.getInvestedTokens()); + if (isTokenInvestmentComplete()) { + getLogger().severe("Trying to invest more tokens but token investment is already complete:" + event); + return; + } + clients.get(event.getId()).setInvestedTokens(event.getInvestedTokens()); submittedClients++; - if (submittedClients >= clients.size()) { + if (isTokenInvestmentComplete()) { // everyone's submitted their tokens so we can calculate the available bandwidth and // notify each client initializeInfrastructureEfficiency(); @@ -274,8 +279,7 @@ }); addEventProcessor(new EventTypeProcessor<OpenGateEvent>(OpenGateEvent.class) { public void handle(OpenGateEvent event) { - ClientData clientData = clients.get(event.getId()); - clientData.openGate(); + clients.get(event.getId()).openGate(); } }); addEventProcessor(new EventTypeProcessor<CloseGateEvent>(CloseGateEvent.class) { @@ -289,6 +293,10 @@ } }); } + + private boolean isTokenInvestmentComplete() { + return submittedClients >= clients.size(); + } /** * Invoked after every client has submit their tokens Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round0.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round0.xml 2009-11-19 22:56:43 UTC (rev 370) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/mixed-pretest/round0.xml 2009-11-20 00:53:21 UTC (rev 371) @@ -5,6 +5,7 @@ <entry key="practice-round">true</entry> <entry key='reset-infrastructure-efficiency'>true</entry> +<entry key='initial-infrastructure-efficiency'>50</entry> <entry key="instructions"> <![CDATA[ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2010-01-15 20:19:33
|
Revision: 431 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=431&view=rev Author: alllee Date: 2010-01-15 20:19:26 +0000 (Fri, 15 Jan 2010) Log Message: ----------- removing defunct PauseRequest, fixing http://opensource.asu.edu/jira/browse/COMMONS-6 removing send button from chat panel Modified Paths: -------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalAnimationPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/Gate.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/EndRoundEvent.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/ClientData.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/irrigation.xml Removed Paths: ------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/PauseRequest.java Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalAnimationPanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalAnimationPanel.java 2010-01-15 19:27:15 UTC (rev 430) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalAnimationPanel.java 2010-01-15 20:19:26 UTC (rev 431) @@ -490,16 +490,15 @@ public void openGates(int priority) { gate[priority].setGateOpen(true); // set the height of all the canal panels depending on the state of the game - repaint(); } public void closeGates(int priority) { gate[priority].setGateOpen(false); - gate[priority].setx1(gate[priority].getdefaultx1()); - gate[priority].sety1(gate[priority].getdefaulty1()); +// gate[priority].setx1(gate[priority].getdefaultx1()); +// gate[priority].sety1(gate[priority].getdefaulty1()); /*if(!(priority == 0)) gate[priority].setHeight(gate[priority-1].getHeight());*/ - repaint(); +// repaint(); } public void endRound() { Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java 2010-01-15 19:27:15 UTC (rev 430) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java 2010-01-15 20:19:26 UTC (rev 431) @@ -398,17 +398,14 @@ public void openGate(int priority) { gate[priority].setGateOpen(true); // paintComponent(graphics2D); - repaint(); - +// repaint(); } public void closeGate(int priority) { gate[priority].setGateOpen(false); - gate[priority].setx1(gate[priority].getdefaultx1()); - gate[priority].sety1(gate[priority].getdefaulty1()); - /*if(!(priority == 0)) - gate[priority].setHeight(gate[priority-1].getHeight());*/ - repaint(); +// gate[priority].setx1(gate[priority].getdefaultx1()); +// gate[priority].sety1(gate[priority].getdefaulty1()); +// repaint(); } public void startRound() { Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java 2010-01-15 19:27:15 UTC (rev 430) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java 2010-01-15 20:19:26 UTC (rev 431) @@ -2,15 +2,12 @@ import java.awt.BorderLayout; import java.awt.Color; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.swing.JButton; import javax.swing.JEditorPane; import javax.swing.JPanel; import javax.swing.JProgressBar; @@ -77,12 +74,12 @@ } } }); - final JButton sendButton = new JButton("Send"); - sendButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { - sendMessage(); - } - }); +// final JButton sendButton = new JButton("Send"); +// sendButton.addActionListener(new ActionListener() { +// public void actionPerformed(ActionEvent event) { +// sendMessage(); +// } +// }); JPanel timeLeftPanel = new JPanel(); timeLeftProgressBar = new JProgressBar(0, 60); timeLeftProgressBar.setStringPainted(true); @@ -91,7 +88,7 @@ add(timeLeftPanel, BorderLayout.PAGE_START); add(chatField, BorderLayout.CENTER); - add(sendButton, BorderLayout.PAGE_END); +// add(sendButton, BorderLayout.PAGE_END); } private void sendMessage() { Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/Gate.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/Gate.java 2010-01-15 19:27:15 UTC (rev 430) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/Gate.java 2010-01-15 20:19:26 UTC (rev 431) @@ -1,8 +1,9 @@ package edu.asu.commons.irrigation.client; /** + * FIXME: Refactor this class. + * * @author Sanket - * */ public class Gate { @@ -143,6 +144,10 @@ public void setGateOpen(boolean gateOpen) { this.gateOpen = gateOpen; + if (! gateOpen) { + setx1(getdefaultx1()); + sety1(getdefaulty1()); + } } public int getOpeningsHeight() { Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java 2010-01-15 19:27:15 UTC (rev 430) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java 2010-01-15 20:19:26 UTC (rev 431) @@ -19,7 +19,6 @@ import edu.asu.commons.irrigation.events.InfrastructureUpdateEvent; import edu.asu.commons.irrigation.events.InvestedTokensEvent; import edu.asu.commons.irrigation.events.OpenGateEvent; -import edu.asu.commons.irrigation.events.PauseRequest; import edu.asu.commons.irrigation.events.RegistrationEvent; import edu.asu.commons.irrigation.events.RoundStartedEvent; import edu.asu.commons.irrigation.events.ShowGameScreenshotRequest; @@ -126,12 +125,6 @@ transmit(investedTokensEvent); } - /** - * Transmitting the file string , that is the file chosen for the current - * file download - * - * @param fileNo - */ public void openGate() { OpenGateEvent openGateEvent = new OpenGateEvent(getId()); transmit(openGateEvent); @@ -141,11 +134,6 @@ CloseGateEvent closeGateEvent = new CloseGateEvent(getId()); transmit(closeGateEvent); } - - public void pause() { - PauseRequest pauseRequest = new PauseRequest(getId()); - transmit(pauseRequest); - } public void transmit(Event event) { clientDispatcher.transmit(event); @@ -181,7 +169,7 @@ }); channel.add(this, new EventTypeProcessor<EndRoundEvent>(EndRoundEvent.class) { public void handle(EndRoundEvent event) { - clientDataModel.setGroupDataModel(event.getClientData().getGroupDataModel()); + clientDataModel.setGroupDataModel(event.getGroupDataModel()); experimentGameWindow.endRound(event); } }); Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java 2010-01-15 19:27:15 UTC (rev 430) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java 2010-01-15 20:19:26 UTC (rev 431) @@ -397,12 +397,9 @@ if (clientData.isGateOpen()) { canalPanel.openGate(clientData.getPriority()); } - else if(clientData.isPaused()){ + else { canalPanel.closeGate(clientData.getPriority()); } - else if(clientData.isGateClosed()){ - canalPanel.closeGate(clientData.getPriority()); - } } ClientData clientData = clientDataModel.getClientData(); // getWaterCollectedTextField().setText("" + clientData.getWaterCollected()); Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/EndRoundEvent.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/EndRoundEvent.java 2010-01-15 19:27:15 UTC (rev 430) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/EndRoundEvent.java 2010-01-15 20:19:26 UTC (rev 431) @@ -1,17 +1,12 @@ package edu.asu.commons.irrigation.events; -import java.util.Map; - import edu.asu.commons.event.AbstractEvent; import edu.asu.commons.event.ExperimentUpdateEvent; -import edu.asu.commons.irrigation.server.ClientData; import edu.asu.commons.irrigation.server.GroupDataModel; import edu.asu.commons.net.Identifier; /** - * @author Sanket - * carries all the information till the end of the round. - * + * Conveys the GroupDataModel and a lastRound boolean flag to the relevant clients. */ public class EndRoundEvent extends AbstractEvent implements ExperimentUpdateEvent { @@ -26,17 +21,9 @@ this.lastRound = lastRound; this.groupDataModel = groupDataModel; } - /** - * returns all the clients in this group - * @return - */ - - public Map<Identifier, ClientData> getClientDataMap(){ - return groupDataModel.getClientDataMap(); - } - public ClientData getClientData() { - return getClientDataMap().get(id); + public GroupDataModel getGroupDataModel() { + return groupDataModel; } public boolean isLastRound(){ Deleted: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/PauseRequest.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/PauseRequest.java 2010-01-15 19:27:15 UTC (rev 430) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/PauseRequest.java 2010-01-15 20:19:26 UTC (rev 431) @@ -1,32 +0,0 @@ -package edu.asu.commons.irrigation.events; - -import edu.asu.commons.event.AbstractPersistableEvent; -import edu.asu.commons.net.Identifier; - -/** - * $Id$ - * - * Client request to pause flow. Not always allowed. - * - * - * @author <a href='mailto:All...@as...'>Allen Lee</a> - * @version $Rev$ - */ -public class PauseRequest extends AbstractPersistableEvent { - - private static final long serialVersionUID = 5080329943962617402L; - - public PauseRequest(Identifier id) { - super(id); - } - - /** - * Copy constructor - used to reconstruct on the server-side and guarantee uniqueness / sort-order. - * - * @param pauseRequest - */ - public PauseRequest(PauseRequest pauseRequest) { - super(pauseRequest.id); - } - -} Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/ClientData.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/ClientData.java 2010-01-15 19:27:15 UTC (rev 430) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/ClientData.java 2010-01-15 20:19:26 UTC (rev 431) @@ -39,18 +39,12 @@ private int totalTokens; - private boolean paused = false; - private boolean gateOpen = false; public ClientData(Identifier id) { this.id = id; } - public boolean isPaused(){ - return paused; - } - public boolean isGateClosed(){ return ! gateOpen; } @@ -86,35 +80,16 @@ return "Position not found"; } - /** - * here the parameters isPaused, isStopped and isStartDownload would change. - * The server every time would check the clients queue. It would be a queue of clients requests. - * and it then would check these bits...and then act accordingly. These would be the operations - * that the users are allowed to do. - */ - public void openGate(){ gateOpen = true; - paused = false; } - public void pause(){ - paused = true; - gateOpen = false; - } - - public void unpause() { - paused = false; - gateOpen = true; - } - public void closeGate(){ gateOpen = false; - paused = false; } /** - * get and set the TOkens that are contributed by this client. + * get and set the Tokens that are contributed by this client. * * @param contributedTokens */ public void setInvestedTokens(int investedTokens) { @@ -142,19 +117,19 @@ public void setRoundConfiguration(RoundConfiguration roundConfiguration) { this.roundConfiguration = roundConfiguration; } -/** - * clearing the clientData at the end of each round - * - */ - public void endRound() { + + /** + * Resets this client data's instance variables at the end of the round. + * + */ + public void resetEndRound() { closeGate(); investedTokens = 0; - //adding number of files to be downloaded = 0 per round waterCollected = 0; } public void resetAllTokens() { - endRound(); + resetEndRound(); totalTokens = 0; } Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java 2010-01-15 19:27:15 UTC (rev 430) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java 2010-01-15 20:19:26 UTC (rev 431) @@ -26,7 +26,6 @@ import edu.asu.commons.irrigation.events.InfrastructureUpdateEvent; import edu.asu.commons.irrigation.events.InvestedTokensEvent; import edu.asu.commons.irrigation.events.OpenGateEvent; -import edu.asu.commons.irrigation.events.PauseRequest; import edu.asu.commons.irrigation.events.QuizResponseEvent; import edu.asu.commons.irrigation.events.RegistrationEvent; import edu.asu.commons.irrigation.events.RoundStartedEvent; @@ -287,11 +286,6 @@ clients.get(event.getId()).closeGate(); } }); - addEventProcessor(new EventTypeProcessor<PauseRequest>(PauseRequest.class) { - public void handle(PauseRequest event) { - clients.get(event.getId()).pause(); - } - }); } private boolean isTokenInvestmentComplete() { @@ -344,13 +338,9 @@ if (clientData.isGateOpen()) { group.allocateWater(clientData); } - else if (clientData.isGateClosed()) { + else { clientData.init(group.getAvailableClientFlowCapacity()); } - // right now the clients cannot be paused. - else if (clientData.isPaused()) { - - } } for (Identifier id: group.getClientIdentifiers()) { ClientUpdateEvent clientUpdateEvent = new ClientUpdateEvent(id, group, timeLeft); @@ -441,9 +431,17 @@ //Send the end round event to the facilitator //Send the end round event to all the clients synchronized (clients) { + // add collected tokens to total if this isn't a practice round. + if (! getRoundConfiguration().isPracticeRound()) { + // first add tokens + for (ClientData data : clients.values()) { + data.addTokensEarnedThisRoundToTotal(); + } + } for (ClientData data : clients.values()) { - data.addTokensEarnedThisRoundToTotal(); - transmit(new EndRoundEvent(data.getId(), data.getGroupDataModel(), getConfiguration().isLastRound())); + transmit(new EndRoundEvent(data.getId(), + data.getGroupDataModel(), + getConfiguration().isLastRound())); } } transmit(new FacilitatorEndRoundEvent(facilitatorId, serverDataModel)); @@ -458,12 +456,7 @@ // reset client data values synchronized (clients) { for (ClientData clientData: clients.values()) { - if (getConfiguration().getCurrentParameters().isPracticeRound()) { - clientData.resetAllTokens(); - } - else { - clientData.endRound(); - } + clientData.resetEndRound(); } } submittedClients = 0; Modified: irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/irrigation.xml =================================================================== --- irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/irrigation.xml 2010-01-15 19:27:15 UTC (rev 430) +++ irrigation/trunk/src/main/resources/configuration/asu-fall-2009/t4/irrigation.xml 2010-01-15 20:19:26 UTC (rev 431) @@ -304,9 +304,8 @@ </p> <p> You can send messages by typing in the text field at the bottom of the screen -and then pressing the return key or clicking the send button. The time left -for the discussion is displayed with a progress bar above the text field at -the bottom of the screen. +and then pressing the return key. The time left for the discussion is displayed with +a progress bar above the text field at the bottom of the screen. </p> ]]> </entry> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |