[virtualcommons-svn] SF.net SVN: virtualcommons:[358] irrigation/trunk/src/main
Status: Beta
Brought to you by:
alllee
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] |