[virtualcommons-svn] commit/foraging: 3 new changesets
Status: Beta
Brought to you by:
alllee
From: Bitbucket <com...@bi...> - 2012-01-11 06:26:26
|
3 new commits in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/0ee57867796a/ changeset: 0ee57867796a user: alllee date: 2012-01-10 21:35:58 summary: more instructions refactoring, working on integrating rule reminder into the regular round instructions. affected #: 7 files diff -r 62b5da02b0bcb5813fe6e8b1e807fe8bd02f35e9 -r 0ee57867796a62492ab9d0a13eaeb23c4113a809 src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java --- a/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java +++ b/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java @@ -51,6 +51,8 @@ private static final double DEFAULT_TOKEN_BIRTH_PROBABILITY = 0.01d; + private List<ForagingRule> selectedRules; + public double getTrustGamePayoffIncrement() { return getDoubleProperty("trust-game-payoff", 0.25d); } @@ -290,13 +292,15 @@ */ public String getInstructions() { ST template = createStringTemplate(getProperty("instructions", getParentConfiguration().getSameRoundAsPreviousInstructions())); - // FIXME: see if it's possible to simplify usage here so bean properties are transparently accessed within a templatized instruction. + // FIXME: this isn't ideal, figure out how to get any bean properties transparently accessible within a templatized instruction + // could do it via 1. reflection 2. annotations 3. ??? template.add("resourceWidth", getResourceWidth()); template.add("resourceDepth", getResourceDepth()); template.add("duration", inMinutes(getDuration()) + " minutes"); template.add("roundNumber", getRoundNumber()); template.add("clientsPerGroup", getClientsPerGroup()); template.add("dollarsPerToken", NumberFormat.getCurrencyInstance().format(getDollarsPerToken())); + template.add("initialDistribution", NumberFormat.getPercentInstance().format(getInitialDistribution())); return template.render(); } @@ -637,14 +641,11 @@ } public StringBuilder addAllSpecialInstructions(StringBuilder instructionsBuilder) { - // FIXME: refactor this convoluted conditional logic if possible + // FIXME: refactor this convoluted conditional logic, use StringTemplate StringBuilder builder = new StringBuilder(); if (isFieldOfVisionEnabled()) { addSpecialInstructions(builder, getFieldOfVisionInstructions()); } - if (isSanctioningEnabled()) { - addSpecialInstructions(builder, getSanctionInstructions()); - } if (isInRoundChatEnabled()) { addSpecialInstructions(builder, getInRoundChatInstructions()); } @@ -706,20 +707,19 @@ return getProperty("survey-instructions"); } - public String getSurveyLink() { - return getProperty("survey-link", "https://qtrial.qualtrics.com/SE/?SID=SV_38lReBOv0Wk7wgY"); + public String getSurveyUrl() { + return getProperty("survey-url", "https://qtrial.qualtrics.com/SE/?SID=SV_38lReBOv0Wk7wgY"); } public String getSurveyInstructions(Identifier id) { String surveyInstructions = getSurveyInstructions(); ST template = createStringTemplate(surveyInstructions); - template.add("surveyLink", getSurveyLink()); - template.add("participantId", id); + template.add("surveyLink", getSurveyUrl()); template.add("surveyId", id.getSurveyId()); return template.render(); } - public String getVotingNominationInstructions(List<ForagingRule> selectedRules) { + public String getVotingNominationInstructions() { // FIXME: move to template style construction StringBuilder builder = new StringBuilder("<h1>Voting Results</h1><hr>"); if (selectedRules.size() > 1) { @@ -749,4 +749,8 @@ } return template.render(); } + + public void setSelectedRules(List<ForagingRule> selectedRules) { + this.selectedRules = selectedRules; + } } diff -r 62b5da02b0bcb5813fe6e8b1e807fe8bd02f35e9 -r 0ee57867796a62492ab9d0a13eaeb23c4113a809 src/main/java/edu/asu/commons/foraging/ui/GameWindow2D.java --- a/src/main/java/edu/asu/commons/foraging/ui/GameWindow2D.java +++ b/src/main/java/edu/asu/commons/foraging/ui/GameWindow2D.java @@ -773,7 +773,9 @@ votingPanel.remove(votingForm); votingPanel.add(resultsForm); votingPanel.revalidate(); - votingInstructionsEditorPane.setText(client.getCurrentRoundConfiguration().getVotingNominationInstructions(selectedRules)); + RoundConfiguration currentRoundConfiguration = client.getCurrentRoundConfiguration(); + currentRoundConfiguration.setSelectedRules(selectedRules); + votingInstructionsEditorPane.setText(currentRoundConfiguration.getVotingNominationInstructions()); showPanel(VotingForm.NAME); } }); diff -r 62b5da02b0bcb5813fe6e8b1e807fe8bd02f35e9 -r 0ee57867796a62492ab9d0a13eaeb23c4113a809 src/main/java/edu/asu/commons/foraging/ui/VotingForm.java --- a/src/main/java/edu/asu/commons/foraging/ui/VotingForm.java +++ b/src/main/java/edu/asu/commons/foraging/ui/VotingForm.java @@ -30,14 +30,14 @@ import edu.asu.commons.ui.UserInterfaceUtils; /** - * - * @author alllee + * $Id$ + * @author Allen Lee */ public class VotingForm extends javax.swing.JPanel { private static final long serialVersionUID = 3871660663519284024L; - public final static String NAME = "Voting form"; + public final static String NAME = "Strategy voting form"; private ForagingClient client; @@ -71,15 +71,15 @@ rightHeaderLabel.setFont(UserInterfaceUtils.DEFAULT_BOLD_FONT); horizontalButtonParallelGroup.addComponent(rightHeaderLabel); - JLabel ruleHeaderLabel = new JLabel("Rule"); - ruleHeaderLabel.setFont(UserInterfaceUtils.DEFAULT_BOLD_FONT); - horizontalLabelParallelGroup.addComponent(ruleHeaderLabel); + JLabel strategyHeaderLabel = new JLabel("Strategy"); + strategyHeaderLabel.setFont(UserInterfaceUtils.DEFAULT_BOLD_FONT); + horizontalLabelParallelGroup.addComponent(strategyHeaderLabel); - verticalGroup.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(ruleHeaderLabel).addGap(10).addComponent(rightHeaderLabel)); + verticalGroup.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(strategyHeaderLabel).addGap(10).addComponent(rightHeaderLabel)); int ruleIndex = 0; for (ForagingRule rule: rules) { ruleIndex++; - JLabel ruleLabel = new JLabel(String.format("Rule %d: %s", ruleIndex, rule)); + JLabel ruleLabel = new JLabel(String.format("Strategy %d: %s", ruleIndex, rule)); ruleLabel.setFont(UserInterfaceUtils.DEFAULT_PLAIN_FONT); horizontalLabelParallelGroup.addComponent(ruleLabel); JComponent component = null; @@ -113,7 +113,7 @@ public void actionPerformed(ActionEvent e) { ButtonModel model = buttonGroup.getSelection(); if (model == null) { - JOptionPane.showMessageDialog(VotingForm.this, "Please select a rule."); + JOptionPane.showMessageDialog(VotingForm.this, "Please select a strategy."); return; } ForagingRule selectedRule = ForagingRule.valueOf(model.getActionCommand()); diff -r 62b5da02b0bcb5813fe6e8b1e807fe8bd02f35e9 -r 0ee57867796a62492ab9d0a13eaeb23c4113a809 src/main/resources/configuration/indiana-experiments/2011/vote-punish/round0.xml --- a/src/main/resources/configuration/indiana-experiments/2011/vote-punish/round0.xml +++ b/src/main/resources/configuration/indiana-experiments/2011/vote-punish/round0.xml @@ -2,7 +2,6 @@ <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"><properties><comment>Foraging XML-ized experiment round configuration</comment> -<entry key='initial-distribution'>0.5d</entry><entry key="resource-width">13</entry><entry key="resource-depth">13</entry><entry key="practice-round">true</entry> @@ -33,7 +32,7 @@ you will reset the distribution of the tokens to randomly occupying a quarter of the cells with green tokens. </p> -<p>If you have any questions please raise your hand. <b>Do you have any questions so far?</b></p> +<p><b>Do you have any questions?</b> If you have any questions at this time please raise your hand and someone will come over to your station and answer it.</p> ]]></entry> diff -r 62b5da02b0bcb5813fe6e8b1e807fe8bd02f35e9 -r 0ee57867796a62492ab9d0a13eaeb23c4113a809 src/main/resources/configuration/indiana-experiments/2011/vote-punish/round1.xml --- a/src/main/resources/configuration/indiana-experiments/2011/vote-punish/round1.xml +++ b/src/main/resources/configuration/indiana-experiments/2011/vote-punish/round1.xml @@ -25,13 +25,13 @@ <hr><p> In this round the renewable resource will become five times bigger. You will share this -larger environment with three other random players in this room . In particular, -each of you in this room has been randomly assigned to one of several equal-sized 4 +larger environment with three other random players in this room. In particular, +each of you in this room has been randomly assigned to one of several equal-sized {clientsPerGroup} person groups and everyone in your group has been randomly assigned a number from 1 to {clientsPerGroup}. You will stay in the same group for the entire experiment, and each person's -number from 1 to 4 will remain the same throughout the experiment. The other three people in your group will appear -on the screen as blue dots <img src="@CODEBASE_URL@/images/gem-other.gif"> with a -white number embedded in the dot. +number from 1 to {clientsPerGroup} will remain the same throughout the experiment. +The other three people in your group will appear on the screen as blue dots +<img src="@CODEBASE_URL@/images/gem-other.gif"> with a white number embedded in the dot. </p><p> In each round of the token task, you can see how many tokens each player has diff -r 62b5da02b0bcb5813fe6e8b1e807fe8bd02f35e9 -r 0ee57867796a62492ab9d0a13eaeb23c4113a809 src/main/resources/configuration/indiana-experiments/2011/vote-punish/round4.xml --- a/src/main/resources/configuration/indiana-experiments/2011/vote-punish/round4.xml +++ b/src/main/resources/configuration/indiana-experiments/2011/vote-punish/round4.xml @@ -29,40 +29,56 @@ <entry key='initial-voting-instructions'><![CDATA[ -<h1>Notice</h1> +<h1>Important New Instructions</h1> +<h2>Strategies for managing how players collect tokens for the rest of the experiment</h2><hr><p> -In a moment, you will see a screen on your computer called Rule Options. It -will list 6 different rules that you can consider as options for managing how -each of your groups collect green tokens today. +In a moment, you will have the option to implement one of six strategies for how you +and the three other people in your group collect tokens for the rest of the +experiment. +</p> +<h2>Procedure for Deciding the Strategy</h2> +<hr> +<p> + Each of the {clientsPerGroup} people in your group can nominate one of the six + potential strategies. The single strategy that receives the most nominations + wins. </p><p> -You can nominate one rule from the list to help decide whether or not to have a -rule and what that rule will be. The rule that has the most nominations will be -considered chosen and established as the rule. If there is a tie, then each -tied nominated rule will receive an equal chance of getting selected at random. + <b>If there is a tie</b>, one of the tied options will be selected at random by + the computer. Each of the tied strategies will have an equal chance of being + selected. </p> +<h2>Implementation</h2> +<hr> + <p>Neither the computer nor the experimenter will intervene to implement the + strategy. + </p> + + <p> + <b>Do you have any questions?</b> If you have any questions at this time, + raise your hand and someone will come over to your station and answer it. + </p> ]]></entry><entry key='voting-instructions'><![CDATA[ -<h1>Instructions</h1> +<h1>Strategy Nomination Instructions</h1><hr><p> -To nominate a rule, click the radio button to the left of the one you choose, and -then click "submit." The computer will tally the nominations and then report -the results on the next screen. The results will be presented to each -participant in your group and the experimenter. +To nominate a strategy, click the button to the right of the one you choose, and +then click "submit." The computer will tally the nominations and then report the +results on the next screen. The results will be presented to each person in +your group. </p> - +<h2>Your selection will be anonymous</h2> +<hr><p> -The identity of people who nominated a particular rule will NOT be revealed. -Therefore, neither you nor the experimenter will know who nominated a -particular rule. -</p> - +The identity of people who nominated a particular strategy will NOT be revealed. +Therefore, neither you nor the experimenter will know who nominated a particular +rule. </p> ]]></entry> @@ -74,18 +90,13 @@ <hr><p> Before we continue to the next round of the token task, we would like to ask you - some quick questions. At the beginning of the survey you will need to enter: - </p> - <ul> - <li><b>Your survey ID</b>: {surveyId} </li> - </ul> - <p> - Please <a href='{surveyLink}'>click here</a> to begin the survey. + some quick questions. Please <a href='{surveyUrl}&SURVEY_ID={surveyId}'>click here</a> to + begin the survey. </p> ]]></entry> -<entry key='survey-link'> +<entry key='survey-url'><![CDATA[ https://qtrial.qualtrics.com/SE/?SID=SV_cLX7jnYikmD9eSM ]]> @@ -97,7 +108,8 @@ <entry key="sanction-multiplier">2</entry><entry key='sanction-instructions'><![CDATA[ - <h1>Important New Instructions! Reducing other player's earnings.</h1> + <h1>Important New Instructions</h1> + <h2>Reducing Other Player's Earnings</h2><hr><p> Beginning with the upcoming round you will have the option to reduce the earnings of diff -r 62b5da02b0bcb5813fe6e8b1e807fe8bd02f35e9 -r 0ee57867796a62492ab9d0a13eaeb23c4113a809 src/main/resources/configuration/indiana-experiments/2011/vote-punish/server.xml --- a/src/main/resources/configuration/indiana-experiments/2011/vote-punish/server.xml +++ b/src/main/resources/configuration/indiana-experiments/2011/vote-punish/server.xml @@ -176,7 +176,7 @@ <hr><p>Round {roundNumber} is the same as the previous round.</p><p>The length of this round is {duration}.</p> -<p>If you have any questions please raise your hand. <b>Do you have any questions so far?</b></p> +<p><b>Do you have any questions?</b> If you have any questions at this time please raise your hand and someone will come over to your station and answer it.</p> ]]></entry> https://bitbucket.org/virtualcommons/foraging/changeset/131e2e6862dd/ changeset: 131e2e6862dd user: alllee date: 2012-01-11 01:23:16 summary: updating foraging rules / strategies affected #: 1 file diff -r 0ee57867796a62492ab9d0a13eaeb23c4113a809 -r 131e2e6862ddfa41395062f771187eba8dcbfb50 src/main/java/edu/asu/commons/foraging/rules/ForagingRule.java --- a/src/main/java/edu/asu/commons/foraging/rules/ForagingRule.java +++ b/src/main/java/edu/asu/commons/foraging/rules/ForagingRule.java @@ -3,20 +3,20 @@ /** * $Id$ * - * A set of rules for the Indiana experiments run by Daniel DeCaro, Fall 2011. + * A set of rules for the Indiana experiments run by Daniel DeCaro in 2011/2012. * - * Split into a .iu subpackage if it turns out these aren't generic enough. + * Split into an .iu or other subpackage if it turns out these aren't generic enough. * * @author <a href='mailto:all...@as...'>Allen Lee</a> * @version $Rev$ */ public enum ForagingRule { - WAIT_TWO_MINUTES("Wait 2 minutes for the screen to fill up with green tokens. Then everyone collect tokens for the remaining amount of time."), - PRIVATE_PROPERTY("Each person gets a set area within which they can do whatever they want with the green tokens. With four people, each person gets one of the four corners."), - LIMITED_COLLECTION_RATE("Each person collects green tokens at a certain rate: 1 token every 3 seconds (i.e., count to 3 between each token you collect)."), - MAINTAIN_TOKEN_CLUSTERS("When someone collects from a cluster of green tokens (i.e., 3 or more tokens that are touching each other) that person leaves at least 2 tokens touching each other."), - LEAVE_TEN_FOR_REGROWTH("Collect green tokens until only about 10 are left; at that point, everyone must wait at least 1 minute before collecting any more tokens."), - NONE("No rule (Everyone can do whatever they want)."); + WAIT_ONE_MINUTE("Wait 60 seconds for the screen to fill up with tokens (the timer will have {remainingTime} left). Then everyone collects tokens for the remaining amount of time."), + PRIVATE_PROPERTY("Players divide the field up into four equally-sized areas and can do whatever they want within their area. With four people, each person takes an area around one of the four corners."), + LIMITED_COLLECTION_RATE("Each person collects tokens at a rate of 1 token every 4 seconds."), + MAINTAIN_TOKEN_CLUSTERS("Players leave two tokens untouched when the tokens are in a cluster of three or more that surround an empty cell."), + LEAVE_TEN_FOR_REGROWTH("Collect tokens until only 10 are left; at that point, everyone must wait at least 30 seconds before collecting any more tokens."), + NONE("Everyone can do whatever they want."); private final String description; https://bitbucket.org/virtualcommons/foraging/changeset/e54d653447fb/ changeset: e54d653447fb user: alllee date: 2012-01-11 07:26:21 summary: templatizing voting results, need to integrate strategy reminder and finish up the remaining screens next. affected #: 2 files diff -r 131e2e6862ddfa41395062f771187eba8dcbfb50 -r e54d653447fbdba25eb878886ea141c8a539f176 src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java --- a/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java +++ b/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java @@ -718,9 +718,20 @@ template.add("surveyId", id.getSurveyId()); return template.render(); } + + public String getSubmittedVoteInstructions() { + return getProperty("submitted-vote-instructions", "<h1>Submitted</h1><hr><p>Thank you for submitting your vote. Please wait while we tally the rest of the votes from the other members of your group.</p>"); + } - public String getVotingNominationInstructions() { + public String getVotingResults(List<ForagingRule> selectedRules) { + setSelectedRules(selectedRules); // FIXME: move to template style construction + ST template = createStringTemplate(getProperty("voting-results")); + template.add("tiebreaker", selectedRules.size() > 1); + template.add("selectedRules", selectedRules); + template.add("selectedRule", selectedRules.get(0)); + return template.render(); + /* StringBuilder builder = new StringBuilder("<h1>Voting Results</h1><hr>"); if (selectedRules.size() > 1) { // tiebreaker @@ -733,6 +744,7 @@ builder.append("<h1>Selected Rule</h1><hr>"); builder.append("<p><b>").append(selectedRules.get(0)).append("</b></p>"); return builder.toString(); + */ } @Override diff -r 131e2e6862ddfa41395062f771187eba8dcbfb50 -r e54d653447fbdba25eb878886ea141c8a539f176 src/main/java/edu/asu/commons/foraging/ui/GameWindow2D.java --- a/src/main/java/edu/asu/commons/foraging/ui/GameWindow2D.java +++ b/src/main/java/edu/asu/commons/foraging/ui/GameWindow2D.java @@ -750,6 +750,7 @@ private VotingForm votingForm; private HtmlEditorPane votingInstructionsEditorPane; + private JPanel getVotingPanel() { if (votingPanel == null) { votingPanel = new JPanel(); @@ -774,8 +775,7 @@ votingPanel.add(resultsForm); votingPanel.revalidate(); RoundConfiguration currentRoundConfiguration = client.getCurrentRoundConfiguration(); - currentRoundConfiguration.setSelectedRules(selectedRules); - votingInstructionsEditorPane.setText(currentRoundConfiguration.getVotingNominationInstructions()); + votingInstructionsEditorPane.setText(currentRoundConfiguration.getVotingResults(selectedRules)); showPanel(VotingForm.NAME); } }); @@ -895,8 +895,7 @@ } public void ruleVoteSubmitted() { - // TODO Auto-generated method stub - setInstructions("<h1>Submitted</h1><hr><p>Thank you for submitting your vote. Please wait while we tally the rest of the votes from the other members of your group.</p>"); + setInstructions(dataModel.getRoundConfiguration().getSubmittedVoteInstructions()); switchInstructionsPane(); } Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |