virtualcommons-svn Mailing List for Virtual Commons Experiment Software (Page 19)
Status: Beta
Brought to you by:
alllee
You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(21) |
Aug
(31) |
Sep
(6) |
Oct
(15) |
Nov
(2) |
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(4) |
Feb
(6) |
Mar
(12) |
Apr
(52) |
May
(14) |
Jun
(19) |
Jul
(81) |
Aug
(115) |
Sep
(36) |
Oct
(88) |
Nov
(46) |
Dec
(58) |
2010 |
Jan
(52) |
Feb
(55) |
Mar
(48) |
Apr
(15) |
May
(5) |
Jun
(38) |
Jul
(27) |
Aug
(24) |
Sep
(28) |
Oct
(1) |
Nov
(2) |
Dec
(29) |
2011 |
Jan
(87) |
Feb
(39) |
Mar
(63) |
Apr
(42) |
May
(26) |
Jun
(53) |
Jul
(23) |
Aug
(43) |
Sep
(37) |
Oct
(25) |
Nov
(4) |
Dec
(7) |
2012 |
Jan
(73) |
Feb
(79) |
Mar
(62) |
Apr
(28) |
May
(12) |
Jun
(2) |
Jul
(9) |
Aug
(1) |
Sep
(8) |
Oct
|
Nov
(3) |
Dec
(3) |
2013 |
Jan
(8) |
Feb
(16) |
Mar
(38) |
Apr
(74) |
May
(62) |
Jun
(15) |
Jul
(49) |
Aug
(19) |
Sep
(9) |
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(25) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Bitbucket <com...@bi...> - 2012-02-28 23:54:55
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/08ab85fd7a21/ changeset: 08ab85fd7a21 user: alllee date: 2012-02-29 00:54:46 summary: VotingForm now conditionally renders its radio buttons based on RoundConfiguration.isImposedStrategyEnabled affected #: 3 files diff -r 3fecb9d954fc2f21b415c17bfce09c89211833cd -r 08ab85fd7a2122a73b5d796ea20b6f9c4c55984c src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java --- a/src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java +++ b/src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java @@ -774,6 +774,7 @@ public Map<Strategy, Integer> generateVotingResults(boolean imposedStrategyEnabled) { Map<Strategy, Integer> tallyMap = new HashMap<Strategy, Integer>(); if (imposedStrategyEnabled) { + // short circuits to use the imposed strategy tallyMap.put(getImposedStrategy(), 1); selectedRules.add(getImposedStrategy()); return tallyMap; diff -r 3fecb9d954fc2f21b415c17bfce09c89211833cd -r 08ab85fd7a2122a73b5d796ea20b6f9c4c55984c src/main/java/edu/asu/commons/foraging/server/ForagingServer.java --- a/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java +++ b/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java @@ -401,15 +401,15 @@ } private void processNominations() { - // calculate votes boolean imposedStrategyEnabled = getCurrentRoundConfiguration().isImposedStrategyEnabled(); for (GroupDataModel group : serverDataModel.getGroups()) { + // calculate votes Map<Strategy, Integer> votingResults = group.generateVotingResults(imposedStrategyEnabled); List<Strategy> selectedRules = group.getSelectedRules(); for (Identifier id : group.getClientIdentifiers()) { sendFacilitatorMessage(String.format( - "%s selected [%s] from all rules (%s)", - group, selectedRules, votingResults)); + "%s selected [%s] from all rules %s (imposed? %s)", + group, selectedRules, votingResults, imposedStrategyEnabled)); transmit(new RuleSelectedUpdateEvent(id, selectedRules, votingResults)); } diff -r 3fecb9d954fc2f21b415c17bfce09c89211833cd -r 08ab85fd7a2122a73b5d796ea20b6f9c4c55984c 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 @@ -32,11 +32,15 @@ import javax.swing.WindowConstants; import edu.asu.commons.foraging.client.ForagingClient; +import edu.asu.commons.foraging.rules.Strategy; import edu.asu.commons.foraging.rules.iu.ForagingStrategy; import edu.asu.commons.ui.UserInterfaceUtils; /** * $Id$ + * + * Interface nominate a given ForagingStrategy + * * @author Allen Lee */ public class VotingForm extends JPanel { @@ -48,18 +52,18 @@ private ForagingClient client; public VotingForm(ForagingClient client) { - this(client, new HashMap<ForagingStrategy, Integer>()); + this(client, new HashMap<Strategy, Integer>()); } - public VotingForm(ForagingClient client, Map<ForagingStrategy, Integer> votingResults) { + public VotingForm(ForagingClient client, Map<Strategy, Integer> votingResults) { this.client = client; initComponents(); initForm(votingResults); setName(NAME); } - private void initForm(Map<ForagingStrategy, Integer> votingResults) { - ForagingStrategy[] rules = ForagingStrategy.values(); + private void initForm(Map<Strategy, Integer> votingResults) { + ForagingStrategy[] strategies = ForagingStrategy.values(); JPanel panel = new JPanel(); GroupLayout groupLayout = new GroupLayout(panel); panel.setLayout(groupLayout); @@ -84,22 +88,26 @@ verticalGroup.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(strategyHeaderLabel).addGap(20).addComponent(rightHeaderLabel)); Dimension labelDimension = new Dimension(800, 100); - for (ForagingStrategy rule: rules) { - JLabel ruleLabel = new JLabel("<html>" + rule.getDescription() + "</html>"); + boolean imposedStrategyEnabled = client.getCurrentRoundConfiguration().isImposedStrategyEnabled(); + for (ForagingStrategy strategy: strategies) { + JLabel ruleLabel = new JLabel("<html>" + strategy.getDescription() + "</html>"); ruleLabel.setFont(UserInterfaceUtils.DEFAULT_PLAIN_FONT); ruleLabel.setMaximumSize(labelDimension); horizontalLabelParallelGroup.addComponent(ruleLabel); JComponent component = null; if (votingResults.isEmpty()) { JRadioButton radioButton = new JRadioButton(); - radioButton.setActionCommand(rule.name()); + radioButton.setActionCommand(strategy.name()); buttonGroup.add(radioButton); component = radioButton; horizontalButtonParallelGroup.addComponent(radioButton); verticalGroup.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(ruleLabel).addComponent(radioButton)); } + else if (imposedStrategyEnabled) { + component = new JLabel(""); + } else { - Integer numberOfVotes = votingResults.get(rule); + Integer numberOfVotes = votingResults.get(strategy); component = new JLabel(String.valueOf(numberOfVotes == null ? 0 : numberOfVotes)); } horizontalButtonParallelGroup.addComponent(component); 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. |
From: Bitbucket <com...@bi...> - 2012-02-28 07:57:31
|
2 new commits in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/ffd3e3edacdb/ changeset: ffd3e3edacdb user: alllee date: 2012-02-28 08:56:35 summary: adding imposed strategy instructions to voting-instructions template affected #: 3 files diff -r 2f8283b23b0c06845bc083903801b0c31803aa04 -r ffd3e3edacdb88ff8446862ff21e89792794faef 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 @@ -3,6 +3,7 @@ import java.awt.Dimension; import java.text.NumberFormat; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -20,6 +21,7 @@ import edu.asu.commons.foraging.model.ResourceDispenser; import edu.asu.commons.foraging.model.ServerDataModel; import edu.asu.commons.foraging.rules.Strategy; +import edu.asu.commons.foraging.rules.iu.ForagingStrategy; import edu.asu.commons.foraging.rules.iu.ForagingStrategyNomination; import edu.asu.commons.net.Identifier; import edu.asu.commons.util.Duration; @@ -736,6 +738,10 @@ template.add("selectedRules", selectedRules); return template.render(); } + + public List<ForagingStrategy> getForagingStrategies() { + return Arrays.asList(ForagingStrategy.values()); + } public String getVotingResultsTemplate() { return getProperty("voting-results", getParentConfiguration().getVotingResults()); diff -r 2f8283b23b0c06845bc083903801b0c31803aa04 -r ffd3e3edacdb88ff8446862ff21e89792794faef src/main/resources/configuration/iu/2011/imposed-punish/server.xml --- a/src/main/resources/configuration/iu/2011/imposed-punish/server.xml +++ b/src/main/resources/configuration/iu/2011/imposed-punish/server.xml @@ -322,6 +322,21 @@ </entry><entry key='voting-instructions'><![CDATA[ +{if (self.imposedStrategyEnabled)} +<h1>Strategies</h1> +<hr> + <p>You now have the opportunity to consider {self.foragingStrategies.size} + possible strategies for managing how you and the other members of your group + collect tokens for the rest of the experiment. + </p> + <p> + Below is the list of different strategies. Please read the list carefully. + Press "Submit" once you have finished reviewing the strategies. + </p> + <ol> + {foragingStrategies: { strategy | <li>{strategy}</li> }} + </ol> +{else} <h1>Strategy Nomination Instructions</h1><hr><p> @@ -336,9 +351,9 @@ Therefore, neither you nor the experimenter will know who nominated a particular strategy. </p> +{endif} ]]></entry> - <entry key='imposed-strategy-instructions'><![CDATA[ <h1>Important New Instructions!</h1> diff -r 2f8283b23b0c06845bc083903801b0c31803aa04 -r ffd3e3edacdb88ff8446862ff21e89792794faef src/main/resources/configuration/iu/2011/imposed/server.xml --- a/src/main/resources/configuration/iu/2011/imposed/server.xml +++ b/src/main/resources/configuration/iu/2011/imposed/server.xml @@ -323,6 +323,21 @@ <entry key='voting-instructions'><![CDATA[ +{if (self.imposedStrategyEnabled)} +<h1>Strategies</h1> +<hr> + <p>You now have the opportunity to consider {self.foragingStrategies.size} + possible strategies for managing how you and the other members of your group + collect tokens for the rest of the experiment. + </p> + <p> + Below is the list of different strategies. Please read the list carefully. + Press "Submit" once you have finished reviewing the strategies. + </p> + <ol> + {foragingStrategies: { strategy | <li>{strategy}</li> }} + </ol> +{else} <h1>Strategy Nomination Instructions</h1><hr><p> @@ -337,6 +352,7 @@ Therefore, neither you nor the experimenter will know who nominated a particular strategy. </p> +{endif} ]]></entry> https://bitbucket.org/virtualcommons/foraging/changeset/3fecb9d954fc/ changeset: 3fecb9d954fc user: alllee date: 2012-02-28 08:57:29 summary: treating voting instructions as a StringTemplate affected #: 1 file diff -r ffd3e3edacdb88ff8446862ff21e89792794faef -r 3fecb9d954fc2f21b415c17bfce09c89211833cd 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 @@ -559,7 +559,7 @@ } public String getVotingInstructions() { - return getProperty("voting-instructions"); + return render(getProperty("voting-instructions")); } public String getInitialVotingInstructions() { 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. |
From: Bitbucket <com...@bi...> - 2012-02-28 07:19:01
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/2f8283b23b0c/ changeset: 2f8283b23b0c user: alllee date: 2012-02-28 08:18:03 summary: adding conditional logic to generateVotingResults for imposed condition serializability breaking change for imposed condition; replacing ForagingStrategy with Strategy in most places affected #: 8 files diff -r 9fed51acc53c15790e7b7145d5ba60d07a3392fa -r 2f8283b23b0c06845bc083903801b0c31803aa04 src/main/java/edu/asu/commons/foraging/client/ClientDataModel.java --- a/src/main/java/edu/asu/commons/foraging/client/ClientDataModel.java +++ b/src/main/java/edu/asu/commons/foraging/client/ClientDataModel.java @@ -18,7 +18,7 @@ import edu.asu.commons.foraging.model.ForagingDataModel; import edu.asu.commons.foraging.model.GroupDataModel; import edu.asu.commons.foraging.model.Resource; -import edu.asu.commons.foraging.rules.iu.ForagingStrategy; +import edu.asu.commons.foraging.rules.Strategy; import edu.asu.commons.net.Identifier; import edu.asu.commons.util.Duration; /** @@ -46,7 +46,7 @@ // these are the subjects that have sanctioned us. private Map<Identifier, Duration> sanctioners = new HashMap<Identifier, Duration>(); - private List<ForagingStrategy> selectedRules = new ArrayList<ForagingStrategy>(); + private List<Strategy> selectedRules = new ArrayList<Strategy>(); private ForagingClient client; private volatile boolean explicitCollectionMode = false; @@ -272,11 +272,11 @@ } // FIXME: deprecate and remove these later - public void setSelectedRules(List<ForagingStrategy> selectedRules) { + public void setSelectedRules(List<Strategy> selectedRules) { this.selectedRules = selectedRules; } - public List<ForagingStrategy> getSelectedRules() { + public List<Strategy> getSelectedRules() { return selectedRules; } diff -r 9fed51acc53c15790e7b7145d5ba60d07a3392fa -r 2f8283b23b0c06845bc083903801b0c31803aa04 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 @@ -3,7 +3,6 @@ import java.awt.Dimension; import java.text.NumberFormat; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -21,7 +20,6 @@ import edu.asu.commons.foraging.model.ResourceDispenser; import edu.asu.commons.foraging.model.ServerDataModel; import edu.asu.commons.foraging.rules.Strategy; -import edu.asu.commons.foraging.rules.iu.ForagingStrategy; import edu.asu.commons.foraging.rules.iu.ForagingStrategyNomination; import edu.asu.commons.net.Identifier; import edu.asu.commons.util.Duration; @@ -58,7 +56,7 @@ private static final double DEFAULT_TOKEN_MOVEMENT_PROBABILITY = 0.2d; private static final double DEFAULT_TOKEN_BIRTH_PROBABILITY = 0.01d; - private List<ForagingStrategy> selectedRules; + private List<Strategy> selectedRules; public double getTrustGamePayoffIncrement() { return getDoubleProperty("trust-game-payoff", 0.25d); @@ -566,10 +564,6 @@ return createStringTemplate(getProperty("initial-voting-instructions")).render(); } - public List<ForagingStrategy> getForagingRules() { - return Arrays.asList(ForagingStrategy.values()); - - } public boolean isVotingAndRegulationEnabled() { return getBooleanProperty("voting-and-regulation-enabled", false); } @@ -729,10 +723,10 @@ return getProperty("submitted-vote-instructions", "<h1>Submitted</h1><hr><p>Your nomination has been recorded. The final results of the nomination will be shown once all the nominations in your group have been received.</p>"); } - public String generateVotingResults(List<ForagingStrategy> selectedRules, Map<ForagingStrategy, Integer> nominations) { + public String generateVotingResults(List<Strategy> selectedRules, Map<Strategy, Integer> nominations) { List<ForagingStrategyNomination> sortedNominations = new ArrayList<ForagingStrategyNomination>(); - for (Map.Entry<ForagingStrategy, Integer> entry: new TreeMap<ForagingStrategy, Integer>(nominations).entrySet()) { - ForagingStrategy strategy = entry.getKey(); + for (Map.Entry<Strategy, Integer> entry: new TreeMap<Strategy, Integer>(nominations).entrySet()) { + Strategy strategy = entry.getKey(); sortedNominations.add(new ForagingStrategyNomination(strategy, entry.getValue(), strategy.equals(selectedRules.get(0)))); } setSelectedRules(selectedRules); @@ -776,11 +770,11 @@ return template.render(); } - public List<ForagingStrategy> getSelectedRules() { + public List<Strategy> getSelectedRules() { return selectedRules; } - public void setSelectedRules(List<ForagingStrategy> selectedRules) { + public void setSelectedRules(List<Strategy> selectedRules) { this.selectedRules = selectedRules; } diff -r 9fed51acc53c15790e7b7145d5ba60d07a3392fa -r 2f8283b23b0c06845bc083903801b0c31803aa04 src/main/java/edu/asu/commons/foraging/event/RuleSelectedUpdateEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/RuleSelectedUpdateEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/RuleSelectedUpdateEvent.java @@ -5,7 +5,7 @@ import java.util.Map; import edu.asu.commons.event.AbstractPersistableEvent; -import edu.asu.commons.foraging.rules.iu.ForagingStrategy; +import edu.asu.commons.foraging.rules.Strategy; import edu.asu.commons.net.Identifier; /** @@ -21,24 +21,24 @@ public class RuleSelectedUpdateEvent extends AbstractPersistableEvent { private static final long serialVersionUID = 4360213814026474451L; - private final List<ForagingStrategy> selectedStrategies; - private final Map<ForagingStrategy, Integer> votingResults; + private final List<Strategy> selectedStrategies; + private final Map<Strategy, Integer> votingResults; - public RuleSelectedUpdateEvent(Identifier id, List<ForagingStrategy> selectedStrategies, Map<ForagingStrategy, Integer> votingResults) { + public RuleSelectedUpdateEvent(Identifier id, List<Strategy> selectedStrategies, Map<Strategy, Integer> votingResults) { super(id, String.format("Strategies (first is tiebreaker): %s, All nominations: %s", selectedStrategies, votingResults)); this.selectedStrategies = selectedStrategies; this.votingResults = votingResults; } - public ForagingStrategy getSelectedRule() { + public Strategy getSelectedRule() { return selectedStrategies.get(0); } - public List<ForagingStrategy> getSelectedStrategies() { + public List<Strategy> getSelectedStrategies() { return selectedStrategies; } - public Map<ForagingStrategy, Integer> getVotingResults() { + public Map<Strategy, Integer> getVotingResults() { return votingResults; } diff -r 9fed51acc53c15790e7b7145d5ba60d07a3392fa -r 2f8283b23b0c06845bc083903801b0c31803aa04 src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java --- a/src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java +++ b/src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java @@ -79,7 +79,7 @@ private ArrayList<RegulationData> submittedRegulations = new ArrayList<RegulationData>(); - private ArrayList<ForagingStrategy> selectedRules; + private ArrayList<Strategy> selectedRules; public GroupDataModel(ServerDataModel serverDataModel) { this(serverDataModel, nextGroupId++); @@ -766,9 +766,18 @@ public EventChannel getEventChannel() { return serverDataModel.getEventChannel(); } + + public Map<Strategy, Integer> generateVotingResults() { + return generateVotingResults(getRoundConfiguration().isImposedStrategyEnabled()); + } - public Map<ForagingStrategy, Integer> generateVotingResults() { - Map<ForagingStrategy, Integer> tallyMap = new HashMap<ForagingStrategy, Integer>(); + public Map<Strategy, Integer> generateVotingResults(boolean imposedStrategyEnabled) { + Map<Strategy, Integer> tallyMap = new HashMap<Strategy, Integer>(); + if (imposedStrategyEnabled) { + tallyMap.put(getImposedStrategy(), 1); + selectedRules.add(getImposedStrategy()); + return tallyMap; + } for (ClientData client: clients.values()) { ForagingStrategy rule = client.getVotedRule(); Integer count = tallyMap.get(rule); @@ -777,9 +786,9 @@ } tallyMap.put(rule, count + 1); } - selectedRules = new ArrayList<ForagingStrategy>(); + selectedRules = new ArrayList<Strategy>(); Integer maxSeenValue = 0; - for (Map.Entry<ForagingStrategy, Integer> entry : tallyMap.entrySet()) { + for (Map.Entry<Strategy, Integer> entry : tallyMap.entrySet()) { Integer currentValue = entry.getValue(); // getLogger().info("rule : " + entry.getKey() + " has a vote value of " + currentValue); @@ -801,12 +810,12 @@ return tallyMap; } - public List<ForagingStrategy> getSelectedRules() { + public List<Strategy> getSelectedRules() { return selectedRules; } - public ForagingStrategy getSelectedRule() { + public Strategy getSelectedRule() { return selectedRules.get(0); } diff -r 9fed51acc53c15790e7b7145d5ba60d07a3392fa -r 2f8283b23b0c06845bc083903801b0c31803aa04 src/main/java/edu/asu/commons/foraging/rules/iu/ForagingStrategyNomination.java --- a/src/main/java/edu/asu/commons/foraging/rules/iu/ForagingStrategyNomination.java +++ b/src/main/java/edu/asu/commons/foraging/rules/iu/ForagingStrategyNomination.java @@ -1,16 +1,18 @@ package edu.asu.commons.foraging.rules.iu; +import edu.asu.commons.foraging.rules.Strategy; + public class ForagingStrategyNomination { - private final ForagingStrategy strategy; + private final Strategy strategy; private final Integer nominations; private final boolean selected; - public ForagingStrategyNomination(ForagingStrategy strategy, Integer nominations, boolean selected) { + public ForagingStrategyNomination(Strategy strategy, Integer nominations, boolean selected) { this.strategy = strategy; this.nominations = nominations; this.selected = selected; } - public ForagingStrategy getStrategy() { + public Strategy getStrategy() { return strategy; } public Integer getNominations() { diff -r 9fed51acc53c15790e7b7145d5ba60d07a3392fa -r 2f8283b23b0c06845bc083903801b0c31803aa04 src/main/java/edu/asu/commons/foraging/server/ForagingServer.java --- a/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java +++ b/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java @@ -76,7 +76,7 @@ import edu.asu.commons.foraging.model.ResourceDispenser; import edu.asu.commons.foraging.model.ServerDataModel; import edu.asu.commons.foraging.model.TrustGameResult; -import edu.asu.commons.foraging.rules.iu.ForagingStrategy; +import edu.asu.commons.foraging.rules.Strategy; import edu.asu.commons.foraging.ui.Circle; import edu.asu.commons.net.Dispatcher; import edu.asu.commons.net.Identifier; @@ -369,7 +369,6 @@ }); addEventProcessor(new EventTypeProcessor<RuleVoteRequest>(RuleVoteRequest.class) { int votesReceived = 0; - @Override public void handle(RuleVoteRequest request) { sendFacilitatorMessage("Received vote rule request: " + request); @@ -377,19 +376,7 @@ client.setVotedRule(request.getRule()); votesReceived++; if (votesReceived >= clients.size()) { - // calculate votes - for (GroupDataModel group : serverDataModel.getGroups()) { - Map<ForagingStrategy, Integer> votingResults = group.generateVotingResults(); - List<ForagingStrategy> selectedRules = group.getSelectedRules(); - for (Identifier id : group.getClientIdentifiers()) { - sendFacilitatorMessage(String.format( - "%s selected [%s] from all rules (%s)", - group, selectedRules, votingResults)); - - transmit(new RuleSelectedUpdateEvent(id, selectedRules, votingResults)); - } - store(new RuleSelectedUpdateEvent(facilitatorId, selectedRules, votingResults)); - } + processNominations(); } } }); @@ -412,6 +399,23 @@ }); } + + private void processNominations() { + // calculate votes + boolean imposedStrategyEnabled = getCurrentRoundConfiguration().isImposedStrategyEnabled(); + for (GroupDataModel group : serverDataModel.getGroups()) { + Map<Strategy, Integer> votingResults = group.generateVotingResults(imposedStrategyEnabled); + List<Strategy> selectedRules = group.getSelectedRules(); + for (Identifier id : group.getClientIdentifiers()) { + sendFacilitatorMessage(String.format( + "%s selected [%s] from all rules (%s)", + group, selectedRules, votingResults)); + + transmit(new RuleSelectedUpdateEvent(id, selectedRules, votingResults)); + } + store(new RuleSelectedUpdateEvent(facilitatorId, selectedRules, votingResults)); + } + } @Deprecated @SuppressWarnings("unused") diff -r 9fed51acc53c15790e7b7145d5ba60d07a3392fa -r 2f8283b23b0c06845bc083903801b0c31803aa04 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 @@ -57,7 +57,6 @@ import edu.asu.commons.foraging.model.ClientData; import edu.asu.commons.foraging.model.Direction; import edu.asu.commons.foraging.rules.Strategy; -import edu.asu.commons.foraging.rules.iu.ForagingStrategy; import edu.asu.commons.net.Identifier; import edu.asu.commons.ui.HtmlEditorPane; import edu.asu.commons.ui.UserInterfaceUtils; @@ -756,7 +755,7 @@ showPanel(VotingForm.NAME); } - public void showVotingResults(final List<ForagingStrategy> selectedRules, final Map<ForagingStrategy, Integer> votingResults) { + public void showVotingResults(final List<Strategy> selectedRules, final Map<Strategy, Integer> votingResults) { SwingUtilities.invokeLater(new Runnable() { public void run() { votingPanel.removeAll(); diff -r 9fed51acc53c15790e7b7145d5ba60d07a3392fa -r 2f8283b23b0c06845bc083903801b0c31803aa04 src/test/java/edu/asu/commons/foraging/model/GroupDataModelTest.java --- a/src/test/java/edu/asu/commons/foraging/model/GroupDataModelTest.java +++ b/src/test/java/edu/asu/commons/foraging/model/GroupDataModelTest.java @@ -44,7 +44,7 @@ data.setVotedRule(rule); } // verify that this is the rule in place. - Map<ForagingStrategy, Integer> votingResults = group.generateVotingResults(); + Map<Strategy, Integer> votingResults = group.generateVotingResults(); assertEquals(1, votingResults.size()); assertEquals(rule, group.getSelectedRule()); } @@ -74,7 +74,7 @@ ForagingStrategy votedRule = rules.get(index); data.setVotedRule(votedRule); } - Map<ForagingStrategy, Integer> votingResults = group.generateVotingResults(); + Map<Strategy, Integer> votingResults = group.generateVotingResults(); assertEquals("There should be 3 rules voted on, total: " + votingResults, 3, votingResults.size()); for (ForagingStrategy tieBreaker: tieBreakerRules) { assertEquals(2, votingResults.get(tieBreaker).intValue()); 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. |
From: Bitbucket <com...@bi...> - 2012-02-28 07:01:08
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/9fed51acc53c/ changeset: 9fed51acc53c user: alllee date: 2012-02-28 08:01:02 summary: fixing one survey url affected #: 1 file diff -r 496f0b8bea899488a8fc991448e447d2f0859dcd -r 9fed51acc53c15790e7b7145d5ba60d07a3392fa src/main/resources/configuration/iu/2011/imposed-punish/round4.xml --- a/src/main/resources/configuration/iu/2011/imposed-punish/round4.xml +++ b/src/main/resources/configuration/iu/2011/imposed-punish/round4.xml @@ -87,7 +87,7 @@ <entry key='external-survey-enabled'>true</entry><entry key='survey-url'> - <![CDATA[https://qtrial.qualtrics.com/SE/?SID=SV_cLX7jnYikmD9eSM&SURVEY_ID={surveyId}]]> + <![CDATA[https://qtrial.qualtrics.com/SE/?SID=SV_3jHrnndEZSM9cqM&SURVEY_ID={surveyId}]]></entry><entry key='sanction-type'>real-time</entry> 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. |
From: Bitbucket <com...@bi...> - 2012-02-28 06:51:44
|
2 new commits in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/8639f59f997a/ changeset: 8639f59f997a user: alllee date: 2012-02-28 07:51:22 summary: adding imposed punish treatment configuration files affected #: 11 files diff -r 3c1fc2c5a4b6a82787547c25e48157d52c33effb -r 8639f59f997a8e3066d30a66aea91e954ebbd289 src/main/resources/configuration/iu/2011/imposed-punish/round0.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed-punish/round0.xml @@ -0,0 +1,103 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="resource-width">13</entry> +<entry key="resource-depth">13</entry> +<entry key="practice-round">true</entry> +<entry key="private-property">true</entry> +<entry key="duration">240</entry> + +<entry key="quiz">true</entry> +<entry key="q1">C</entry> +<entry key="q2">B</entry> + +<entry key='instructions'> +<![CDATA[ +<h2>Practice Round Instructions</h2> +<hr> +<p> + Once everyone has finished the quiz, we will start a practice round of the token + task. +</p> +<p> + During the practice round, you will have {duration} to practice with the + experimental environment. The decisions you make in this round will NOT + influence your earnings. At the beginning of the practice round + {initialDistribution} of the cells are occupied with green tokens. The + environment is a {self.resourceWidth} x {self.resourceDepth} grid of cells. +</p> +<p> +During this practice round, and <b>only during</b> this practice round, you are able +to reset the tokens displayed on the screen. When you push the <b>R</b> key +you will reset the distribution of the tokens to randomly occupying +{initialDistribution} of the cells with green tokens. +</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> + +<entry key="quiz-instructions"> +<![CDATA[ +<h2>Quiz</h2> +<hr> +<p> + In a moment, you will do a practice round of the token task. Before we go to + the practice round, answer the following questions to make sure you understand + the instructions. You will earn {quizCorrectAnswerReward} for each correct answer. +</p> +<br><br> +<form> +<span class='q1'>Q1. Which of these statements is NOT correct?</span><br> +<input type="radio" name="q1" value="A">A. Your decisions of where to collect tokens affects the regeneration of tokens.<br> +<input type="radio" name="q1" value="B">B. When you have collected all tokens on the screen, no new tokens will appear.<br> +<input type="radio" name="q1" value="C">C. Tokens grow from the middle of the screen.<br> +<input type="radio" name="q1" value="D">D. To collect a token you need to press the space bar while your yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"></img> is on a cell with a token.<br> +<br><br> +<span class='q2'>Q2. Which sequence of situations is not possible?</span><br> +<img src="@CODEBASE_URL@/images/question2.jpg"></img><br> +<input type="radio" name="q2" value="A">A<br> +<input type="radio" name="q2" value="B">B<br> +<input type="radio" name="q2" value="C">C<br> +<input type="submit" name="submit" value="Submit"><br> +</form> +]]> +</entry> +<entry key='quiz-results'> + <![CDATA[ + <h2>Quiz Results</h2> + <hr> + <p> + {if (allCorrect)} + You have answered all the questions correctly and earned <b>{totalQuizEarnings}</b>. + {else} + You answered {numberCorrect} out of {totalQuestions} questions correctly + and earned <b>{totalQuizEarnings}</b>. Questions you've answered + incorrectly are highlighted in red. Please see below for more details. + {endif} + </p> + <hr> +<form> +<span class='q1'>Q1. Which of these statements is NOT correct?</span><br> + <b>{incorrect_q1} + In this question, "A", "B", and "D" are all true. "C" is false. Tokens only + regenerate when there are other tokens present in their immediately neighboring + cells. They do not spontaneously generate from the middle of the screen. + </b> +<br> +A. Your decisions of where to collect tokens affects the regeneration of tokens.<br> +B. When you have collected all tokens on the screen, no new tokens will appear.<br> +C. Tokens grow from the middle of the screen.<br> +D. To collect a token you need to press the space bar while your yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"></img> is on a cell with a token.<br> +<br> +<span class='q2'>Q2. Which sequence of situations is not possible?</span><br> + <b> + {incorrect_q2} + In this question, sequence "B" is not possible. Tokens cannot regenerate on an empty screen as shown in sequence B. + </b> + <br> +<img src="@CODEBASE_URL@/images/question2.jpg"></img><br> +</form> + ]]> +</entry> +</properties> diff -r 3c1fc2c5a4b6a82787547c25e48157d52c33effb -r 8639f59f997a8e3066d30a66aea91e954ebbd289 src/main/resources/configuration/iu/2011/imposed-punish/round1.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed-punish/round1.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="duration">240</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Instructions for Round {self.roundNumber}</h3> +<hr> +<p> + The first round of the experiment will begin in a moment. The length of the + round is {duration}. As in the practice round you can collect green tokens. + This time you will earn <b>{dollarsPerToken}</b> for each token collected. This time + you <b>cannot</b> reset the distribution of green tokens. +</p> +<h3>Groups</h3> +<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, <b>each of you in this room has been randomly assigned to one of several +equally-sized {self.clientsPerGroup} person groups.,</b> And everyone in your group has been +randomly assigned a number from 1 to {self.clientsPerGroup}. <b>You will stay in +the same group for the entire experiment</b>, and each person's number from 1 to +{self.clientsPerGroup} will remain the same throughout the experiment. The other +members of 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 + collected at the top right corner of the screen. On the top left corner of the + screen, you will see the remaining time in the round. +</p> +<h3>Anonymity</h3> +<hr> +<p> + Because group membership was randomly assigned by the computer, neither you nor + the experimenter will be able to identify which person in the room has been + assigned to a particular group or number within a group. Your anonymity is + guaranteed. +</p> +<h3>Tokens</h3> +<hr> + <p> + Each group has its own set of token resources. + </p> +<p> +<b>Do you have any questions so far?</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> +</properties> diff -r 3c1fc2c5a4b6a82787547c25e48157d52c33effb -r 8639f59f997a8e3066d30a66aea91e954ebbd289 src/main/resources/configuration/iu/2011/imposed-punish/round2.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed-punish/round2.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="duration">240</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> + + +<!-- enable field of vision for tokens and subjects --> +<entry key='initial-distribution'>.25</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +</properties> diff -r 3c1fc2c5a4b6a82787547c25e48157d52c33effb -r 8639f59f997a8e3066d30a66aea91e954ebbd289 src/main/resources/configuration/iu/2011/imposed-punish/round3.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed-punish/round3.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="duration">240</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<!-- resource regrowth parameters --> +<entry key="initial-distribution">.25</entry> + +</properties> diff -r 3c1fc2c5a4b6a82787547c25e48157d52c33effb -r 8639f59f997a8e3066d30a66aea91e954ebbd289 src/main/resources/configuration/iu/2011/imposed-punish/round4.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed-punish/round4.xml @@ -0,0 +1,96 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> +<entry key="duration">240</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<entry key="initial-distribution">.25</entry> +<entry key='voting-enabled'>true</entry> +<entry key="instructions"> + <![CDATA[ + <h1>Important New Instructions!</h1> + <h2>Reducing Other Player's Earnings</h2> + <hr> +<p> +Round {self.roundNumber} is about to begin. You will now have the option to reduce the +earnings of another participant at a cost to your own earnings by typing that +participants' number key from 1 to {self.clientsPerGroup}. +</p> + <ul> + <li>Each player in your group has a number from 1 to {self.clientsPerGroup}. If + you press a number key 1-{self.clientsPerGroup}, you will reduce the number + of tokens that player has collected during the round by + {self.sanctionPenalty} tokens. This will also reduce your own token amount by + {self.sanctionCost} token. The decision whether or when to use this option is + up to you. + </li> + <li>When you reduce the number of tokens of another participant, they will + receive a message stating that you have reduced their tokens. Likewise, if + another participant reduces your number of tokens, you will also receive a + message. These messages will be displayed on the bottom of your screen. + </li> + <li>If your tokens are being reduced or you are reducing another participant's + tokens, you will receive some visual cues. When your tokens are being reduced + your yellow dot will turn red briefly with a blue background. The participant + currently reducing your tokens will turn purple with a white background. + </li> + <li>You may reduce the earnings of other participants as long as (1) there are + tokens remaining on the screen and (2) both you and the other participant + have a positive number of tokens collected during the round. <b>Each time</b> + you press the numeric key corresponding to another participant your token + amount is reduced by <b>{self.sanctionCost}</b>, and their token amount is reduced by + <b>{self.sanctionPenalty}</b>. + </li> + </ul> + <p> + The length of this round is {duration}. + </p> +<h2>Strategy Reminder</h2> +<hr> + <p> + Reminder: + </p> + <ul> + <li><b>{first(self.selectedRules)}</b></li> + </ul> +<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>Strategy Nomination Instructions</h1> +<hr> +<p> +To nominate a strategy, click the radio button that is to the right of the one you choose; 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 strategy will NOT be revealed. +Therefore, neither you nor the experimenter will know who nominated a particular +strategy. +</p> +]]> +</entry> + +<entry key='external-survey-enabled'>true</entry> +<entry key='survey-url'> + <![CDATA[https://qtrial.qualtrics.com/SE/?SID=SV_cLX7jnYikmD9eSM&SURVEY_ID={surveyId}]]> +</entry> + +<entry key='sanction-type'>real-time</entry> +<entry key="sanction-cost">1</entry> +<entry key="sanction-multiplier">2</entry> +</properties> diff -r 3c1fc2c5a4b6a82787547c25e48157d52c33effb -r 8639f59f997a8e3066d30a66aea91e954ebbd289 src/main/resources/configuration/iu/2011/imposed-punish/round5.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed-punish/round5.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> +<entry key="duration">240</entry> + +<entry key="initial-distribution">.25</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> +<entry key='sanction-type'>real-time</entry> +<entry key="sanction-cost">1</entry> +<entry key="sanction-multiplier">2</entry> +</properties> diff -r 3c1fc2c5a4b6a82787547c25e48157d52c33effb -r 8639f59f997a8e3066d30a66aea91e954ebbd289 src/main/resources/configuration/iu/2011/imposed-punish/round6.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed-punish/round6.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> +<entry key="duration">240</entry> + +<entry key="initial-distribution">.25</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<entry key='sanction-type'>real-time</entry> +<entry key="sanction-cost">1</entry> +<entry key="sanction-multiplier">2</entry> +</properties> diff -r 3c1fc2c5a4b6a82787547c25e48157d52c33effb -r 8639f59f997a8e3066d30a66aea91e954ebbd289 src/main/resources/configuration/iu/2011/imposed-punish/round7.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed-punish/round7.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> +<entry key="duration">240</entry> + +<entry key="initial-distribution">.25</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + + +<entry key='external-survey-enabled'>true</entry> +<entry key='survey-url'> + <![CDATA[https://qtrial.qualtrics.com/SE/?SID=SV_3efXdNaJ6EXZ0S8&SURVEY_ID={surveyId}]]> +</entry> + + +<entry key="instructions"> +<![CDATA[ +<h2>Important New Instructions!</h2> +<hr> +<p> +<b>From this point forward, participants will NOT have the option to reduce the earnings of another participant.</b> +</p> + +<h2>Round {self.roundNumber}</h2> +<hr> +<p> +Round {self.roundNumber} is about to begin. The length of this round is again {duration}.</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> +</properties> diff -r 3c1fc2c5a4b6a82787547c25e48157d52c33effb -r 8639f59f997a8e3066d30a66aea91e954ebbd289 src/main/resources/configuration/iu/2011/imposed-punish/round8.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed-punish/round8.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> +<entry key="duration">240</entry> + +<entry key="initial-distribution">.25</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +</properties> diff -r 3c1fc2c5a4b6a82787547c25e48157d52c33effb -r 8639f59f997a8e3066d30a66aea91e954ebbd289 src/main/resources/configuration/iu/2011/imposed-punish/round9.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed-punish/round9.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> +<entry key="duration">240</entry> + +<entry key="initial-distribution">.25</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + + +<entry key='external-survey-enabled'>true</entry> +<entry key='survey-url'> + <![CDATA[https://qtrial.qualtrics.com/SE/?SID=SV_e8rPe7yyhue5OVm&SURVEY_ID={surveyId}]]> +</entry> + +<entry key='survey-instructions'> + <![CDATA[ + <h1>Survey</h1> + <hr> + <p> + We would like to again ask you some quick questions. Please <a href='{surveyUrl}'>click here</a> to begin the survey. + </p> + <p> + We will continue after all of the surveys have been completed by all the + participants in the room. Please press the "Continue" button at the + bottom of the screen after you have successfully completed the survey. + </p> + <p> + If you encounter any problems with the survey <b>please inform the experimenter</b>. + </p> + <br> + <form> + <input type="submit" value="Continue" name="continue"> + </form> + ]]> +</entry> + + +</properties> diff -r 3c1fc2c5a4b6a82787547c25e48157d52c33effb -r 8639f59f997a8e3066d30a66aea91e954ebbd289 src/main/resources/configuration/iu/2011/imposed-punish/server.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed-punish/server.xml @@ -0,0 +1,368 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging experiment server configuration</comment> +<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="wait-for-participants">true</entry> +<entry key="number-of-rounds">10</entry> +<entry key='external-survey-enabled'>true</entry> +<entry key='imposed-strategy-enabled'>true</entry> +<entry key='survey-id-enabled'>true</entry> +<entry key='survey-instructions'> + <![CDATA[ + <h1>Survey</h1> + <hr> + <p> + Before we continue to the next round of the token task, we would like to ask you + some quick questions. Please <a href='{surveyUrl}'>click here</a> to + begin the survey. + </p> + <p> + We will continue with the rest of the experiment after all of the + surveys have been completed by all the participants in the room. Please + press the "Continue" button at the bottom of the screen after you have + successfully completed the survey. + </p> + <p> + If you encounter any problems with the survey <b>please inform the experimenter</b>. + </p> + <br> + <form> + <input type="submit" value="Continue" name="continue"> + </form> + ]]> +</entry> + +<entry key="facilitator-instructions"> +<![CDATA[ +<p> + This facilitator interface allows you to control the experiment. In general you + will be following a sequence similar to this: + <ol> + <li>Show instructions</li> + <li>Start round</li> + <li>After round is over + <ol> + <li>show trust game if necessary</li> + <li>start standalone chat round if necessary</li> + </ol> + </li> + <li>Goto 1.</li> + </ol> +</p> +]]> +</entry> + +<entry key="welcome-instructions"> +<![CDATA[ +<h1>Welcome</h1> +<hr> +<p> +Welcome to the experiment. The experiment will begin shortly after everyone has been +assigned a station. +<br><br> +Please <b>wait quietly</b> and <b>do not close this window, open any other + applications, or communicate with any of the other participants</b> unless you +are told to do so. +</p> +]]> +</entry> + +<entry key="general-instructions"> +<![CDATA[ +<h1>General Instructions</h1> +<h2>Your Earnings</h2> +<hr> +<p> + You have already earned {showUpPayment} by showing up at this experiment. You can +earn more, up to a maximum of about $15-$50, by participating in this experiment +which will take about an hour to an hour and a half. The amount of money you earn +depends on your decisions, as well as the decisions of your group members during the nine rounds of the experiment.</p> +<h2>The Token Task</h2> +<hr> +<p> + Today's experiment is on the computer. In the experiment, you can collect green + diamond shaped tokens <img src="@CODEBASE_URL@/images/gem-token.gif"></img>, and + you will earn <b>{dollarsPerToken}</b> for each token you collect. When the token task + begins, you will appear on the screen as a yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"></img>. + To collect a token, move your yellow dot over a green token and <b>press the + space bar</b>. If you move over a token without pressing the space bar you will + NOT collect that token. You can move either up, down, left, or right. You have + to press an arrow key for every move of your yellow dot. +</p> +<p> + Later, you will be assigned to a group. The other group members will appear as + blue dots <img src="@CODEBASE_URL@/images/gem-other.gif"></img>. + +<h2>Tokens</h2> +<hr> +<p> +The tokens that you collect have the potential to regenerate. After you have +collected a green token, a new token can re-appear on that empty cell. The rate at +which new tokens appear is dependent on the number of adjacent cells that still have +tokens. The more tokens there are in the eight cells around an empty cell, the faster +a new token will appear on that empty cell. +</p> +<p> +Tokens generate new tokens. Thus, the middle cell, which is denoted with X in Image 1 will be regenerated at a faster rate than the middle cell in Image 2. +When all neighboring cells are empty, there is no renewal. +</p> +<table width="100%"> +<tr> +<td align="center"><b>Image 1</b></td> +<td align="center"><b>Image 2</b></td> +</tr> +<tr> +<td align="center"> + <img src="@CODEBASE_URL@/images/8neighbors.jpg" alt="image 1"></img> +</td> +<td align="center"> + <img src="@CODEBASE_URL@/images/5neighbors.jpg" alt="image 2"></img> +</td> +</tr> +</table> +<p> + If you have any questions at this time, please raise your hand and someone will + come over to your station and answer it. If you have no questions, continue to + the quiz below. +</p> +]]> +</entry> + +<entry key='trust-game-instructions'> +<![CDATA[ +<h1>Instructions</h1> +<hr> +<p> + You will now participate in an exercise where you will be matched with a random + person in your group. In this exercise there are two roles, Player 1 and Player 2. + Your job is to design strategies for both Player 1 and Player 2 roles. When you + are randomly paired with another member of your group you may be selected as + Player 1 <b>or</b> Player 2. The results of randomly pairing your strategies + with the other group member's strategies will be shown to you at the <b>end of + the experiment</b>. +</p> + +<h2>How to participate</h2> +<hr> +<ol> + <li>Player 1 will first receive an endowment of one dollar and has to decide <b>how much to keep</b>. The remaining amount is <b>sent to Player 2</b>. + <li>The amount Player 1 sends to Player 2 is tripled by the system and then + given to Player 2. Player 2 must then decide <b>how much to keep</b> and <b>how much to send back to Player 1</b>. +</ol> +<p> +For example, if Player 1 sends 0 cents to Player 2, Player 1 earns 1 dollar and +Player 2 earns 0 cents. However, if Player 1 sends 1 dollar to Player 2, 3 dollars +would be sent to Player 2. Player 2 then decides to return $1.75 back to Player 1. +In this case, Player 1 earns $1.75, and Player 2 earns $1.25. +</p> +<p> +Please fill in the following form to design your strategies as Player 1 or Player 2. +<br> +<b>If you have any questions, please raise your hand. Are there any questions?</b> +</p> +]]> +</entry> + +<entry key="chat-instructions"> +<![CDATA[ +<p> +You can chat with the other participants in your group during this round. +You may discuss any aspect of the experiment with the other participants in your group with two exceptions: +<ol> + <li>You <b>may not promise side-payments after the experiment is completed or threaten anyone with any consequence after the experiment is finished</b>.</li> + <li>You <b>may not reveal your actual identity</b></li> +</ol> +We are monitoring the chat traffic while you chat. If we detect any violation of the +rules we will have to stop the the experiment and remove the group where the offense +occurred from the room. +</p> +<p> + You will see other participants labeled from A to {self.lastChatHandle} in the + chat box. You can send a chat message by typing into the textfield and pressing + the enter key. +</p> +]]> +</entry> + +<entry key="sameRoundAsPreviousInstructions"> +<![CDATA[ +<h3>Round {self.roundNumber} Instructions</h3> +<hr> +<p>Round {self.roundNumber} is the same as the previous round.</p> +<p>The length of this round is {duration}.</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> +<entry key='facilitator-debriefing'> +<![CDATA[ +<h3>Round {self.roundNumber} results</h3> +<hr> +<table border=1 cellspacing=3 cellpadding=3> +<tr> +<th>Participant</th><th>Current tokens</th><th>Current income</th><th>Quiz earnings</th><th>Trust game earnings</th><th>Total income</th> +</tr> +{clientDataList: {data | +<tr align="RIGHT"><td>{data.id}</td><td>{data.currentTokens}</td><td>{data.currentIncome}</td><td>{data.quizEarnings}</td><td>{data.trustGameEarnings}</td><td>{data.grandTotalIncome}</td></tr> +}} +</table> +]]> +</entry> +<entry key='client-debriefing'> +<![CDATA[ +<h1>{if (self.practiceRound)}Practice Round{else}Round {self.roundNumber}{endif} Results</h1> +<hr> +<ul> +<li>Tokens collected in this round: {clientData.currentTokens}</li> +<li>Income from tokens collected: {clientData.currentIncome}</li> +<li>Quiz earnings: {clientData.quizEarnings}</li> +<li>Show up payment: {showUpPayment}</li> +</ul> +{if (showExitInstructions && !clientData.trustGameLog.empty) } +<h2>Trust Game Earnings</h2> +<hr> +<ul> +{clientData.trustGameLog: {trustGameLog| +<li>Trust Game #{i}: {trustGameLog}</li> +}} +</ul> +Your total trust game earnings: <b>{clientData.trustGameEarnings}</b>. +{endif} +<h2>Total Income</h2> +<hr> +<p> +Your <b>total income</b> is <b>{clientData.grandTotalIncome}</b>. +</p> +{if (showExitInstructions)} +<h2>Final Round</h2> +<hr> + <p>This was the last round of the experiment.</p> +<h2>Payment</h2> +<hr> +<p> +Please wait quietly while we prepare your payments. When payments are ready we will +call you up one by one. Please wait until your computer number, +<b>{clientData.id}</b>, is called before coming up to receive payment. Thank you +for participating. +</p> +{endif} +]]> +</entry> +<entry key='voting-results'> + <![CDATA[ + <h1>Nomination Results</h1> + <hr> + <table border=3 cellspacing=3 cellpadding=3> + <tr><th>Strategy</th><th>Nominations</th></tr> + {nominations: { strategyNomination | + <tr bgcolor="#{if (strategyNomination.selected)}FFFFCC{else}CCCCCC{endif}"><td>{strategyNomination.strategy}</td><td>{strategyNomination.nominations}</td></tr> + }} + </table> + <h1>Selected Strategy</h1> + <hr> + {if (tiebreaker)} + <p><b>NOTE:</b> There was a tie and the selected strategy listed here was randomly selected as the winner.</p> + {endif} + <p><b> {first(selectedRules)} </b></p> + ]]> +</entry> +<entry key='initial-voting-instructions'> + <![CDATA[ +<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 have the option to implement one of five 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 {self.clientsPerGroup} people in your group can nominate one of the five + potential strategies. The single strategy that receives the most nominations + wins. +</p> +<p> + <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='waiting-room-instructions'> +<![CDATA[ +<h1>Please Wait</h1> +<hr> +<p>Please wait while the other participants complete their tasks.</p> +]]> +</entry> +<entry key='voting-instructions'> +<![CDATA[ +<h1>Strategy Nomination Instructions</h1> +<hr> +<p> +To nominate a strategy, click the radio button that is to the right of the one you choose; 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 strategy will NOT be revealed. +Therefore, neither you nor the experimenter will know who nominated a particular +strategy. +</p> +]]> +</entry> + +<entry key='imposed-strategy-instructions'> +<![CDATA[ +<h1>Important New Instructions!</h1> +<h2>Strategy for managing how players collect tokens for the rest of the experiment</h2> +<hr> +<p> +Your group is being assigned a strategy for how you and the three other people in your group collect tokens for the rest of the experiment. +</p> +<h2>Assigned Strategy</h2> +<hr> +<p> +<b>{strategy}</b> +</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> + +</properties> https://bitbucket.org/virtualcommons/foraging/changeset/496f0b8bea89/ changeset: 496f0b8bea89 user: alllee date: 2012-02-28 07:51:39 summary: voting instructions template was missing from vote-punish treatment affected #: 1 file diff -r 8639f59f997a8e3066d30a66aea91e954ebbd289 -r 496f0b8bea899488a8fc991448e447d2f0859dcd src/main/resources/configuration/iu/2011/vote-punish/server.xml --- a/src/main/resources/configuration/iu/2011/vote-punish/server.xml +++ b/src/main/resources/configuration/iu/2011/vote-punish/server.xml @@ -320,4 +320,23 @@ ]]></entry> +<entry key='voting-instructions'> +<![CDATA[ +<h1>Strategy Nomination Instructions</h1> +<hr> +<p> +To nominate a strategy, click the radio button that is to the right of the one you choose; 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 strategy will NOT be revealed. +Therefore, neither you nor the experimenter will know who nominated a particular +strategy. +</p> +]]> +</entry> + </properties> 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. |
From: Bitbucket <com...@bi...> - 2012-02-28 06:44:29
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/3c1fc2c5a4b6/ changeset: 3c1fc2c5a4b6 user: alllee date: 2012-02-28 07:43:39 summary: re-enabling voting on imposed condition, participants will first see the vote screen and then be sent to the imposed screen after the votes are tallied affected #: 5 files diff -r 399e682aa7def771a90bda0b926eb4a901d1b2ab -r 3c1fc2c5a4b6a82787547c25e48157d52c33effb src/main/java/edu/asu/commons/foraging/client/ForagingClient.java --- a/src/main/java/edu/asu/commons/foraging/client/ForagingClient.java +++ b/src/main/java/edu/asu/commons/foraging/client/ForagingClient.java @@ -449,7 +449,7 @@ public void sendRuleVoteRequest(ForagingStrategy selectedRule) { transmit(new RuleVoteRequest(getId(), selectedRule)); - getGameWindow2D().ruleVoteSubmitted(); + getGameWindow2D().strategyNominationSubmitted(); } diff -r 399e682aa7def771a90bda0b926eb4a901d1b2ab -r 3c1fc2c5a4b6a82787547c25e48157d52c33effb 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 @@ -553,6 +553,10 @@ public boolean isVotingEnabled() { return getBooleanProperty("voting-enabled"); } + + public boolean isImposedStrategyEnabled() { + return getBooleanProperty("imposed-strategy-enabled"); + } public String getVotingInstructions() { return getProperty("voting-instructions"); diff -r 399e682aa7def771a90bda0b926eb4a901d1b2ab -r 3c1fc2c5a4b6a82787547c25e48157d52c33effb 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 @@ -882,7 +882,7 @@ showInstructionsPanel(); } - public void ruleVoteSubmitted() { + public void strategyNominationSubmitted() { setInstructions(dataModel.getRoundConfiguration().getSubmittedVoteInstructions()); showInstructionsPanel(); } diff -r 399e682aa7def771a90bda0b926eb4a901d1b2ab -r 3c1fc2c5a4b6a82787547c25e48157d52c33effb src/main/resources/configuration/iu/2011/imposed/round4.xml --- a/src/main/resources/configuration/iu/2011/imposed/round4.xml +++ b/src/main/resources/configuration/iu/2011/imposed/round4.xml @@ -12,7 +12,8 @@ <entry key='max-cell-occupancy'>1</entry><entry key="initial-distribution">.25</entry> -<entry key='imposed-strategy'>true</entry> +<entry key='voting-enabled'>true</entry> +<entry key='imposed-strategy-enabled'>true</entry><entry key="instructions"><![CDATA[ <h1>Round {self.roundNumber} Instructions</h1> diff -r 399e682aa7def771a90bda0b926eb4a901d1b2ab -r 3c1fc2c5a4b6a82787547c25e48157d52c33effb src/main/resources/configuration/iu/2011/imposed/server.xml --- a/src/main/resources/configuration/iu/2011/imposed/server.xml +++ b/src/main/resources/configuration/iu/2011/imposed/server.xml @@ -17,6 +17,7 @@ <entry key="wait-for-participants">true</entry><entry key="number-of-rounds">10</entry><entry key='external-survey-enabled'>true</entry> +<entry key='imposed-strategy-enabled'>true</entry><entry key='survey-id-enabled'>true</entry><entry key='survey-instructions'><![CDATA[ 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. |
From: Bitbucket <com...@bi...> - 2012-02-28 03:37:06
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/bbb67c135486/ changeset: bbb67c135486 branch: stable user: alllee date: 2012-02-28 04:37:01 summary: merging imposed strategy distribution support for indiana into stable affected #: 14 files diff -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 -r bbb67c1354864fb3543f0b66a02482908d18d028 src/main/java/edu/asu/commons/foraging/client/ForagingClient.java --- a/src/main/java/edu/asu/commons/foraging/client/ForagingClient.java +++ b/src/main/java/edu/asu/commons/foraging/client/ForagingClient.java @@ -164,7 +164,7 @@ }); addEventProcessor(new EventTypeProcessor<ShowImposedStrategyRequest>(ShowImposedStrategyRequest.class) { @Override public void handle(ShowImposedStrategyRequest request) { - getGameWindow2D().showImposedStrategy(request); + getGameWindow2D().showImposedStrategy(request.getStrategy()); } }); addEventProcessor(new EventTypeProcessor<ShowVotingInstructionsRequest>(ShowVotingInstructionsRequest.class) { diff -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 -r bbb67c1354864fb3543f0b66a02482908d18d028 src/main/java/edu/asu/commons/foraging/event/FacilitatorSanctionUpdateEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/FacilitatorSanctionUpdateEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/FacilitatorSanctionUpdateEvent.java @@ -1,30 +1,26 @@ package edu.asu.commons.foraging.event; -import java.util.Map; - import edu.asu.commons.event.AbstractEvent; -import edu.asu.commons.foraging.model.ClientData; +import edu.asu.commons.foraging.model.ServerDataModel; import edu.asu.commons.net.Identifier; public class FacilitatorSanctionUpdateEvent extends AbstractEvent { private static final long serialVersionUID = 1L; - private final Map<Identifier, ClientData> clientDataMap; - private final boolean lastRound; + private final ServerDataModel serverDataModel; - public FacilitatorSanctionUpdateEvent(Identifier id, Map<Identifier, ClientData> clientDataMap, boolean lastRound) { + public FacilitatorSanctionUpdateEvent(Identifier id, ServerDataModel serverDataModel) { super(id); - this.clientDataMap = clientDataMap; - this.lastRound = lastRound; + this.serverDataModel = serverDataModel; } public boolean isLastRound() { - return lastRound; + return serverDataModel.isLastRound(); } - public Map<Identifier, ClientData> getClientDataMap() { - return clientDataMap; - } + public ServerDataModel getServerDataModel() { + return serverDataModel; + } } diff -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 -r bbb67c1354864fb3543f0b66a02482908d18d028 src/main/java/edu/asu/commons/foraging/event/ImposeStrategyEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/ImposeStrategyEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/ImposeStrategyEvent.java @@ -1,5 +1,7 @@ package edu.asu.commons.foraging.event; +import java.util.Map; + import edu.asu.commons.event.AbstractPersistableEvent; import edu.asu.commons.event.FacilitatorRequest; import edu.asu.commons.foraging.rules.Strategy; @@ -7,7 +9,7 @@ /** * $Id$ - * Notifies the server of a facilitator imposed strategy. + * Notifies the server of a facilitator imposed strategy distribution. * * @author alllee */ @@ -15,15 +17,20 @@ private static final long serialVersionUID = -7231412845435362871L; - private final Strategy strategy; + private final Map<Strategy, Integer> strategyDistribution; - public ImposeStrategyEvent(Identifier id, Strategy strategy) { - super(id, "Imposed strategy: " + strategy); - this.strategy = strategy; + public ImposeStrategyEvent(Identifier id, Map<Strategy, Integer> strategyDistribution) { + super(id, "Imposed strategy: " + strategyDistribution); + this.strategyDistribution = strategyDistribution; } - public Strategy getStrategy() { - return strategy; + public Map<Strategy, Integer> getStrategyDistribution() { + return strategyDistribution; + } + + @Override + public String toString() { + return "Imposed strategy distribution: " + strategyDistribution; } } diff -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 -r bbb67c1354864fb3543f0b66a02482908d18d028 src/main/java/edu/asu/commons/foraging/event/ShowImposedStrategyRequest.java --- a/src/main/java/edu/asu/commons/foraging/event/ShowImposedStrategyRequest.java +++ b/src/main/java/edu/asu/commons/foraging/event/ShowImposedStrategyRequest.java @@ -1,26 +1,24 @@ package edu.asu.commons.foraging.event; import edu.asu.commons.event.AbstractEvent; -import edu.asu.commons.event.ShowRequest; import edu.asu.commons.foraging.rules.Strategy; import edu.asu.commons.net.Identifier; -public class ShowImposedStrategyRequest extends AbstractEvent implements ShowRequest<ShowImposedStrategyRequest> { +public class ShowImposedStrategyRequest extends AbstractEvent { private static final long serialVersionUID = -6046837892041909032L; - private final Strategy strategy; - + private Strategy strategy; + + public ShowImposedStrategyRequest(Identifier id) { + super(id); + } + public ShowImposedStrategyRequest(Identifier id, Strategy strategy) { super(id); this.strategy = strategy; } - @Override - public ShowImposedStrategyRequest clone(Identifier id) { - return new ShowImposedStrategyRequest(id, strategy); - } - public Strategy getStrategy() { return strategy; } diff -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 -r bbb67c1354864fb3543f0b66a02482908d18d028 src/main/java/edu/asu/commons/foraging/event/TrustGameResultsClientEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/TrustGameResultsClientEvent.java +++ /dev/null @@ -1,31 +0,0 @@ -package edu.asu.commons.foraging.event; - -import edu.asu.commons.event.AbstractEvent; -import edu.asu.commons.foraging.model.ClientData; -import edu.asu.commons.foraging.model.GroupDataModel; -import edu.asu.commons.foraging.model.TrustGameResult; - -/** - * Used to update clients with their trust game log. - */ -public class TrustGameResultsClientEvent extends AbstractEvent { - private static final long serialVersionUID = -9129989958983083574L; - - private final ClientData clientData; - private final TrustGameResult trustGameResult; - - public TrustGameResultsClientEvent(ClientData clientData, TrustGameResult result) { - super(clientData.getId(), result.getLog()); - this.clientData = clientData; - this.trustGameResult = result; - } - public GroupDataModel getGroupDataModel() { - return clientData.getGroupDataModel(); - } - public ClientData getClientData() { - return clientData; - } - public TrustGameResult getTrustGameResult() { - return trustGameResult; - } -} diff -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 -r bbb67c1354864fb3543f0b66a02482908d18d028 src/main/java/edu/asu/commons/foraging/event/TrustGameSubmissionEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/TrustGameSubmissionEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/TrustGameSubmissionEvent.java @@ -3,6 +3,13 @@ import edu.asu.commons.event.AbstractEvent; import edu.asu.commons.net.Identifier; +/** + * $Id$ + * + * Server to facilitator notification that wraps a participant's TrustGameSubmissionRequest. + * @author alllee + * + */ public class TrustGameSubmissionEvent extends AbstractEvent { private static final long serialVersionUID = 1957461200448076811L; diff -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 -r bbb67c1354864fb3543f0b66a02482908d18d028 src/main/java/edu/asu/commons/foraging/facilitator/Facilitator.java --- a/src/main/java/edu/asu/commons/foraging/facilitator/Facilitator.java +++ b/src/main/java/edu/asu/commons/foraging/facilitator/Facilitator.java @@ -2,6 +2,7 @@ import java.awt.Dimension; import java.util.List; +import java.util.Map; import javax.swing.JFrame; import javax.swing.SwingUtilities; @@ -45,7 +46,7 @@ private ServerDataModel serverDataModel; private FacilitatorWindow facilitatorWindow; private boolean experimentRunning = false; - private Strategy imposedStrategy; + private Map<Strategy, Integer> imposedStrategyDistribution; private Facilitator() { this(new ServerConfiguration()); @@ -94,7 +95,8 @@ }); addEventProcessor(new EventTypeProcessor<FacilitatorSanctionUpdateEvent>(FacilitatorSanctionUpdateEvent.class) { public void handle(FacilitatorSanctionUpdateEvent event) { - facilitatorWindow.updateDebriefing(event); + System.err.println("Updating facilitator after post-round sanctioning."); + facilitatorWindow.displayDebriefing(event.getServerDataModel()); } }); addEventProcessor(new EventTypeProcessor<FacilitatorMessageEvent>(FacilitatorMessageEvent.class) { @@ -228,26 +230,22 @@ this.serverDataModel = serverGameState; } - public void sendImposeStrategyEvent(Strategy strategy) { - if (imposedStrategy == strategy) { - facilitatorWindow.addMessage(strategy + " has already been imposed."); - return; - } - this.imposedStrategy = strategy; - facilitatorWindow.addMessage("sending imposed strategy: " + strategy); - transmit(new ImposeStrategyEvent(getId(), strategy)); + public void sendImposeStrategyEvent(Map<Strategy, Integer> imposedStrategyDistribution) { + this.imposedStrategyDistribution = imposedStrategyDistribution; + facilitatorWindow.addMessage("sending imposed strategy: " + imposedStrategyDistribution); + transmit(new ImposeStrategyEvent(getId(), imposedStrategyDistribution)); } - public Strategy getImposedStrategy() { - return imposedStrategy; + public Map<Strategy, Integer> getImposedStrategyDistribution() { + return imposedStrategyDistribution; } public void sendShowImposedStrategy() { - if (imposedStrategy == null) { - facilitatorWindow.addMessage("No imposed strategy selected, please select a strategy first."); + if (imposedStrategyDistribution == null || imposedStrategyDistribution.isEmpty()) { + facilitatorWindow.addMessage("No imposed strategies selected, please select a strategy first."); return; } - transmit(new ShowImposedStrategyRequest(getId(), imposedStrategy)); + transmit(new ShowImposedStrategyRequest(getId())); } } diff -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 -r bbb67c1354864fb3543f0b66a02482908d18d028 src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java --- a/src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java +++ b/src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java @@ -14,8 +14,8 @@ import java.io.Reader; import java.io.StringReader; import java.util.Arrays; +import java.util.HashMap; import java.util.Map; -import java.util.TreeSet; import javax.jnlp.ClipboardService; import javax.jnlp.ServiceManager; @@ -29,24 +29,26 @@ import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSplitPane; +import javax.swing.SwingUtilities; import javax.swing.text.BadLocationException; import edu.asu.commons.foraging.conf.RoundConfiguration; import edu.asu.commons.foraging.event.FacilitatorEndRoundEvent; -import edu.asu.commons.foraging.event.FacilitatorSanctionUpdateEvent; import edu.asu.commons.foraging.event.QuizCompletedEvent; import edu.asu.commons.foraging.event.TrustGameResultsFacilitatorEvent; import edu.asu.commons.foraging.event.TrustGameSubmissionEvent; -import edu.asu.commons.foraging.model.ClientData; import edu.asu.commons.foraging.model.ServerDataModel; +import edu.asu.commons.foraging.rules.Strategy; import edu.asu.commons.foraging.rules.iu.ForagingStrategy; -import edu.asu.commons.net.Identifier; import edu.asu.commons.ui.HtmlEditorPane; import edu.asu.commons.ui.UserInterfaceUtils; /** * $Id$ * + * The primary facilitator interface panel. + * + * @author Allen Lee */ @SuppressWarnings("unused") public class FacilitatorWindow extends JPanel { @@ -91,7 +93,8 @@ private ClipboardService clipboardService; - + private Map<Strategy, Integer> imposedStrategies = new HashMap<Strategy, Integer>(); + public FacilitatorWindow(Dimension dimension, Facilitator facilitator) { this.facilitator = facilitator; initGuiComponents(); @@ -202,7 +205,7 @@ facilitator.sendShowVoteScreenRequest(); } }); - imposeStrategyMenuItem = createMenuItem(menu, "Select imposed strategy", new ActionListener() { + imposeStrategyMenuItem = createMenuItem(menu, "Add imposed strategy", new ActionListener() { public void actionPerformed(ActionEvent e) { ForagingStrategy selection = (ForagingStrategy) JOptionPane.showInputDialog(FacilitatorWindow.this, "Select the strategy to impose:\n", "Impose Strategy", @@ -211,9 +214,26 @@ ForagingStrategy.values(), ForagingStrategy.NONE ); - facilitator.sendImposeStrategyEvent(selection); + Integer distribution = imposedStrategies.get(selection); + if (distribution == null) { + distribution = Integer.valueOf(0); + } + imposedStrategies.put(selection, Integer.valueOf(distribution + 1)); + addMessage("Current strategy distribution: " + imposedStrategies); } }); + createMenuItem(menu, "Clear imposed strategies", new ActionListener() { + public void actionPerformed(ActionEvent e) { + + imposedStrategies.clear(); + } + }); + createMenuItem(menu, "Send imposed strategy", new ActionListener() { + public void actionPerformed(ActionEvent e) { + facilitator.sendImposeStrategyEvent(imposedStrategies); + } + }); + createMenuItem(menu, "Show imposed strategy", new ActionListener() { public void actionPerformed(ActionEvent e) { facilitator.sendShowImposedStrategy(); @@ -329,32 +349,6 @@ repaint(); } - // FIXME: get rid of duplication here & displayDebriefing.. - public void updateDebriefing(FacilitatorSanctionUpdateEvent event) { - Map<Identifier, ClientData> clientDataMap = event.getClientDataMap(); - StringBuilder buffer = new StringBuilder(); - buffer.append("<h3>Updated Facilitator Debriefing:</h3>"); - buffer.append("<table><thead><th>Participant</th><th>Current tokens</th><th>Current Income</th><th>Total Income</th></thead><tbody>"); - TreeSet<Identifier> orderedSet = new TreeSet<Identifier>(clientDataMap.keySet()); - for (Identifier clientId : orderedSet) { - ClientData data = clientDataMap.get(clientId); - buffer.append(String.format( - "<tr><td>%s</td>" + - "<td align='center'>%d</td>" + - "<td align='center'>$%3.2f</td>" + - "<td align='center'>$%3.2f</td></tr>", - clientId.toString(), - data.getCurrentTokens(), - getIncome(data.getCurrentTokens()), - getIncome(data.getTotalTokens()))); - } - buffer.append("</tbody></table><hr>"); - if (event.isLastRound()) { - buffer.append("<h2><font color='blue'>The experiment is over. Please prepare payments.</font></h2>"); - } - informationEditorPane.setText(buffer.toString()); - } - public void displayDebriefing(ServerDataModel serverDataModel) { RoundConfiguration roundConfiguration = serverDataModel.getRoundConfiguration(); System.err.println("Displaying debriefing: " + roundConfiguration); @@ -384,14 +378,6 @@ informationEditorPane.setText(instructionsBuilder.toString()); } - private double getIncome(float numTokens) { - RoundConfiguration configuration = facilitator.getCurrentRoundConfiguration(); - if (configuration.isPracticeRound()) { - return 0.0f; - } - return configuration.getDollarsPerToken() * numTokens; - } - public void endRound(FacilitatorEndRoundEvent endRoundEvent) { System.out.println("Ending round: " + endRoundEvent); ServerDataModel serverDataModel = endRoundEvent.getServerDataModel(); @@ -400,25 +386,25 @@ completedTrustGames = 0; } - public void setRoundConfiguration(RoundConfiguration roundConfiguration) { - - } - public void configureForReplay() { // Enable the replay menus loadExperimentMenuItem.setEnabled(true); - // Disable all other menus startRoundMenuItem.setEnabled(false); stopRoundMenuItem.setEnabled(false); } - public void addMessage(String message) { - try { - messageEditorPane.getDocument().insertString(0, "-----\n" + message + "\n", null); - } catch (BadLocationException exception) { - exception.printStackTrace(); - } + public void addMessage(final String message) { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + try { + messageEditorPane.getDocument().insertString(0, "-----\n" + message + "\n", null); + messageEditorPane.setCaretPosition(0); + } catch (BadLocationException exception) { + exception.printStackTrace(); + } + } + }); } public void quizCompleted(QuizCompletedEvent event) { diff -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 -r bbb67c1354864fb3543f0b66a02482908d18d028 src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java --- a/src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java +++ b/src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java @@ -25,6 +25,7 @@ import edu.asu.commons.foraging.event.SynchronizeClientEvent; import edu.asu.commons.foraging.event.TokenCollectedEvent; import edu.asu.commons.foraging.event.UnlockResourceRequest; +import edu.asu.commons.foraging.rules.Strategy; import edu.asu.commons.foraging.rules.iu.ForagingStrategy; import edu.asu.commons.foraging.ui.Circle; import edu.asu.commons.net.Identifier; @@ -68,6 +69,7 @@ private EnforcementMechanism activeEnforcementMechanism = EnforcementMechanism.NONE; private SanctionMechanism activeSanctionMechanism = SanctionMechanism.NONE; private RegulationData activeRegulation; + private Strategy imposedStrategy; private List<ClientData> waitingMonitors; @@ -813,4 +815,12 @@ return serverDataModel.getExperimentConfiguration(); } + public Strategy getImposedStrategy() { + return imposedStrategy; + } + + public void setImposedStrategy(Strategy imposedStrategy) { + this.imposedStrategy = imposedStrategy; + } + } diff -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 -r bbb67c1354864fb3543f0b66a02482908d18d028 src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java --- a/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java +++ b/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java @@ -7,6 +7,7 @@ import java.text.NumberFormat; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashSet; @@ -59,8 +60,6 @@ private transient Random random = new Random(); private transient boolean dirty = false; - private Strategy imposedStrategy; - // Maps client Identifiers to the GroupDataModel that the client belongs to private final Map<Identifier, GroupDataModel> clientsToGroups = new HashMap<Identifier, GroupDataModel>(); @@ -239,6 +238,10 @@ public int getNumberOfClients() { return clientsToGroups.keySet().size(); } + + public int getNumberOfGroups() { + return getGroups().size(); + } public Set<GroupDataModel> getGroups() { return new LinkedHashSet<GroupDataModel>(clientsToGroups.values()); @@ -459,12 +462,25 @@ return new ArrayList<Identifier>(clientsToGroups.keySet()); } - - public Strategy getImposedStrategy() { - return imposedStrategy; - } - - public void setImposedStrategy(Strategy imposedStrategy) { - this.imposedStrategy = imposedStrategy; - } + + public List<GroupDataModel> allocateImposedStrategyDistribution(Map<Strategy, Integer> imposedStrategyDistribution) { + List<GroupDataModel> groups = getOrderedGroups(); + int numberOfGroups = groups.size(); + Collections.shuffle(groups); + Iterator<GroupDataModel> groupIterator = groups.iterator(); + int numberOfStrategies = 0; + for (Map.Entry<Strategy, Integer> entry : imposedStrategyDistribution.entrySet()) { + Strategy strategy = entry.getKey(); + int occurrences = entry.getValue(); + if (numberOfStrategies > numberOfGroups) { + throw new IllegalArgumentException("Invalid number of strategies : " + numberOfStrategies + " for " + numberOfGroups + " groups."); + } + for (int i = 0; i < occurrences; i++) { + GroupDataModel group = groupIterator.next(); + group.setImposedStrategy(strategy); + numberOfStrategies++; + } + } + return groups; + } } diff -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 -r bbb67c1354864fb3543f0b66a02482908d18d028 src/main/java/edu/asu/commons/foraging/server/ForagingServer.java --- a/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java +++ b/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java @@ -61,6 +61,7 @@ import edu.asu.commons.foraging.event.RuleSelectedUpdateEvent; import edu.asu.commons.foraging.event.RuleVoteRequest; import edu.asu.commons.foraging.event.SanctionAppliedEvent; +import edu.asu.commons.foraging.event.ShowImposedStrategyRequest; import edu.asu.commons.foraging.event.SurveyIdSubmissionRequest; import edu.asu.commons.foraging.event.SynchronizeClientEvent; import edu.asu.commons.foraging.event.TrustGameResultsFacilitatorEvent; @@ -332,7 +333,7 @@ transmit(updateEvent); } // update the facilitator - transmit(new FacilitatorSanctionUpdateEvent(facilitatorId, clients, lastRound)); + transmit(new FacilitatorSanctionUpdateEvent(facilitatorId, serverDataModel)); Utils.notify(facilitatorSignal); numberOfCompletedSanctions = 0; } @@ -588,9 +589,32 @@ sendFacilitatorMessage("Ignoring request to impose strategy " + event); return; } - persister.store(event); - serverDataModel.setImposedStrategy(event.getStrategy()); - sendFacilitatorMessage("Server has imposed strategy: " + event.getStrategy()); + persister.store(event); + try { + List<GroupDataModel> groups = serverDataModel.allocateImposedStrategyDistribution(event.getStrategyDistribution()); + StringBuilder builder = new StringBuilder(); + for (GroupDataModel group: groups) { + builder.append('[').append(group).append(':').append(group.getImposedStrategy()).append(']'); + } + sendFacilitatorMessage("Server has imposed strategies for all groups: " + builder); + + } + catch (IllegalArgumentException exception) { + sendFacilitatorMessage("Couldn't allocate strategy distribution: " + event, exception); + } + } + }); + addEventProcessor(new EventTypeProcessor<ShowImposedStrategyRequest>(ShowImposedStrategyRequest.class) { + @Override + public void handle(ShowImposedStrategyRequest request) { + if (! request.getId().equals(facilitatorId)) { + sendFacilitatorMessage("Ignoring request to show imposed strategies from: " + request.getId()); + return; + } + for (Identifier id: clients.keySet()) { + transmit(new ShowImposedStrategyRequest(id, serverDataModel.getGroup(id).getImposedStrategy())); + } + sendFacilitatorMessage("Notified all groups of imposed strategy."); } }); addEventProcessor(new EventTypeProcessor<ShowRequest>(ShowRequest.class, true) { diff -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 -r bbb67c1354864fb3543f0b66a02482908d18d028 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 @@ -54,10 +54,9 @@ import edu.asu.commons.foraging.event.QuizResponseEvent; import edu.asu.commons.foraging.event.RealTimeSanctionRequest; import edu.asu.commons.foraging.event.ResetTokenDistributionRequest; -import edu.asu.commons.foraging.event.ShowImposedStrategyRequest; -import edu.asu.commons.foraging.event.TrustGameResultsClientEvent; import edu.asu.commons.foraging.model.ClientData; import edu.asu.commons.foraging.model.Direction; +import edu.asu.commons.foraging.rules.Strategy; import edu.asu.commons.foraging.rules.iu.ForagingStrategy; import edu.asu.commons.net.Identifier; import edu.asu.commons.ui.HtmlEditorPane; @@ -888,18 +887,10 @@ showInstructionsPanel(); } - public void updateDebriefingWith(TrustGameResultsClientEvent event) { - // FIXME: currently hard coded to always show exit instructions in this case - // should change this to either have an explicit show exit instructions fired off by the - // facilitator or figure out a cleaner way of distinguishing between "we have to wait for - // some final calculation to occur before showing the final debriefing + exit instructions" - showDebriefing(event.getClientData(), true); - } - - public void showImposedStrategy(final ShowImposedStrategyRequest request) { + public void showImposedStrategy(final Strategy strategy) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - setInstructions(dataModel.getRoundConfiguration().getImposedStrategyInstructions(request.getStrategy())); + setInstructions(dataModel.getRoundConfiguration().getImposedStrategyInstructions(strategy)); } }); } diff -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 -r bbb67c1354864fb3543f0b66a02482908d18d028 src/test/java/edu/asu/commons/foraging/conf/RoundConfigurationTest.java --- a/src/test/java/edu/asu/commons/foraging/conf/RoundConfigurationTest.java +++ b/src/test/java/edu/asu/commons/foraging/conf/RoundConfigurationTest.java @@ -1,10 +1,11 @@ package edu.asu.commons.foraging.conf; +import static org.junit.Assert.*; + import org.junit.Before; import org.junit.Test; import edu.asu.commons.net.Identifier; -import static org.junit.Assert.*; public class RoundConfigurationTest { @@ -14,7 +15,7 @@ @Before public void setUp() { - ServerConfiguration serverConfiguration = new ServerConfiguration("configuration/indiana-experiments/2011/vote-punish"); + ServerConfiguration serverConfiguration = new ServerConfiguration("configuration/iu/2011/vote-punish"); roundConfiguration = serverConfiguration.getAllParameters().get(4); } @@ -25,8 +26,7 @@ assertTrue(uninterpolatedInstructions.contains("}")); assertFalse(uninterpolatedInstructions.contains("http://")); - @SuppressWarnings("rawtypes") - Identifier id = new Identifier.Base() { + Identifier id = new Identifier.Mock() { private static final long serialVersionUID = 1231310402707042800L; public String getSurveyId() { return SURVEY_ID; diff -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 -r bbb67c1354864fb3543f0b66a02482908d18d028 src/test/java/edu/asu/commons/foraging/model/GroupDataModelTest.java --- a/src/test/java/edu/asu/commons/foraging/model/GroupDataModelTest.java +++ b/src/test/java/edu/asu/commons/foraging/model/GroupDataModelTest.java @@ -1,7 +1,11 @@ package edu.asu.commons.foraging.model; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.util.Arrays; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -9,26 +13,25 @@ import org.junit.Test; import edu.asu.commons.foraging.conf.RoundConfiguration; +import edu.asu.commons.foraging.conf.ServerConfiguration; +import edu.asu.commons.foraging.rules.Strategy; import edu.asu.commons.foraging.rules.iu.ForagingStrategy; import edu.asu.commons.net.Identifier; -import static org.junit.Assert.*; + public class GroupDataModelTest { private ServerDataModel serverDataModel; + private int numberOfGroups = 3; @Before public void setUp() { serverDataModel = new ServerDataModel(); - RoundConfiguration configuration = new RoundConfiguration(); - configuration.setProperty("clients-per-group", "5"); - serverDataModel.setRoundConfiguration(configuration); - for (int i = 0; i < 10; i++) { - Identifier id = new Identifier.Base() { - }; - serverDataModel.addClient(new ClientData(id)); - } - + ServerConfiguration serverConfiguration = new ServerConfiguration("configuration/asu/2011/t1"); + RoundConfiguration roundConfiguration = serverConfiguration.getAllParameters().get(4); + serverDataModel.setRoundConfiguration(roundConfiguration); + int numberOfParticipants = roundConfiguration.getClientsPerGroup() * numberOfGroups; + addClients(numberOfParticipants); } @Test @@ -45,9 +48,17 @@ } } } + + private void addClients(int numberOfParticipants) { + serverDataModel.clear(); + for (int i = 0; i < numberOfParticipants; i++) { + serverDataModel.addClient(new ClientData(new Identifier.Mock())); + } + } @Test public void testTiebreaker() { + addClients(10); for (GroupDataModel group: serverDataModel.getGroups()) { List<ForagingStrategy> rules = Arrays.asList(ForagingStrategy.values()); // add some more randomness into the mix. @@ -64,10 +75,26 @@ Map<ForagingStrategy, Integer> votingResults = group.generateVotingResults(); assertEquals("There should be 3 rules voted on, total" + votingResults, 3, votingResults.size()); for (ForagingStrategy tieBreaker: tieBreakerRules) { + System.err.println("Inspecting tiebreaker: " + tieBreaker); assertEquals(2, votingResults.get(tieBreaker).intValue()); } assertTrue(tieBreakerRules.contains(group.getSelectedRule())); } } + + @Test + public void testImposedStrategyDistribution() { + Map<Strategy, Integer> imposedStrategyDistribution = new HashMap<Strategy, Integer>(); + // test all the same + for (ForagingStrategy strategy: ForagingStrategy.values()) { + imposedStrategyDistribution.clear(); + imposedStrategyDistribution.put(strategy, numberOfGroups); + serverDataModel.allocateImposedStrategyDistribution(imposedStrategyDistribution); + for (GroupDataModel group: serverDataModel.getGroups()) { + assertEquals("mismatched imposed strategies", strategy, group.getImposedStrategy()); + } + } + + } } 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. |
From: Bitbucket <com...@bi...> - 2012-02-28 02:28:25
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/399e682aa7de/ changeset: 399e682aa7de user: alllee date: 2012-02-28 03:28:06 summary: testing even distribution affected #: 1 file diff -r 3f6c45f013754e0efd95406a289432aa2234aa98 -r 399e682aa7def771a90bda0b926eb4a901d1b2ab src/test/java/edu/asu/commons/foraging/model/GroupDataModelTest.java --- a/src/test/java/edu/asu/commons/foraging/model/GroupDataModelTest.java +++ b/src/test/java/edu/asu/commons/foraging/model/GroupDataModelTest.java @@ -3,11 +3,13 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; import org.junit.Before; import org.junit.Test; @@ -73,9 +75,8 @@ data.setVotedRule(votedRule); } Map<ForagingStrategy, Integer> votingResults = group.generateVotingResults(); - assertEquals("There should be 3 rules voted on, total" + votingResults, 3, votingResults.size()); + assertEquals("There should be 3 rules voted on, total: " + votingResults, 3, votingResults.size()); for (ForagingStrategy tieBreaker: tieBreakerRules) { - System.err.println("Inspecting tiebreaker: " + tieBreaker); assertEquals(2, votingResults.get(tieBreaker).intValue()); } assertTrue(tieBreakerRules.contains(group.getSelectedRule())); @@ -86,15 +87,27 @@ public void testImposedStrategyDistribution() { Map<Strategy, Integer> imposedStrategyDistribution = new HashMap<Strategy, Integer>(); // test all the same + Set<GroupDataModel> groups = serverDataModel.getGroups(); for (ForagingStrategy strategy: ForagingStrategy.values()) { imposedStrategyDistribution.clear(); imposedStrategyDistribution.put(strategy, numberOfGroups); serverDataModel.allocateImposedStrategyDistribution(imposedStrategyDistribution); - for (GroupDataModel group: serverDataModel.getGroups()) { + for (GroupDataModel group: groups) { assertEquals("mismatched imposed strategies", strategy, group.getImposedStrategy()); } } - + // test even distribution + imposedStrategyDistribution.clear(); + List<ForagingStrategy> strategies = new ArrayList<ForagingStrategy>(Arrays.asList(ForagingStrategy.values())); + Collections.shuffle(strategies); + for (ForagingStrategy strategy: strategies.subList(0, groups.size())) { + imposedStrategyDistribution.put(strategy, 1); + } + serverDataModel.allocateImposedStrategyDistribution(imposedStrategyDistribution); + for (GroupDataModel group: groups) { + assertEquals(Integer.valueOf(1), imposedStrategyDistribution.remove(group.getImposedStrategy())); + } + assertTrue(imposedStrategyDistribution.isEmpty()); } } 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. |
From: Bitbucket <com...@bi...> - 2012-02-28 02:18:02
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/3f6c45f01375/ changeset: 3f6c45f01375 user: alllee date: 2012-02-28 03:17:58 summary: fixing tests affected #: 2 files diff -r 8280c7df6ac4fa0c77bb24be1dcaf6cd84bcf58c -r 3f6c45f013754e0efd95406a289432aa2234aa98 src/test/java/edu/asu/commons/foraging/conf/RoundConfigurationTest.java --- a/src/test/java/edu/asu/commons/foraging/conf/RoundConfigurationTest.java +++ b/src/test/java/edu/asu/commons/foraging/conf/RoundConfigurationTest.java @@ -15,7 +15,7 @@ @Before public void setUp() { - ServerConfiguration serverConfiguration = new ServerConfiguration("configuration/indiana-experiments/2011/vote-punish"); + ServerConfiguration serverConfiguration = new ServerConfiguration("configuration/iu/2011/vote-punish"); roundConfiguration = serverConfiguration.getAllParameters().get(4); } diff -r 8280c7df6ac4fa0c77bb24be1dcaf6cd84bcf58c -r 3f6c45f013754e0efd95406a289432aa2234aa98 src/test/java/edu/asu/commons/foraging/model/GroupDataModelTest.java --- a/src/test/java/edu/asu/commons/foraging/model/GroupDataModelTest.java +++ b/src/test/java/edu/asu/commons/foraging/model/GroupDataModelTest.java @@ -13,6 +13,7 @@ import org.junit.Test; import edu.asu.commons.foraging.conf.RoundConfiguration; +import edu.asu.commons.foraging.conf.ServerConfiguration; import edu.asu.commons.foraging.rules.Strategy; import edu.asu.commons.foraging.rules.iu.ForagingStrategy; import edu.asu.commons.net.Identifier; @@ -21,18 +22,16 @@ public class GroupDataModelTest { private ServerDataModel serverDataModel; - private int numberOfParticipants = 15; + private int numberOfGroups = 3; @Before public void setUp() { serverDataModel = new ServerDataModel(); - RoundConfiguration configuration = new RoundConfiguration(); - configuration.setProperty("clients-per-group", "5"); - serverDataModel.setRoundConfiguration(configuration); - for (int i = 0; i < numberOfParticipants; i++) { - serverDataModel.addClient(new ClientData(new Identifier.Mock())); - } - + ServerConfiguration serverConfiguration = new ServerConfiguration("configuration/asu/2011/t1"); + RoundConfiguration roundConfiguration = serverConfiguration.getAllParameters().get(4); + serverDataModel.setRoundConfiguration(roundConfiguration); + int numberOfParticipants = roundConfiguration.getClientsPerGroup() * numberOfGroups; + addClients(numberOfParticipants); } @Test @@ -49,9 +48,17 @@ } } } + + private void addClients(int numberOfParticipants) { + serverDataModel.clear(); + for (int i = 0; i < numberOfParticipants; i++) { + serverDataModel.addClient(new ClientData(new Identifier.Mock())); + } + } @Test public void testTiebreaker() { + addClients(10); for (GroupDataModel group: serverDataModel.getGroups()) { List<ForagingStrategy> rules = Arrays.asList(ForagingStrategy.values()); // add some more randomness into the mix. @@ -68,6 +75,7 @@ Map<ForagingStrategy, Integer> votingResults = group.generateVotingResults(); assertEquals("There should be 3 rules voted on, total" + votingResults, 3, votingResults.size()); for (ForagingStrategy tieBreaker: tieBreakerRules) { + System.err.println("Inspecting tiebreaker: " + tieBreaker); assertEquals(2, votingResults.get(tieBreaker).intValue()); } assertTrue(tieBreakerRules.contains(group.getSelectedRule())); @@ -76,16 +84,16 @@ @Test public void testImposedStrategyDistribution() { - int numberOfGroups = numberOfParticipants / serverDataModel.getRoundConfiguration().getClientsPerGroup(); Map<Strategy, Integer> imposedStrategyDistribution = new HashMap<Strategy, Integer>(); // test all the same for (ForagingStrategy strategy: ForagingStrategy.values()) { - imposedStrategyDistribution.put(strategy, numberOfGroups); - serverDataModel.allocateImposedStrategyDistribution(imposedStrategyDistribution); - for (GroupDataModel group: serverDataModel.getGroups()) { - assertEquals("mismatched imposed strategies", strategy, group.getImposedStrategy()); - } - } + imposedStrategyDistribution.clear(); + imposedStrategyDistribution.put(strategy, numberOfGroups); + serverDataModel.allocateImposedStrategyDistribution(imposedStrategyDistribution); + for (GroupDataModel group: serverDataModel.getGroups()) { + assertEquals("mismatched imposed strategies", strategy, group.getImposedStrategy()); + } + } } 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. |
From: Bitbucket <com...@bi...> - 2012-02-28 02:03:55
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/8280c7df6ac4/ changeset: 8280c7df6ac4 user: alllee date: 2012-02-28 03:03:35 summary: fixing tests affected #: 2 files diff -r 3fd2a69162deea9948ea1d7379db06c830579608 -r 8280c7df6ac4fa0c77bb24be1dcaf6cd84bcf58c src/test/java/edu/asu/commons/foraging/conf/RoundConfigurationTest.java --- a/src/test/java/edu/asu/commons/foraging/conf/RoundConfigurationTest.java +++ b/src/test/java/edu/asu/commons/foraging/conf/RoundConfigurationTest.java @@ -1,13 +1,11 @@ package edu.asu.commons.foraging.conf; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; import edu.asu.commons.net.Identifier; -import edu.asu.commons.net.MockIdentifier; public class RoundConfigurationTest { @@ -28,7 +26,7 @@ assertTrue(uninterpolatedInstructions.contains("}")); assertFalse(uninterpolatedInstructions.contains("http://")); - Identifier id = new MockIdentifier() { + Identifier id = new Identifier.Mock() { private static final long serialVersionUID = 1231310402707042800L; public String getSurveyId() { return SURVEY_ID; diff -r 3fd2a69162deea9948ea1d7379db06c830579608 -r 8280c7df6ac4fa0c77bb24be1dcaf6cd84bcf58c src/test/java/edu/asu/commons/foraging/model/GroupDataModelTest.java --- a/src/test/java/edu/asu/commons/foraging/model/GroupDataModelTest.java +++ b/src/test/java/edu/asu/commons/foraging/model/GroupDataModelTest.java @@ -15,7 +15,8 @@ import edu.asu.commons.foraging.conf.RoundConfiguration; import edu.asu.commons.foraging.rules.Strategy; import edu.asu.commons.foraging.rules.iu.ForagingStrategy; -import edu.asu.commons.net.MockIdentifier; +import edu.asu.commons.net.Identifier; + public class GroupDataModelTest { @@ -29,7 +30,7 @@ configuration.setProperty("clients-per-group", "5"); serverDataModel.setRoundConfiguration(configuration); for (int i = 0; i < numberOfParticipants; i++) { - serverDataModel.addClient(new ClientData(new MockIdentifier())); + serverDataModel.addClient(new ClientData(new Identifier.Mock())); } } 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. |
From: Bitbucket <com...@bi...> - 2012-02-28 01:54:23
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/3fd2a69162de/ changeset: 3fd2a69162de user: alllee date: 2012-02-28 02:54:03 summary: pushing addMessage inside a Swing Worker thread and updating tests affected #: 3 files diff -r 1450271cae0fcddcbcf17383d826f9b1155d776e -r 3fd2a69162deea9948ea1d7379db06c830579608 src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java --- a/src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java +++ b/src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java @@ -29,6 +29,7 @@ import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSplitPane; +import javax.swing.SwingUtilities; import javax.swing.text.BadLocationException; import edu.asu.commons.foraging.conf.RoundConfiguration; @@ -388,18 +389,22 @@ public void configureForReplay() { // Enable the replay menus loadExperimentMenuItem.setEnabled(true); - // Disable all other menus startRoundMenuItem.setEnabled(false); stopRoundMenuItem.setEnabled(false); } - public void addMessage(String message) { - try { - messageEditorPane.getDocument().insertString(0, "-----\n" + message + "\n", null); - } catch (BadLocationException exception) { - exception.printStackTrace(); - } + public void addMessage(final String message) { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + try { + messageEditorPane.getDocument().insertString(0, "-----\n" + message + "\n", null); + messageEditorPane.setCaretPosition(0); + } catch (BadLocationException exception) { + exception.printStackTrace(); + } + } + }); } public void quizCompleted(QuizCompletedEvent event) { diff -r 1450271cae0fcddcbcf17383d826f9b1155d776e -r 3fd2a69162deea9948ea1d7379db06c830579608 src/test/java/edu/asu/commons/foraging/conf/RoundConfigurationTest.java --- a/src/test/java/edu/asu/commons/foraging/conf/RoundConfigurationTest.java +++ b/src/test/java/edu/asu/commons/foraging/conf/RoundConfigurationTest.java @@ -1,10 +1,13 @@ package edu.asu.commons.foraging.conf; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.junit.Before; import org.junit.Test; import edu.asu.commons.net.Identifier; -import static org.junit.Assert.*; +import edu.asu.commons.net.MockIdentifier; public class RoundConfigurationTest { @@ -25,8 +28,7 @@ assertTrue(uninterpolatedInstructions.contains("}")); assertFalse(uninterpolatedInstructions.contains("http://")); - @SuppressWarnings("rawtypes") - Identifier id = new Identifier.Base() { + Identifier id = new MockIdentifier() { private static final long serialVersionUID = 1231310402707042800L; public String getSurveyId() { return SURVEY_ID; diff -r 1450271cae0fcddcbcf17383d826f9b1155d776e -r 3fd2a69162deea9948ea1d7379db06c830579608 src/test/java/edu/asu/commons/foraging/model/GroupDataModelTest.java --- a/src/test/java/edu/asu/commons/foraging/model/GroupDataModelTest.java +++ b/src/test/java/edu/asu/commons/foraging/model/GroupDataModelTest.java @@ -1,7 +1,11 @@ package edu.asu.commons.foraging.model; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.util.Arrays; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -9,13 +13,14 @@ import org.junit.Test; import edu.asu.commons.foraging.conf.RoundConfiguration; +import edu.asu.commons.foraging.rules.Strategy; import edu.asu.commons.foraging.rules.iu.ForagingStrategy; -import edu.asu.commons.net.Identifier; -import static org.junit.Assert.*; +import edu.asu.commons.net.MockIdentifier; public class GroupDataModelTest { private ServerDataModel serverDataModel; + private int numberOfParticipants = 15; @Before public void setUp() { @@ -23,10 +28,8 @@ RoundConfiguration configuration = new RoundConfiguration(); configuration.setProperty("clients-per-group", "5"); serverDataModel.setRoundConfiguration(configuration); - for (int i = 0; i < 10; i++) { - Identifier id = new Identifier.Base() { - }; - serverDataModel.addClient(new ClientData(id)); + for (int i = 0; i < numberOfParticipants; i++) { + serverDataModel.addClient(new ClientData(new MockIdentifier())); } } @@ -69,5 +72,20 @@ assertTrue(tieBreakerRules.contains(group.getSelectedRule())); } } + + @Test + public void testImposedStrategyDistribution() { + int numberOfGroups = numberOfParticipants / serverDataModel.getRoundConfiguration().getClientsPerGroup(); + Map<Strategy, Integer> imposedStrategyDistribution = new HashMap<Strategy, Integer>(); + // test all the same + for (ForagingStrategy strategy: ForagingStrategy.values()) { + imposedStrategyDistribution.put(strategy, numberOfGroups); + serverDataModel.allocateImposedStrategyDistribution(imposedStrategyDistribution); + for (GroupDataModel group: serverDataModel.getGroups()) { + assertEquals("mismatched imposed strategies", strategy, group.getImposedStrategy()); + } + } + + } } 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. |
From: Bitbucket <com...@bi...> - 2012-02-28 00:59:44
|
4 new commits in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/e181dac33964/ changeset: e181dac33964 user: alllee date: 2012-02-28 01:57:34 summary: adding support for multiple imposed strategies. the current model is to add the rules until you've got the distribution you want, and then send that to the server. affected #: 8 files diff -r ef5f971f25bc237f46102f7d8ac363eb9f421a5e -r e181dac33964d2d9000b5a798a4d27aaa215dd78 src/main/java/edu/asu/commons/foraging/client/ForagingClient.java --- a/src/main/java/edu/asu/commons/foraging/client/ForagingClient.java +++ b/src/main/java/edu/asu/commons/foraging/client/ForagingClient.java @@ -164,7 +164,7 @@ }); addEventProcessor(new EventTypeProcessor<ShowImposedStrategyRequest>(ShowImposedStrategyRequest.class) { @Override public void handle(ShowImposedStrategyRequest request) { - getGameWindow2D().showImposedStrategy(request); + getGameWindow2D().showImposedStrategy(request.getStrategy()); } }); addEventProcessor(new EventTypeProcessor<ShowVotingInstructionsRequest>(ShowVotingInstructionsRequest.class) { diff -r ef5f971f25bc237f46102f7d8ac363eb9f421a5e -r e181dac33964d2d9000b5a798a4d27aaa215dd78 src/main/java/edu/asu/commons/foraging/event/ImposeStrategyEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/ImposeStrategyEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/ImposeStrategyEvent.java @@ -1,5 +1,7 @@ package edu.asu.commons.foraging.event; +import java.util.Map; + import edu.asu.commons.event.AbstractPersistableEvent; import edu.asu.commons.event.FacilitatorRequest; import edu.asu.commons.foraging.rules.Strategy; @@ -7,7 +9,7 @@ /** * $Id$ - * Notifies the server of a facilitator imposed strategy. + * Notifies the server of a facilitator imposed strategy distribution. * * @author alllee */ @@ -15,15 +17,20 @@ private static final long serialVersionUID = -7231412845435362871L; - private final Strategy strategy; + private final Map<Strategy, Integer> strategyDistribution; - public ImposeStrategyEvent(Identifier id, Strategy strategy) { - super(id, "Imposed strategy: " + strategy); - this.strategy = strategy; + public ImposeStrategyEvent(Identifier id, Map<Strategy, Integer> strategyDistribution) { + super(id, "Imposed strategy: " + strategyDistribution); + this.strategyDistribution = strategyDistribution; } - public Strategy getStrategy() { - return strategy; + public Map<Strategy, Integer> getStrategyDistribution() { + return strategyDistribution; + } + + @Override + public String toString() { + return "Imposed strategy distribution: " + strategyDistribution; } } diff -r ef5f971f25bc237f46102f7d8ac363eb9f421a5e -r e181dac33964d2d9000b5a798a4d27aaa215dd78 src/main/java/edu/asu/commons/foraging/event/ShowImposedStrategyRequest.java --- a/src/main/java/edu/asu/commons/foraging/event/ShowImposedStrategyRequest.java +++ b/src/main/java/edu/asu/commons/foraging/event/ShowImposedStrategyRequest.java @@ -1,26 +1,24 @@ package edu.asu.commons.foraging.event; import edu.asu.commons.event.AbstractEvent; -import edu.asu.commons.event.ShowRequest; import edu.asu.commons.foraging.rules.Strategy; import edu.asu.commons.net.Identifier; -public class ShowImposedStrategyRequest extends AbstractEvent implements ShowRequest<ShowImposedStrategyRequest> { +public class ShowImposedStrategyRequest extends AbstractEvent { private static final long serialVersionUID = -6046837892041909032L; - private final Strategy strategy; - + private Strategy strategy; + + public ShowImposedStrategyRequest(Identifier id) { + super(id); + } + public ShowImposedStrategyRequest(Identifier id, Strategy strategy) { super(id); this.strategy = strategy; } - @Override - public ShowImposedStrategyRequest clone(Identifier id) { - return new ShowImposedStrategyRequest(id, strategy); - } - public Strategy getStrategy() { return strategy; } diff -r ef5f971f25bc237f46102f7d8ac363eb9f421a5e -r e181dac33964d2d9000b5a798a4d27aaa215dd78 src/main/java/edu/asu/commons/foraging/facilitator/Facilitator.java --- a/src/main/java/edu/asu/commons/foraging/facilitator/Facilitator.java +++ b/src/main/java/edu/asu/commons/foraging/facilitator/Facilitator.java @@ -2,6 +2,7 @@ import java.awt.Dimension; import java.util.List; +import java.util.Map; import javax.swing.JFrame; import javax.swing.SwingUtilities; @@ -45,7 +46,7 @@ private ServerDataModel serverDataModel; private FacilitatorWindow facilitatorWindow; private boolean experimentRunning = false; - private Strategy imposedStrategy; + private Map<Strategy, Integer> imposedStrategyDistribution; private Facilitator() { this(new ServerConfiguration()); @@ -94,7 +95,8 @@ }); addEventProcessor(new EventTypeProcessor<FacilitatorSanctionUpdateEvent>(FacilitatorSanctionUpdateEvent.class) { public void handle(FacilitatorSanctionUpdateEvent event) { - facilitatorWindow.updateDebriefing(event); + System.err.println("Updating facilitator after post-round sanctioning."); + facilitatorWindow.displayDebriefing(event.getServerDataModel()); } }); addEventProcessor(new EventTypeProcessor<FacilitatorMessageEvent>(FacilitatorMessageEvent.class) { @@ -228,26 +230,22 @@ this.serverDataModel = serverGameState; } - public void sendImposeStrategyEvent(Strategy strategy) { - if (imposedStrategy == strategy) { - facilitatorWindow.addMessage(strategy + " has already been imposed."); - return; - } - this.imposedStrategy = strategy; - facilitatorWindow.addMessage("sending imposed strategy: " + strategy); - transmit(new ImposeStrategyEvent(getId(), strategy)); + public void sendImposeStrategyEvent(Map<Strategy, Integer> imposedStrategyDistribution) { + this.imposedStrategyDistribution = imposedStrategyDistribution; + facilitatorWindow.addMessage("sending imposed strategy: " + imposedStrategyDistribution); + transmit(new ImposeStrategyEvent(getId(), imposedStrategyDistribution)); } - public Strategy getImposedStrategy() { - return imposedStrategy; + public Map<Strategy, Integer> getImposedStrategyDistribution() { + return imposedStrategyDistribution; } public void sendShowImposedStrategy() { - if (imposedStrategy == null) { - facilitatorWindow.addMessage("No imposed strategy selected, please select a strategy first."); + if (imposedStrategyDistribution == null || imposedStrategyDistribution.isEmpty()) { + facilitatorWindow.addMessage("No imposed strategies selected, please select a strategy first."); return; } - transmit(new ShowImposedStrategyRequest(getId(), imposedStrategy)); + transmit(new ShowImposedStrategyRequest(getId())); } } diff -r ef5f971f25bc237f46102f7d8ac363eb9f421a5e -r e181dac33964d2d9000b5a798a4d27aaa215dd78 src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java --- a/src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java +++ b/src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java @@ -14,8 +14,8 @@ import java.io.Reader; import java.io.StringReader; import java.util.Arrays; +import java.util.HashMap; import java.util.Map; -import java.util.TreeSet; import javax.jnlp.ClipboardService; import javax.jnlp.ServiceManager; @@ -33,20 +33,21 @@ import edu.asu.commons.foraging.conf.RoundConfiguration; import edu.asu.commons.foraging.event.FacilitatorEndRoundEvent; -import edu.asu.commons.foraging.event.FacilitatorSanctionUpdateEvent; import edu.asu.commons.foraging.event.QuizCompletedEvent; import edu.asu.commons.foraging.event.TrustGameResultsFacilitatorEvent; import edu.asu.commons.foraging.event.TrustGameSubmissionEvent; -import edu.asu.commons.foraging.model.ClientData; import edu.asu.commons.foraging.model.ServerDataModel; +import edu.asu.commons.foraging.rules.Strategy; import edu.asu.commons.foraging.rules.iu.ForagingStrategy; -import edu.asu.commons.net.Identifier; import edu.asu.commons.ui.HtmlEditorPane; import edu.asu.commons.ui.UserInterfaceUtils; /** * $Id$ * + * The primary facilitator interface panel. + * + * @author Allen Lee */ @SuppressWarnings("unused") public class FacilitatorWindow extends JPanel { @@ -91,7 +92,8 @@ private ClipboardService clipboardService; - + private Map<Strategy, Integer> imposedStrategies = new HashMap<Strategy, Integer>(); + public FacilitatorWindow(Dimension dimension, Facilitator facilitator) { this.facilitator = facilitator; initGuiComponents(); @@ -202,7 +204,7 @@ facilitator.sendShowVoteScreenRequest(); } }); - imposeStrategyMenuItem = createMenuItem(menu, "Select imposed strategy", new ActionListener() { + imposeStrategyMenuItem = createMenuItem(menu, "Add imposed strategy", new ActionListener() { public void actionPerformed(ActionEvent e) { ForagingStrategy selection = (ForagingStrategy) JOptionPane.showInputDialog(FacilitatorWindow.this, "Select the strategy to impose:\n", "Impose Strategy", @@ -211,9 +213,26 @@ ForagingStrategy.values(), ForagingStrategy.NONE ); - facilitator.sendImposeStrategyEvent(selection); + Integer distribution = imposedStrategies.get(selection); + if (distribution == null) { + distribution = Integer.valueOf(0); + } + imposedStrategies.put(selection, Integer.valueOf(distribution + 1)); + addMessage("Current strategy distribution: " + imposedStrategies); } }); + createMenuItem(menu, "Clear imposed strategies", new ActionListener() { + public void actionPerformed(ActionEvent e) { + + imposedStrategies.clear(); + } + }); + createMenuItem(menu, "Send imposed strategy", new ActionListener() { + public void actionPerformed(ActionEvent e) { + facilitator.sendImposeStrategyEvent(imposedStrategies); + } + }); + createMenuItem(menu, "Show imposed strategy", new ActionListener() { public void actionPerformed(ActionEvent e) { facilitator.sendShowImposedStrategy(); @@ -329,32 +348,6 @@ repaint(); } - // FIXME: get rid of duplication here & displayDebriefing.. - public void updateDebriefing(FacilitatorSanctionUpdateEvent event) { - Map<Identifier, ClientData> clientDataMap = event.getClientDataMap(); - StringBuilder buffer = new StringBuilder(); - buffer.append("<h3>Updated Facilitator Debriefing:</h3>"); - buffer.append("<table><thead><th>Participant</th><th>Current tokens</th><th>Current Income</th><th>Total Income</th></thead><tbody>"); - TreeSet<Identifier> orderedSet = new TreeSet<Identifier>(clientDataMap.keySet()); - for (Identifier clientId : orderedSet) { - ClientData data = clientDataMap.get(clientId); - buffer.append(String.format( - "<tr><td>%s</td>" + - "<td align='center'>%d</td>" + - "<td align='center'>$%3.2f</td>" + - "<td align='center'>$%3.2f</td></tr>", - clientId.toString(), - data.getCurrentTokens(), - getIncome(data.getCurrentTokens()), - getIncome(data.getTotalTokens()))); - } - buffer.append("</tbody></table><hr>"); - if (event.isLastRound()) { - buffer.append("<h2><font color='blue'>The experiment is over. Please prepare payments.</font></h2>"); - } - informationEditorPane.setText(buffer.toString()); - } - public void displayDebriefing(ServerDataModel serverDataModel) { RoundConfiguration roundConfiguration = serverDataModel.getRoundConfiguration(); System.err.println("Displaying debriefing: " + roundConfiguration); @@ -384,14 +377,6 @@ informationEditorPane.setText(instructionsBuilder.toString()); } - private double getIncome(float numTokens) { - RoundConfiguration configuration = facilitator.getCurrentRoundConfiguration(); - if (configuration.isPracticeRound()) { - return 0.0f; - } - return configuration.getDollarsPerToken() * numTokens; - } - public void endRound(FacilitatorEndRoundEvent endRoundEvent) { System.out.println("Ending round: " + endRoundEvent); ServerDataModel serverDataModel = endRoundEvent.getServerDataModel(); @@ -400,10 +385,6 @@ completedTrustGames = 0; } - public void setRoundConfiguration(RoundConfiguration roundConfiguration) { - - } - public void configureForReplay() { // Enable the replay menus loadExperimentMenuItem.setEnabled(true); diff -r ef5f971f25bc237f46102f7d8ac363eb9f421a5e -r e181dac33964d2d9000b5a798a4d27aaa215dd78 src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java --- a/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java +++ b/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java @@ -7,6 +7,7 @@ import java.text.NumberFormat; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashSet; @@ -59,8 +60,6 @@ private transient Random random = new Random(); private transient boolean dirty = false; - private Strategy imposedStrategy; - // Maps client Identifiers to the GroupDataModel that the client belongs to private final Map<Identifier, GroupDataModel> clientsToGroups = new HashMap<Identifier, GroupDataModel>(); @@ -239,6 +238,10 @@ public int getNumberOfClients() { return clientsToGroups.keySet().size(); } + + public int getNumberOfGroups() { + return getGroups().size(); + } public Set<GroupDataModel> getGroups() { return new LinkedHashSet<GroupDataModel>(clientsToGroups.values()); @@ -459,12 +462,25 @@ return new ArrayList<Identifier>(clientsToGroups.keySet()); } - - public Strategy getImposedStrategy() { - return imposedStrategy; - } - - public void setImposedStrategy(Strategy imposedStrategy) { - this.imposedStrategy = imposedStrategy; - } + + public List<GroupDataModel> allocateImposedStrategyDistribution(Map<Strategy, Integer> imposedStrategyDistribution) { + List<GroupDataModel> groups = getOrderedGroups(); + int numberOfGroups = groups.size(); + Collections.shuffle(groups); + Iterator<GroupDataModel> groupIterator = groups.iterator(); + int numberOfStrategies = 0; + for (Map.Entry<Strategy, Integer> entry : imposedStrategyDistribution.entrySet()) { + Strategy strategy = entry.getKey(); + int occurrences = entry.getValue(); + if (numberOfStrategies > numberOfGroups) { + throw new IllegalArgumentException("Invalid number of strategies : " + numberOfStrategies + " for " + numberOfGroups + " groups."); + } + for (int i = 0; i < occurrences; i++) { + GroupDataModel group = groupIterator.next(); + group.setImposedStrategy(strategy); + numberOfStrategies++; + } + } + return groups; + } } diff -r ef5f971f25bc237f46102f7d8ac363eb9f421a5e -r e181dac33964d2d9000b5a798a4d27aaa215dd78 src/main/java/edu/asu/commons/foraging/server/ForagingServer.java --- a/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java +++ b/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java @@ -61,6 +61,7 @@ import edu.asu.commons.foraging.event.RuleSelectedUpdateEvent; import edu.asu.commons.foraging.event.RuleVoteRequest; import edu.asu.commons.foraging.event.SanctionAppliedEvent; +import edu.asu.commons.foraging.event.ShowImposedStrategyRequest; import edu.asu.commons.foraging.event.SurveyIdSubmissionRequest; import edu.asu.commons.foraging.event.SynchronizeClientEvent; import edu.asu.commons.foraging.event.TrustGameResultsFacilitatorEvent; @@ -332,7 +333,7 @@ transmit(updateEvent); } // update the facilitator - transmit(new FacilitatorSanctionUpdateEvent(facilitatorId, clients, lastRound)); + transmit(new FacilitatorSanctionUpdateEvent(facilitatorId, serverDataModel)); Utils.notify(facilitatorSignal); numberOfCompletedSanctions = 0; } @@ -588,9 +589,32 @@ sendFacilitatorMessage("Ignoring request to impose strategy " + event); return; } - persister.store(event); - serverDataModel.setImposedStrategy(event.getStrategy()); - sendFacilitatorMessage("Server has imposed strategy: " + event.getStrategy()); + persister.store(event); + try { + List<GroupDataModel> groups = serverDataModel.allocateImposedStrategyDistribution(event.getStrategyDistribution()); + StringBuilder builder = new StringBuilder(); + for (GroupDataModel group: groups) { + builder.append('[').append(group).append(':').append(group.getImposedStrategy()).append(']'); + } + sendFacilitatorMessage("Server has imposed strategies for all groups: " + builder); + + } + catch (IllegalArgumentException exception) { + sendFacilitatorMessage("Couldn't allocate strategy distribution: " + event, exception); + } + } + }); + addEventProcessor(new EventTypeProcessor<ShowImposedStrategyRequest>(ShowImposedStrategyRequest.class) { + @Override + public void handle(ShowImposedStrategyRequest request) { + if (! request.getId().equals(facilitatorId)) { + sendFacilitatorMessage("Ignoring request to show imposed strategies from: " + request.getId()); + return; + } + for (Identifier id: clients.keySet()) { + transmit(new ShowImposedStrategyRequest(id, serverDataModel.getGroup(id).getImposedStrategy())); + } + sendFacilitatorMessage("Notified all groups of imposed strategy."); } }); addEventProcessor(new EventTypeProcessor<ShowRequest>(ShowRequest.class, true) { diff -r ef5f971f25bc237f46102f7d8ac363eb9f421a5e -r e181dac33964d2d9000b5a798a4d27aaa215dd78 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 @@ -54,10 +54,9 @@ import edu.asu.commons.foraging.event.QuizResponseEvent; import edu.asu.commons.foraging.event.RealTimeSanctionRequest; import edu.asu.commons.foraging.event.ResetTokenDistributionRequest; -import edu.asu.commons.foraging.event.ShowImposedStrategyRequest; -import edu.asu.commons.foraging.event.TrustGameResultsClientEvent; import edu.asu.commons.foraging.model.ClientData; import edu.asu.commons.foraging.model.Direction; +import edu.asu.commons.foraging.rules.Strategy; import edu.asu.commons.foraging.rules.iu.ForagingStrategy; import edu.asu.commons.net.Identifier; import edu.asu.commons.ui.HtmlEditorPane; @@ -888,18 +887,10 @@ showInstructionsPanel(); } - public void updateDebriefingWith(TrustGameResultsClientEvent event) { - // FIXME: currently hard coded to always show exit instructions in this case - // should change this to either have an explicit show exit instructions fired off by the - // facilitator or figure out a cleaner way of distinguishing between "we have to wait for - // some final calculation to occur before showing the final debriefing + exit instructions" - showDebriefing(event.getClientData(), true); - } - - public void showImposedStrategy(final ShowImposedStrategyRequest request) { + public void showImposedStrategy(final Strategy strategy) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - setInstructions(dataModel.getRoundConfiguration().getImposedStrategyInstructions(request.getStrategy())); + setInstructions(dataModel.getRoundConfiguration().getImposedStrategyInstructions(strategy)); } }); } https://bitbucket.org/virtualcommons/foraging/changeset/570aceee8fb0/ changeset: 570aceee8fb0 user: alllee date: 2012-02-28 01:58:39 summary: replacing client data map with ServerDataModel so we can integrate it with displayDebriefing without changes. affected #: 1 file diff -r e181dac33964d2d9000b5a798a4d27aaa215dd78 -r 570aceee8fb08f54b13446d382ec8106b9ddc9aa src/main/java/edu/asu/commons/foraging/event/FacilitatorSanctionUpdateEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/FacilitatorSanctionUpdateEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/FacilitatorSanctionUpdateEvent.java @@ -1,30 +1,26 @@ package edu.asu.commons.foraging.event; -import java.util.Map; - import edu.asu.commons.event.AbstractEvent; -import edu.asu.commons.foraging.model.ClientData; +import edu.asu.commons.foraging.model.ServerDataModel; import edu.asu.commons.net.Identifier; public class FacilitatorSanctionUpdateEvent extends AbstractEvent { private static final long serialVersionUID = 1L; - private final Map<Identifier, ClientData> clientDataMap; - private final boolean lastRound; + private final ServerDataModel serverDataModel; - public FacilitatorSanctionUpdateEvent(Identifier id, Map<Identifier, ClientData> clientDataMap, boolean lastRound) { + public FacilitatorSanctionUpdateEvent(Identifier id, ServerDataModel serverDataModel) { super(id); - this.clientDataMap = clientDataMap; - this.lastRound = lastRound; + this.serverDataModel = serverDataModel; } public boolean isLastRound() { - return lastRound; + return serverDataModel.isLastRound(); } - public Map<Identifier, ClientData> getClientDataMap() { - return clientDataMap; - } + public ServerDataModel getServerDataModel() { + return serverDataModel; + } } https://bitbucket.org/virtualcommons/foraging/changeset/6383bdd193b2/ changeset: 6383bdd193b2 user: alllee date: 2012-02-28 01:58:58 summary: adding imposed strategy to group data model affected #: 1 file diff -r 570aceee8fb08f54b13446d382ec8106b9ddc9aa -r 6383bdd193b2b09faf95334074853090d8691162 src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java --- a/src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java +++ b/src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java @@ -25,6 +25,7 @@ import edu.asu.commons.foraging.event.SynchronizeClientEvent; import edu.asu.commons.foraging.event.TokenCollectedEvent; import edu.asu.commons.foraging.event.UnlockResourceRequest; +import edu.asu.commons.foraging.rules.Strategy; import edu.asu.commons.foraging.rules.iu.ForagingStrategy; import edu.asu.commons.foraging.ui.Circle; import edu.asu.commons.net.Identifier; @@ -68,6 +69,7 @@ private EnforcementMechanism activeEnforcementMechanism = EnforcementMechanism.NONE; private SanctionMechanism activeSanctionMechanism = SanctionMechanism.NONE; private RegulationData activeRegulation; + private Strategy imposedStrategy; private List<ClientData> waitingMonitors; @@ -813,4 +815,12 @@ return serverDataModel.getExperimentConfiguration(); } + public Strategy getImposedStrategy() { + return imposedStrategy; + } + + public void setImposedStrategy(Strategy imposedStrategy) { + this.imposedStrategy = imposedStrategy; + } + } https://bitbucket.org/virtualcommons/foraging/changeset/1450271cae0f/ changeset: 1450271cae0f user: alllee date: 2012-02-28 01:59:19 summary: removing defunct event, adding comments affected #: 2 files diff -r 6383bdd193b2b09faf95334074853090d8691162 -r 1450271cae0fcddcbcf17383d826f9b1155d776e src/main/java/edu/asu/commons/foraging/event/TrustGameResultsClientEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/TrustGameResultsClientEvent.java +++ /dev/null @@ -1,31 +0,0 @@ -package edu.asu.commons.foraging.event; - -import edu.asu.commons.event.AbstractEvent; -import edu.asu.commons.foraging.model.ClientData; -import edu.asu.commons.foraging.model.GroupDataModel; -import edu.asu.commons.foraging.model.TrustGameResult; - -/** - * Used to update clients with their trust game log. - */ -public class TrustGameResultsClientEvent extends AbstractEvent { - private static final long serialVersionUID = -9129989958983083574L; - - private final ClientData clientData; - private final TrustGameResult trustGameResult; - - public TrustGameResultsClientEvent(ClientData clientData, TrustGameResult result) { - super(clientData.getId(), result.getLog()); - this.clientData = clientData; - this.trustGameResult = result; - } - public GroupDataModel getGroupDataModel() { - return clientData.getGroupDataModel(); - } - public ClientData getClientData() { - return clientData; - } - public TrustGameResult getTrustGameResult() { - return trustGameResult; - } -} diff -r 6383bdd193b2b09faf95334074853090d8691162 -r 1450271cae0fcddcbcf17383d826f9b1155d776e src/main/java/edu/asu/commons/foraging/event/TrustGameSubmissionEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/TrustGameSubmissionEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/TrustGameSubmissionEvent.java @@ -3,6 +3,13 @@ import edu.asu.commons.event.AbstractEvent; import edu.asu.commons.net.Identifier; +/** + * $Id$ + * + * Server to facilitator notification that wraps a participant's TrustGameSubmissionRequest. + * @author alllee + * + */ public class TrustGameSubmissionEvent extends AbstractEvent { private static final long serialVersionUID = 1957461200448076811L; 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. |
From: Bitbucket <com...@bi...> - 2012-02-27 22:53:28
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/95b51228f4b7/ changeset: 95b51228f4b7 branch: stable user: alllee date: 2012-02-27 23:53:22 summary: merging imposed treatment support for indiana experiments from default affected #: 24 files diff -r 9305b20c0d8b45612903fe086e961e20bf743220 -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 pom.xml --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ <groupId>edu.asu.commons</groupId><artifactId>foraging</artifactId><packaging>jar</packaging> - <version>1.0-SNAPSHOT</version> + <version>1.1-SNAPSHOT</version><name>foraging</name><url>http://commons.asu.edu/foraging</url><properties> diff -r 9305b20c0d8b45612903fe086e961e20bf743220 -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 src/main/java/edu/asu/commons/foraging/client/ForagingClient.java --- a/src/main/java/edu/asu/commons/foraging/client/ForagingClient.java +++ b/src/main/java/edu/asu/commons/foraging/client/ForagingClient.java @@ -33,6 +33,7 @@ import edu.asu.commons.foraging.event.RoundStartedEvent; import edu.asu.commons.foraging.event.RuleSelectedUpdateEvent; import edu.asu.commons.foraging.event.RuleVoteRequest; +import edu.asu.commons.foraging.event.ShowImposedStrategyRequest; import edu.asu.commons.foraging.event.ShowSurveyInstructionsRequest; import edu.asu.commons.foraging.event.ShowTrustGameRequest; import edu.asu.commons.foraging.event.ShowVoteScreenRequest; @@ -161,6 +162,11 @@ getGameWindow().showTrustGame(); } }); + addEventProcessor(new EventTypeProcessor<ShowImposedStrategyRequest>(ShowImposedStrategyRequest.class) { + @Override public void handle(ShowImposedStrategyRequest request) { + getGameWindow2D().showImposedStrategy(request); + } + }); addEventProcessor(new EventTypeProcessor<ShowVotingInstructionsRequest>(ShowVotingInstructionsRequest.class) { public void handle(ShowVotingInstructionsRequest request) { getGameWindow2D().showInitialVotingInstructions(); diff -r 9305b20c0d8b45612903fe086e961e20bf743220 -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 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 @@ -20,6 +20,7 @@ import edu.asu.commons.foraging.model.EnforcementMechanism; import edu.asu.commons.foraging.model.ResourceDispenser; import edu.asu.commons.foraging.model.ServerDataModel; +import edu.asu.commons.foraging.rules.Strategy; import edu.asu.commons.foraging.rules.iu.ForagingStrategy; import edu.asu.commons.foraging.rules.iu.ForagingStrategyNomination; import edu.asu.commons.net.Identifier; @@ -846,4 +847,10 @@ return getProperty("survey-confirmation-message", "Please make sure you have completed the survey before continuing. Have you completed the survey?"); } + + public String getImposedStrategyInstructions(Strategy strategy) { + ST st = createStringTemplate(getProperty("imposed-strategy-instructions")); + st.add("strategy", strategy); + return st.render(); + } } diff -r 9305b20c0d8b45612903fe086e961e20bf743220 -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java @@ -119,7 +119,7 @@ else { targetStringBuilder.append(request.getTarget()); } - String line = String.format("%s, %s, %s, %s", savedRoundData.toSecondString(event), sourceId, targetStringBuilder.toString(), message); + String line = String.format("%s, %s, %s, %s, Chat event", savedRoundData.toSecondString(event), sourceId, targetStringBuilder.toString(), message); System.err.println(line); writer.println(line); } diff -r 9305b20c0d8b45612903fe086e961e20bf743220 -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 src/main/java/edu/asu/commons/foraging/event/ImposeStrategyEvent.java --- /dev/null +++ b/src/main/java/edu/asu/commons/foraging/event/ImposeStrategyEvent.java @@ -0,0 +1,29 @@ +package edu.asu.commons.foraging.event; + +import edu.asu.commons.event.AbstractPersistableEvent; +import edu.asu.commons.event.FacilitatorRequest; +import edu.asu.commons.foraging.rules.Strategy; +import edu.asu.commons.net.Identifier; + +/** + * $Id$ + * Notifies the server of a facilitator imposed strategy. + * + * @author alllee + */ +public class ImposeStrategyEvent extends AbstractPersistableEvent implements FacilitatorRequest { + + private static final long serialVersionUID = -7231412845435362871L; + + private final Strategy strategy; + + public ImposeStrategyEvent(Identifier id, Strategy strategy) { + super(id, "Imposed strategy: " + strategy); + this.strategy = strategy; + } + + public Strategy getStrategy() { + return strategy; + } + +} diff -r 9305b20c0d8b45612903fe086e961e20bf743220 -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 src/main/java/edu/asu/commons/foraging/event/ShowImposedStrategyRequest.java --- /dev/null +++ b/src/main/java/edu/asu/commons/foraging/event/ShowImposedStrategyRequest.java @@ -0,0 +1,28 @@ +package edu.asu.commons.foraging.event; + +import edu.asu.commons.event.AbstractEvent; +import edu.asu.commons.event.ShowRequest; +import edu.asu.commons.foraging.rules.Strategy; +import edu.asu.commons.net.Identifier; + +public class ShowImposedStrategyRequest extends AbstractEvent implements ShowRequest<ShowImposedStrategyRequest> { + + private static final long serialVersionUID = -6046837892041909032L; + + private final Strategy strategy; + + public ShowImposedStrategyRequest(Identifier id, Strategy strategy) { + super(id); + this.strategy = strategy; + } + + @Override + public ShowImposedStrategyRequest clone(Identifier id) { + return new ShowImposedStrategyRequest(id, strategy); + } + + public Strategy getStrategy() { + return strategy; + } + +} diff -r 9305b20c0d8b45612903fe086e961e20bf743220 -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 src/main/java/edu/asu/commons/foraging/facilitator/Facilitator.java --- a/src/main/java/edu/asu/commons/foraging/facilitator/Facilitator.java +++ b/src/main/java/edu/asu/commons/foraging/facilitator/Facilitator.java @@ -22,7 +22,9 @@ import edu.asu.commons.foraging.event.FacilitatorEndRoundEvent; import edu.asu.commons.foraging.event.FacilitatorSanctionUpdateEvent; import edu.asu.commons.foraging.event.FacilitatorUpdateEvent; +import edu.asu.commons.foraging.event.ImposeStrategyEvent; import edu.asu.commons.foraging.event.QuizCompletedEvent; +import edu.asu.commons.foraging.event.ShowImposedStrategyRequest; import edu.asu.commons.foraging.event.ShowSurveyInstructionsRequest; import edu.asu.commons.foraging.event.ShowTrustGameRequest; import edu.asu.commons.foraging.event.ShowVoteScreenRequest; @@ -30,6 +32,7 @@ import edu.asu.commons.foraging.event.TrustGameResultsFacilitatorEvent; import edu.asu.commons.foraging.event.TrustGameSubmissionEvent; import edu.asu.commons.foraging.model.ServerDataModel; +import edu.asu.commons.foraging.rules.Strategy; /** * $Id$ @@ -42,16 +45,17 @@ private ServerDataModel serverDataModel; private FacilitatorWindow facilitatorWindow; private boolean experimentRunning = false; + private Strategy imposedStrategy; private Facilitator() { this(new ServerConfiguration()); } - @SuppressWarnings("rawtypes") public Facilitator(ServerConfiguration configuration) { super(configuration); } - + + @SuppressWarnings("rawtypes") void createFacilitatorWindow(Dimension dimension) { facilitatorWindow = new FacilitatorWindow(dimension, this); if (getId() == null) { @@ -224,4 +228,26 @@ this.serverDataModel = serverGameState; } + public void sendImposeStrategyEvent(Strategy strategy) { + if (imposedStrategy == strategy) { + facilitatorWindow.addMessage(strategy + " has already been imposed."); + return; + } + this.imposedStrategy = strategy; + facilitatorWindow.addMessage("sending imposed strategy: " + strategy); + transmit(new ImposeStrategyEvent(getId(), strategy)); + } + + public Strategy getImposedStrategy() { + return imposedStrategy; + } + + public void sendShowImposedStrategy() { + if (imposedStrategy == null) { + facilitatorWindow.addMessage("No imposed strategy selected, please select a strategy first."); + return; + } + transmit(new ShowImposedStrategyRequest(getId(), imposedStrategy)); + } + } diff -r 9305b20c0d8b45612903fe086e961e20bf743220 -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java --- a/src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java +++ b/src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java @@ -39,10 +39,16 @@ import edu.asu.commons.foraging.event.TrustGameSubmissionEvent; import edu.asu.commons.foraging.model.ClientData; import edu.asu.commons.foraging.model.ServerDataModel; +import edu.asu.commons.foraging.rules.iu.ForagingStrategy; import edu.asu.commons.net.Identifier; import edu.asu.commons.ui.HtmlEditorPane; import edu.asu.commons.ui.UserInterfaceUtils; +/** + * $Id$ + * + */ +@SuppressWarnings("unused") public class FacilitatorWindow extends JPanel { private static final String JAVAX_JNLP_CLIPBOARD_SERVICE = "javax.jnlp.ClipboardService"; @@ -71,13 +77,12 @@ private JMenuItem startChatMenuItem; private JMenuItem showTrustGameMenuItem; - @SuppressWarnings("unused") private JMenuItem showVotingInstructionsMenuItem; - @SuppressWarnings("unused") private JMenuItem showVoteScreenMenuItem; - @SuppressWarnings("unused") private JMenuItem showSurveyInstructionsMenuItem; - + private JMenuItem showExitInstructionsMenuItem; + private JMenuItem imposeStrategyMenuItem; + private HtmlEditorPane messageEditorPane; private StringBuilder instructionsBuilder; @@ -86,16 +91,11 @@ private ClipboardService clipboardService; - private JMenuItem showExitInstructionsMenuItem; public FacilitatorWindow(Dimension dimension, Facilitator facilitator) { this.facilitator = facilitator; initGuiComponents(); createMenu(); - // FIXME: only applicable for standalone java app version - also - // seems to be causing a NPE for some reason - // centerOnScreen(); - // frame.setVisible(true); } public void initializeReplay() { @@ -110,8 +110,7 @@ * This method gets called after the end of each round */ public void displayInstructions() { - - // repaint(); + } /* @@ -203,6 +202,23 @@ facilitator.sendShowVoteScreenRequest(); } }); + imposeStrategyMenuItem = createMenuItem(menu, "Select imposed strategy", new ActionListener() { + public void actionPerformed(ActionEvent e) { + ForagingStrategy selection = (ForagingStrategy) JOptionPane.showInputDialog(FacilitatorWindow.this, "Select the strategy to impose:\n", + "Impose Strategy", + JOptionPane.QUESTION_MESSAGE, + null, + ForagingStrategy.values(), + ForagingStrategy.NONE + ); + facilitator.sendImposeStrategyEvent(selection); + } + }); + createMenuItem(menu, "Show imposed strategy", new ActionListener() { + public void actionPerformed(ActionEvent e) { + facilitator.sendShowImposedStrategy(); + } + }); menuBar.add(menu); // survey menu diff -r 9305b20c0d8b45612903fe086e961e20bf743220 -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java --- a/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java +++ b/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java @@ -37,7 +37,7 @@ import edu.asu.commons.foraging.event.TokenMovedEvent; import edu.asu.commons.foraging.event.TokensMovedEvent; import edu.asu.commons.foraging.event.UnlockResourceRequest; -import edu.asu.commons.foraging.graphics.FractalTerrain; +import edu.asu.commons.foraging.rules.Strategy; import edu.asu.commons.net.Identifier; /** @@ -53,15 +53,13 @@ private static final long serialVersionUID = 8166812955398387600L; + private static final NumberFormat CURRENCY_FORMATTER = NumberFormat.getCurrencyInstance(); + private transient Logger logger = Logger.getLogger( getClass().getName() ); + private transient Random random = new Random(); + private transient boolean dirty = false; - private final static NumberFormat CURRENCY_FORMATTER = NumberFormat.getCurrencyInstance(); - - private transient Random random = new Random(); - - private transient FractalTerrain terrain; - - private transient boolean dirty = false; + private Strategy imposedStrategy; // Maps client Identifiers to the GroupDataModel that the client belongs to private final Map<Identifier, GroupDataModel> clientsToGroups = new HashMap<Identifier, GroupDataModel>(); @@ -208,14 +206,6 @@ return new Point(x, y); } - public FractalTerrain getTerrain() { - return terrain; - } - - public void setTerrain(FractalTerrain terrain) { - this.terrain = terrain; - } - public void clear() { // XXX: we no longer remove the Groups from the ServerGameState since we want persistent groups. // This should be configurable? @@ -469,4 +459,12 @@ return new ArrayList<Identifier>(clientsToGroups.keySet()); } + + public Strategy getImposedStrategy() { + return imposedStrategy; + } + + public void setImposedStrategy(Strategy imposedStrategy) { + this.imposedStrategy = imposedStrategy; + } } diff -r 9305b20c0d8b45612903fe086e961e20bf743220 -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 src/main/java/edu/asu/commons/foraging/rules/Strategy.java --- /dev/null +++ b/src/main/java/edu/asu/commons/foraging/rules/Strategy.java @@ -0,0 +1,14 @@ +package edu.asu.commons.foraging.rules; + +import java.io.Serializable; + +/** + * $Id$ + * + * Marker interface: Governance strategies for managing the resource. + * + * @author alllee + */ +public interface Strategy extends Serializable { + +} diff -r 9305b20c0d8b45612903fe086e961e20bf743220 -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 src/main/java/edu/asu/commons/foraging/rules/iu/ForagingStrategy.java --- a/src/main/java/edu/asu/commons/foraging/rules/iu/ForagingStrategy.java +++ b/src/main/java/edu/asu/commons/foraging/rules/iu/ForagingStrategy.java @@ -1,5 +1,7 @@ package edu.asu.commons.foraging.rules.iu; +import edu.asu.commons.foraging.rules.Strategy; + /** * $Id$ * @@ -8,9 +10,9 @@ * @author <a href='mailto:all...@as...'>Allen Lee</a> * @version $Rev$ */ -public enum ForagingStrategy { - // FIXME: hard coded for 4 minute rounds, but templatizing this text is a bit of overkill at the moment unless - // we move this over to the configuration. +public enum ForagingStrategy implements Strategy { + // FIXME: hard coded for 4 minute rounds, but templatizing this text is a bit of overkill at the moment + // figure out how best to move the construction of the description message into the configuration. WAIT_ONE_MINUTE("Wait 60 seconds for the screen to fill up with tokens (there will be 180 seconds left on the timer). Then everyone collects tokens for the remaining amount of time."), COLLECT_TOKENS_AND_WAIT("Collect 40 tokens, then wait 30 seconds. Repeat this process until time runs out or the tokens are all gone."), 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."), diff -r 9305b20c0d8b45612903fe086e961e20bf743220 -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 src/main/java/edu/asu/commons/foraging/server/ForagingServer.java --- a/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java +++ b/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java @@ -48,6 +48,7 @@ import edu.asu.commons.foraging.event.FacilitatorUpdateEvent; import edu.asu.commons.foraging.event.HarvestFruitRequest; import edu.asu.commons.foraging.event.HarvestResourceRequest; +import edu.asu.commons.foraging.event.ImposeStrategyEvent; import edu.asu.commons.foraging.event.LockResourceEvent; import edu.asu.commons.foraging.event.LockResourceRequest; import edu.asu.commons.foraging.event.PostRoundSanctionRequest; @@ -580,6 +581,18 @@ } } }); + addEventProcessor(new EventTypeProcessor<ImposeStrategyEvent>(ImposeStrategyEvent.class) { + @Override + public void handle(ImposeStrategyEvent event) { + if (! event.getId().equals(facilitatorId)) { + sendFacilitatorMessage("Ignoring request to impose strategy " + event); + return; + } + persister.store(event); + serverDataModel.setImposedStrategy(event.getStrategy()); + sendFacilitatorMessage("Server has imposed strategy: " + event.getStrategy()); + } + }); addEventProcessor(new EventTypeProcessor<ShowRequest>(ShowRequest.class, true) { @Override public void handle(ShowRequest request) { diff -r 9305b20c0d8b45612903fe086e961e20bf743220 -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 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 @@ -54,6 +54,7 @@ import edu.asu.commons.foraging.event.QuizResponseEvent; import edu.asu.commons.foraging.event.RealTimeSanctionRequest; import edu.asu.commons.foraging.event.ResetTokenDistributionRequest; +import edu.asu.commons.foraging.event.ShowImposedStrategyRequest; import edu.asu.commons.foraging.event.TrustGameResultsClientEvent; import edu.asu.commons.foraging.model.ClientData; import edu.asu.commons.foraging.model.Direction; @@ -895,5 +896,13 @@ showDebriefing(event.getClientData(), true); } + public void showImposedStrategy(final ShowImposedStrategyRequest request) { + SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { + setInstructions(dataModel.getRoundConfiguration().getImposedStrategyInstructions(request.getStrategy())); + } + }); + } + } diff -r 9305b20c0d8b45612903fe086e961e20bf743220 -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 src/main/resources/configuration/iu/2011/imposed/round0.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed/round0.xml @@ -0,0 +1,103 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="resource-width">13</entry> +<entry key="resource-depth">13</entry> +<entry key="practice-round">true</entry> +<entry key="private-property">true</entry> +<entry key="duration">240</entry> + +<entry key="quiz">true</entry> +<entry key="q1">C</entry> +<entry key="q2">B</entry> + +<entry key='instructions'> +<![CDATA[ +<h2>Practice Round Instructions</h2> +<hr> +<p> + Once everyone has finished the quiz, we will start a practice round of the token + task. +</p> +<p> + During the practice round, you will have {duration} to practice with the + experimental environment. The decisions you make in this round will NOT + influence your earnings. At the beginning of the practice round + {initialDistribution} of the cells are occupied with green tokens. The + environment is a {self.resourceWidth} x {self.resourceDepth} grid of cells. +</p> +<p> +During this practice round, and <b>only during</b> this practice round, you are able +to reset the tokens displayed on the screen. When you push the <b>R</b> key +you will reset the distribution of the tokens to randomly occupying +{initialDistribution} of the cells with green tokens. +</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> + +<entry key="quiz-instructions"> +<![CDATA[ +<h2>Quiz</h2> +<hr> +<p> + In a moment, you will do a practice round of the token task. Before we go to + the practice round, answer the following questions to make sure you understand + the instructions. You will earn {quizCorrectAnswerReward} for each correct answer. +</p> +<br><br> +<form> +<span class='q1'>Q1. Which of these statements is NOT correct?</span><br> +<input type="radio" name="q1" value="A">A. Your decisions of where to collect tokens affects the regeneration of tokens.<br> +<input type="radio" name="q1" value="B">B. When you have collected all tokens on the screen, no new tokens will appear.<br> +<input type="radio" name="q1" value="C">C. Tokens grow from the middle of the screen.<br> +<input type="radio" name="q1" value="D">D. To collect a token you need to press the space bar while your yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"></img> is on a cell with a token.<br> +<br><br> +<span class='q2'>Q2. Which sequence of situations is not possible?</span><br> +<img src="@CODEBASE_URL@/images/question2.jpg"></img><br> +<input type="radio" name="q2" value="A">A<br> +<input type="radio" name="q2" value="B">B<br> +<input type="radio" name="q2" value="C">C<br> +<input type="submit" name="submit" value="Submit"><br> +</form> +]]> +</entry> +<entry key='quiz-results'> + <![CDATA[ + <h2>Quiz Results</h2> + <hr> + <p> + {if (allCorrect)} + You have answered all the questions correctly and earned <b>{totalQuizEarnings}</b>. + {else} + You answered {numberCorrect} out of {totalQuestions} questions correctly + and earned <b>{totalQuizEarnings}</b>. Questions you've answered + incorrectly are highlighted in red. Please see below for more details. + {endif} + </p> + <hr> +<form> +<span class='q1'>Q1. Which of these statements is NOT correct?</span><br> + <b>{incorrect_q1} + In this question, "A", "B", and "D" are all true. "C" is false. Tokens only + regenerate when there are other tokens present in their immediately neighboring + cells. They do not spontaneously generate from the middle of the screen. + </b> +<br> +A. Your decisions of where to collect tokens affects the regeneration of tokens.<br> +B. When you have collected all tokens on the screen, no new tokens will appear.<br> +C. Tokens grow from the middle of the screen.<br> +D. To collect a token you need to press the space bar while your yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"></img> is on a cell with a token.<br> +<br> +<span class='q2'>Q2. Which sequence of situations is not possible?</span><br> + <b> + {incorrect_q2} + In this question, sequence "B" is not possible. Tokens cannot regenerate on an empty screen as shown in sequence B. + </b> + <br> +<img src="@CODEBASE_URL@/images/question2.jpg"></img><br> +</form> + ]]> +</entry> +</properties> diff -r 9305b20c0d8b45612903fe086e961e20bf743220 -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 src/main/resources/configuration/iu/2011/imposed/round1.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed/round1.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="duration">240</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Instructions for Round {self.roundNumber}</h3> +<hr> +<p> + The first round of the experiment will begin in a moment. The length of the + round is {duration}. As in the practice round you can collect green tokens. + This time you will earn <b>{dollarsPerToken}</b> for each token collected. This time + you <b>cannot</b> reset the distribution of green tokens. +</p> +<h3>Groups</h3> +<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, <b>each of you in this room has been randomly assigned to one of several +equally-sized {self.clientsPerGroup} person groups.,</b> And everyone in your group has been +randomly assigned a number from 1 to {self.clientsPerGroup}. <b>You will stay in +the same group for the entire experiment</b>, and each person's number from 1 to +{self.clientsPerGroup} will remain the same throughout the experiment. The other +members of 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 + collected at the top right corner of the screen. On the top left corner of the + screen, you will see the remaining time in the round. +</p> +<h3>Anonymity</h3> +<hr> +<p> + Because group membership was randomly assigned by the computer, neither you nor + the experimenter will be able to identify which person in the room has been + assigned to a particular group or number within a group. Your anonymity is + guaranteed. +</p> +<h3>Tokens</h3> +<hr> + <p> + Each group has its own set of token resources. + </p> +<p> +<b>Do you have any questions so far?</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> +</properties> diff -r 9305b20c0d8b45612903fe086e961e20bf743220 -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 src/main/resources/configuration/iu/2011/imposed/round2.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed/round2.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="duration">240</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> + + +<!-- enable field of vision for tokens and subjects --> +<entry key='initial-distribution'>.25</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +</properties> diff -r 9305b20c0d8b45612903fe086e961e20bf743220 -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 src/main/resources/configuration/iu/2011/imposed/round3.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed/round3.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="duration">240</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<!-- resource regrowth parameters --> +<entry key="initial-distribution">.25</entry> + +</properties> diff -r 9305b20c0d8b45612903fe086e961e20bf743220 -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 src/main/resources/configuration/iu/2011/imposed/round4.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed/round4.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> +<entry key="duration">240</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<entry key="initial-distribution">.25</entry> +<entry key='imposed-strategy'>true</entry> +<entry key="instructions"> + <![CDATA[ + <h1>Round {self.roundNumber} Instructions</h1> + <hr> +<p> +Round {self.roundNumber} is about to begin. +</p> + <p> + The length of this round is {duration}. + </p> +<h2>Strategy Reminder</h2> +<hr> + <p> + Reminder: + </p> + <ul> + <li><b>{first(self.selectedRules)}</b></li> + </ul> +<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='external-survey-enabled'>true</entry> +<entry key='survey-url'> + <![CDATA[https://qtrial.qualtrics.com/SE/?SID=SV_3jHrnndEZSM9cqM&SURVEY_ID={surveyId}]]> +</entry> + +</properties> diff -r 9305b20c0d8b45612903fe086e961e20bf743220 -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 src/main/resources/configuration/iu/2011/imposed/round5.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed/round5.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> +<entry key="duration">240</entry> + +<entry key="initial-distribution">.25</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> +</properties> diff -r 9305b20c0d8b45612903fe086e961e20bf743220 -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 src/main/resources/configuration/iu/2011/imposed/round6.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed/round6.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> +<entry key="duration">240</entry> + +<entry key="initial-distribution">.25</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> +</properties> diff -r 9305b20c0d8b45612903fe086e961e20bf743220 -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 src/main/resources/configuration/iu/2011/imposed/round7.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed/round7.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> +<entry key="duration">240</entry> + +<entry key="initial-distribution">.25</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + + +<entry key='external-survey-enabled'>true</entry> +<entry key='survey-url'> + <![CDATA[https://qtrial.qualtrics.com/SE/?SID=SV_3efXdNaJ6EXZ0S8&SURVEY_ID={surveyId}]]> +</entry> +</properties> diff -r 9305b20c0d8b45612903fe086e961e20bf743220 -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 src/main/resources/configuration/iu/2011/imposed/round8.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed/round8.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> +<entry key="duration">240</entry> + +<entry key="initial-distribution">.25</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +</properties> diff -r 9305b20c0d8b45612903fe086e961e20bf743220 -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 src/main/resources/configuration/iu/2011/imposed/round9.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed/round9.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> +<entry key="duration">240</entry> + +<entry key="initial-distribution">.25</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + + +<entry key='external-survey-enabled'>true</entry> +<entry key='survey-url'> + <![CDATA[https://qtrial.qualtrics.com/SE/?SID=SV_e8rPe7yyhue5OVm&SURVEY_ID={surveyId}]]> +</entry> + +<entry key='survey-instructions'> + <![CDATA[ + <h1>Survey</h1> + <hr> + <p> + We would like to again ask you some quick questions. Please <a href='{surveyUrl}'>click here</a> to begin the survey. + </p> + <p> + We will continue after all of the surveys have been completed by all the + participants in the room. Please press the "Continue" button at the + bottom of the screen after you have successfully completed the survey. + </p> + <p> + If you encounter any problems with the survey <b>please inform the experimenter</b>. + </p> + <br> + <form> + <input type="submit" value="Continue" name="continue"> + </form> + ]]> +</entry> + + +</properties> diff -r 9305b20c0d8b45612903fe086e961e20bf743220 -r 95b51228f4b7cf5ec51a88b81e41511a7ba50317 src/main/resources/configuration/iu/2011/imposed/server.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed/server.xml @@ -0,0 +1,367 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging experiment server configuration</comment> +<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="wait-for-participants">true</entry> +<entry key="number-of-rounds">10</entry> +<entry key='external-survey-enabled'>true</entry> +<entry key='survey-id-enabled'>true</entry> +<entry key='survey-instructions'> + <![CDATA[ + <h1>Survey</h1> + <hr> + <p> + Before we continue to the next round of the token task, we would like to ask you + some quick questions. Please <a href='{surveyUrl}'>click here</a> to + begin the survey. + </p> + <p> + We will continue with the rest of the experiment after all of the + surveys have been completed by all the participants in the room. Please + press the "Continue" button at the bottom of the screen after you have + successfully completed the survey. + </p> + <p> + If you encounter any problems with the survey <b>please inform the experimenter</b>. + </p> + <br> + <form> + <input type="submit" value="Continue" name="continue"> + </form> + ]]> +</entry> + +<entry key="facilitator-instructions"> +<![CDATA[ +<p> + This facilitator interface allows you to control the experiment. In general you + will be following a sequence similar to this: + <ol> + <li>Show instructions</li> + <li>Start round</li> + <li>After round is over + <ol> + <li>show trust game if necessary</li> + <li>start standalone chat round if necessary</li> + </ol> + </li> + <li>Goto 1.</li> + </ol> +</p> +]]> +</entry> + +<entry key="welcome-instructions"> +<![CDATA[ +<h1>Welcome</h1> +<hr> +<p> +Welcome to the experiment. The experiment will begin shortly after everyone has been +assigned a station. +<br><br> +Please <b>wait quietly</b> and <b>do not close this window, open any other + applications, or communicate with any of the other participants</b> unless you +are told to do so. +</p> +]]> +</entry> + +<entry key="general-instructions"> +<![CDATA[ +<h1>General Instructions</h1> +<h2>Your Earnings</h2> +<hr> +<p> + You have already earned {showUpPayment} by showing up at this experiment. You can +earn more, up to a maximum of about $15-$50, by participating in this experiment +which will take about an hour to an hour and a half. The amount of money you earn +depends on your decisions, as well as the decisions of your group members during the nine rounds of the experiment.</p> +<h2>The Token Task</h2> +<hr> +<p> + Today's experiment is on the computer. In the experiment, you can collect green + diamond shaped tokens <img src="@CODEBASE_URL@/images/gem-token.gif"></img>, and + you will earn <b>{dollarsPerToken}</b> for each token you collect. When the token task + begins, you will appear on the screen as a yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"></img>. + To collect a token, move your yellow dot over a green token and <b>press the + space bar</b>. If you move over a token without pressing the space bar you will + NOT collect that token. You can move either up, down, left, or right. You have + to press an arrow key for every move of your yellow dot. +</p> +<p> + Later, you will be assigned to a group. The other group members will appear as + blue dots <img src="@CODEBASE_URL@/images/gem-other.gif"></img>. + +<h2>Tokens</h2> +<hr> +<p> +The tokens that you collect have the potential to regenerate. After you have +collected a green token, a new token can re-appear on that empty cell. The rate at +which new tokens appear is dependent on the number of adjacent cells that still have +tokens. The more tokens there are in the eight cells around an empty cell, the faster +a new token will appear on that empty cell. +</p> +<p> +Tokens generate new tokens. Thus, the middle cell, which is denoted with X in Image 1 will be regenerated at a faster rate than the middle cell in Image 2. +When all neighboring cells are empty, there is no renewal. +</p> +<table width="100%"> +<tr> +<td align="center"><b>Image 1</b></td> +<td align="center"><b>Image 2</b></td> +</tr> +<tr> +<td align="center"> + <img src="@CODEBASE_URL@/images/8neighbors.jpg" alt="image 1"></img> +</td> +<td align="center"> + <img src="@CODEBASE_URL@/images/5neighbors.jpg" alt="image 2"></img> +</td> +</tr> +</table> +<p> + If you have any questions at this time, please raise your hand and someone will + come over to your station and answer it. If you have no questions, continue to + the quiz below. +</p> +]]> +</entry> + +<entry key='trust-game-instructions'> +<![CDATA[ +<h1>Instructions</h1> +<hr> +<p> + You will now participate in an exercise where you will be matched with a random + person in your group. In this exercise there are two roles, Player 1 and Player 2. + Your job is to design strategies for both Player 1 and Player 2 roles. When you + are randomly paired with another member of your group you may be selected as + Player 1 <b>or</b> Player 2. The results of randomly pairing your strategies + with the other group member's strategies will be shown to you at the <b>end of + the experiment</b>. +</p> + +<h2>How to participate</h2> +<hr> +<ol> + <li>Player 1 will first receive an endowment of one dollar and has to decide <b>how much to keep</b>. The remaining amount is <b>sent to Player 2</b>. + <li>The amount Player 1 sends to Player 2 is tripled by the system and then + given to Player 2. Player 2 must then decide <b>how much to keep</b> and <b>how much to send back to Player 1</b>. +</ol> +<p> +For example, if Player 1 sends 0 cents to Player 2, Player 1 earns 1 dollar and +Player 2 earns 0 cents. However, if Player 1 sends 1 dollar to Player 2, 3 dollars +would be sent to Player 2. Player 2 then decides to return $1.75 back to Player 1. +In this case, Player 1 earns $1.75, and Player 2 earns $1.25. +</p> +<p> +Please fill in the following form to design your strategies as Player 1 or Player 2. +<br> +<b>If you have any questions, please raise your hand. Are there any questions?</b> +</p> +]]> +</entry> + +<entry key="chat-instructions"> +<![CDATA[ +<p> +You can chat with the other participants in your group during this round. +You may discuss any aspect of the experiment with the other participants in your group with two exceptions: +<ol> + <li>You <b>may not promise side-payments after the experiment is completed or threaten anyone with any consequence after the experiment is finished</b>.</li> + <li>You <b>may not reveal your actual identity</b></li> +</ol> +We are monitoring the chat traffic while you chat. If we detect any violation of the +rules we will have to stop the the experiment and remove the group where the offense +occurred from the room. +</p> +<p> + You will see other participants labeled from A to {self.lastChatHandle} in the + chat box. You can send a chat message by typing into the textfield and pressing + the enter key. +</p> +]]> +</entry> + +<entry key="sameRoundAsPreviousInstructions"> +<![CDATA[ +<h3>Round {self.roundNumber} Instructions</h3> +<hr> +<p>Round {self.roundNumber} is the same as the previous round.</p> +<p>The length of this round is {duration}.</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> +<entry key='facilitator-debriefing'> +<![CDATA[ +<h3>Round {self.roundNumber} results</h3> +<hr> +<table border=1 cellspacing=3 cellpadding=3> +<tr> +<th>Participant</th><th>Current tokens</th><th>Current income</th><th>Quiz earnings</th><th>Trust game earnings</th><th>Total income</th> +</tr> +{clientDataList: {data | +<tr align="RIGHT"><td>{data.id}</td><td>{data.currentTokens}</td><td>{data.currentIncome}</td><td>{data.quizEarnings}</td><td>{data.trustGameEarnings}</td><td>{data.grandTotalIncome}</td></tr> +}} +</table> +]]> +</entry> +<entry key='client-debriefing'> +<![CDATA[ +<h1>{if (self.practiceRound)}Practice Round{else}Round {self.roundNumber}{endif} Results</h1> +<hr> +<ul> +<li>Tokens collected in this round: {clientData.currentTokens}</li> +<li>Income from tokens collected: {clientData.currentIncome}</li> +<li>Quiz earnings: {clientData.quizEarnings}</li> +<li>Show up payment: {showUpPayment}</li> +</ul> +{if (showExitInstructions && !clientData.trustGameLog.empty) } +<h2>Trust Game Earnings</h2> +<hr> +<ul> +{clientData.trustGameLog: {trustGameLog| +<li>Trust Game #{i}: {trustGameLog}</li> +}} +</ul> +Your total trust game earnings: <b>{clientData.trustGameEarnings}</b>. +{endif} +<h2>Total Income</h2> +<hr> +<p> +Your <b>total income</b> is <b>{clientData.grandTotalIncome}</b>. +</p> +{if (showExitInstructions)} +<h2>Final Round</h2> +<hr> + <p>This was the last round of the experiment.</p> +<h2>Payment</h2> +<hr> +<p> +Please wait quietly while we prepare your payments. When payments are ready we will +call you up one by one. Please wait until your computer number, +<b>{clientData.id}</b>, is called before coming up to receive payment. Thank you +for participating. +</p> +{endif} +]]> +</entry> +<entry key='voting-results'> + <![CDATA[ + <h1>Nomination Results</h1> + <hr> + <table border=3 cellspacing=3 cellpadding=3> + <tr><th>Strategy</th><th>Nominations</th></tr> + {nominations: { strategyNomination | + <tr bgcolor="#{if (strategyNomination.selected)}FFFFCC{else}CCCCCC{endif}"><td>{strategyNomination.strategy}</td><td>{strategyNomination.nominations}</td></tr> + }} + </table> + <h1>Selected Strategy</h1> + <hr> + {if (tiebreaker)} + <p><b>NOTE:</b> There was a tie and the selected strategy listed here was randomly selected as the winner.</p> + {endif} + <p><b> {first(selectedRules)} </b></p> + ]]> +</entry> +<entry key='initial-voting-instructions'> + <![CDATA[ +<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 have the option to implement one of five 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 {self.clientsPerGroup} people in your group can nominate one of the five + potential strategies. The single strategy that receives the most nominations + wins. +</p> +<p> + <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='waiting-room-instructions'> +<![CDATA[ +<h1>Please Wait</h1> +<hr> +<p>Please wait while the other participants complete their tasks.</p> +]]> +</entry> + +<entry key='voting-instructions'> +<![CDATA[ +<h1>Strategy Nomination Instructions</h1> +<hr> +<p> +To nominate a strategy, click the radio button that is to the right of the one you choose; 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 strategy will NOT be revealed. +Therefore, neither you nor the experimenter will know who nominated a particular +strategy. +</p> +]]> +</entry> + +<entry key='imposed-strategy-instructions'> +<![CDATA[ +<h1>Important New Instructions!</h1> +<h2>Strategy for managing how players collect tokens for the rest of the experiment</h2> +<hr> +<p> +Your group is being assigned a strategy for how you and the three other people in your group collect tokens for the rest of the experiment. +</p> +<h2>Assigned Strategy</h2> +<hr> +<p> +<b>{strategy}</b> +</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> +</properties> 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. |
From: Bitbucket <com...@bi...> - 2012-02-27 22:52:22
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/ef5f971f25bc/ changeset: ef5f971f25bc user: alllee date: 2012-02-27 23:52:03 summary: imposed strategy instructions were incomplete affected #: 2 files diff -r 20d6e5acb1d87143f4bc035fd42c23197e4aaf60 -r ef5f971f25bc237f46102f7d8ac363eb9f421a5e src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java --- a/src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java +++ b/src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java @@ -35,7 +35,6 @@ import edu.asu.commons.foraging.event.FacilitatorEndRoundEvent; import edu.asu.commons.foraging.event.FacilitatorSanctionUpdateEvent; import edu.asu.commons.foraging.event.QuizCompletedEvent; -import edu.asu.commons.foraging.event.ShowImposedStrategyRequest; import edu.asu.commons.foraging.event.TrustGameResultsFacilitatorEvent; import edu.asu.commons.foraging.event.TrustGameSubmissionEvent; import edu.asu.commons.foraging.model.ClientData; diff -r 20d6e5acb1d87143f4bc035fd42c23197e4aaf60 -r ef5f971f25bc237f46102f7d8ac363eb9f421a5e src/main/resources/configuration/iu/2011/imposed/server.xml --- a/src/main/resources/configuration/iu/2011/imposed/server.xml +++ b/src/main/resources/configuration/iu/2011/imposed/server.xml @@ -341,16 +341,27 @@ <entry key='imposed-strategy-instructions'><![CDATA[ -<h1>Important New Instructions! Strategy for managing how players collect tokens for the rest of the experiment.</h1> +<h1>Important New Instructions!</h1> +<h2>Strategy for managing how players collect tokens for the rest of the experiment</h2><hr><p> Your group is being assigned a strategy for how you and the three other people in your group collect tokens for the rest of the experiment. </p> -<h1>Assigned Strategy</h1> +<h2>Assigned Strategy</h2><hr><p><b>{strategy}</b></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></properties> 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. |
From: Bitbucket <com...@bi...> - 2012-02-27 22:29:58
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/20d6e5acb1d8/ changeset: 20d6e5acb1d8 user: alllee date: 2012-02-27 23:28:45 summary: adding imposed condition configuration affected #: 11 files diff -r 7645aa1a27b218508a1a956de0e28a5f06c0bbc3 -r 20d6e5acb1d87143f4bc035fd42c23197e4aaf60 src/main/resources/configuration/iu/2011/imposed/round0.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed/round0.xml @@ -0,0 +1,103 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="resource-width">13</entry> +<entry key="resource-depth">13</entry> +<entry key="practice-round">true</entry> +<entry key="private-property">true</entry> +<entry key="duration">240</entry> + +<entry key="quiz">true</entry> +<entry key="q1">C</entry> +<entry key="q2">B</entry> + +<entry key='instructions'> +<![CDATA[ +<h2>Practice Round Instructions</h2> +<hr> +<p> + Once everyone has finished the quiz, we will start a practice round of the token + task. +</p> +<p> + During the practice round, you will have {duration} to practice with the + experimental environment. The decisions you make in this round will NOT + influence your earnings. At the beginning of the practice round + {initialDistribution} of the cells are occupied with green tokens. The + environment is a {self.resourceWidth} x {self.resourceDepth} grid of cells. +</p> +<p> +During this practice round, and <b>only during</b> this practice round, you are able +to reset the tokens displayed on the screen. When you push the <b>R</b> key +you will reset the distribution of the tokens to randomly occupying +{initialDistribution} of the cells with green tokens. +</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> + +<entry key="quiz-instructions"> +<![CDATA[ +<h2>Quiz</h2> +<hr> +<p> + In a moment, you will do a practice round of the token task. Before we go to + the practice round, answer the following questions to make sure you understand + the instructions. You will earn {quizCorrectAnswerReward} for each correct answer. +</p> +<br><br> +<form> +<span class='q1'>Q1. Which of these statements is NOT correct?</span><br> +<input type="radio" name="q1" value="A">A. Your decisions of where to collect tokens affects the regeneration of tokens.<br> +<input type="radio" name="q1" value="B">B. When you have collected all tokens on the screen, no new tokens will appear.<br> +<input type="radio" name="q1" value="C">C. Tokens grow from the middle of the screen.<br> +<input type="radio" name="q1" value="D">D. To collect a token you need to press the space bar while your yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"></img> is on a cell with a token.<br> +<br><br> +<span class='q2'>Q2. Which sequence of situations is not possible?</span><br> +<img src="@CODEBASE_URL@/images/question2.jpg"></img><br> +<input type="radio" name="q2" value="A">A<br> +<input type="radio" name="q2" value="B">B<br> +<input type="radio" name="q2" value="C">C<br> +<input type="submit" name="submit" value="Submit"><br> +</form> +]]> +</entry> +<entry key='quiz-results'> + <![CDATA[ + <h2>Quiz Results</h2> + <hr> + <p> + {if (allCorrect)} + You have answered all the questions correctly and earned <b>{totalQuizEarnings}</b>. + {else} + You answered {numberCorrect} out of {totalQuestions} questions correctly + and earned <b>{totalQuizEarnings}</b>. Questions you've answered + incorrectly are highlighted in red. Please see below for more details. + {endif} + </p> + <hr> +<form> +<span class='q1'>Q1. Which of these statements is NOT correct?</span><br> + <b>{incorrect_q1} + In this question, "A", "B", and "D" are all true. "C" is false. Tokens only + regenerate when there are other tokens present in their immediately neighboring + cells. They do not spontaneously generate from the middle of the screen. + </b> +<br> +A. Your decisions of where to collect tokens affects the regeneration of tokens.<br> +B. When you have collected all tokens on the screen, no new tokens will appear.<br> +C. Tokens grow from the middle of the screen.<br> +D. To collect a token you need to press the space bar while your yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"></img> is on a cell with a token.<br> +<br> +<span class='q2'>Q2. Which sequence of situations is not possible?</span><br> + <b> + {incorrect_q2} + In this question, sequence "B" is not possible. Tokens cannot regenerate on an empty screen as shown in sequence B. + </b> + <br> +<img src="@CODEBASE_URL@/images/question2.jpg"></img><br> +</form> + ]]> +</entry> +</properties> diff -r 7645aa1a27b218508a1a956de0e28a5f06c0bbc3 -r 20d6e5acb1d87143f4bc035fd42c23197e4aaf60 src/main/resources/configuration/iu/2011/imposed/round1.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed/round1.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="duration">240</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Instructions for Round {self.roundNumber}</h3> +<hr> +<p> + The first round of the experiment will begin in a moment. The length of the + round is {duration}. As in the practice round you can collect green tokens. + This time you will earn <b>{dollarsPerToken}</b> for each token collected. This time + you <b>cannot</b> reset the distribution of green tokens. +</p> +<h3>Groups</h3> +<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, <b>each of you in this room has been randomly assigned to one of several +equally-sized {self.clientsPerGroup} person groups.,</b> And everyone in your group has been +randomly assigned a number from 1 to {self.clientsPerGroup}. <b>You will stay in +the same group for the entire experiment</b>, and each person's number from 1 to +{self.clientsPerGroup} will remain the same throughout the experiment. The other +members of 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 + collected at the top right corner of the screen. On the top left corner of the + screen, you will see the remaining time in the round. +</p> +<h3>Anonymity</h3> +<hr> +<p> + Because group membership was randomly assigned by the computer, neither you nor + the experimenter will be able to identify which person in the room has been + assigned to a particular group or number within a group. Your anonymity is + guaranteed. +</p> +<h3>Tokens</h3> +<hr> + <p> + Each group has its own set of token resources. + </p> +<p> +<b>Do you have any questions so far?</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> +</properties> diff -r 7645aa1a27b218508a1a956de0e28a5f06c0bbc3 -r 20d6e5acb1d87143f4bc035fd42c23197e4aaf60 src/main/resources/configuration/iu/2011/imposed/round2.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed/round2.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="duration">240</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> + + +<!-- enable field of vision for tokens and subjects --> +<entry key='initial-distribution'>.25</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +</properties> diff -r 7645aa1a27b218508a1a956de0e28a5f06c0bbc3 -r 20d6e5acb1d87143f4bc035fd42c23197e4aaf60 src/main/resources/configuration/iu/2011/imposed/round3.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed/round3.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="duration">240</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<!-- resource regrowth parameters --> +<entry key="initial-distribution">.25</entry> + +</properties> diff -r 7645aa1a27b218508a1a956de0e28a5f06c0bbc3 -r 20d6e5acb1d87143f4bc035fd42c23197e4aaf60 src/main/resources/configuration/iu/2011/imposed/round4.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed/round4.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> +<entry key="duration">240</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<entry key="initial-distribution">.25</entry> +<entry key='imposed-strategy'>true</entry> +<entry key="instructions"> + <![CDATA[ + <h1>Round {self.roundNumber} Instructions</h1> + <hr> +<p> +Round {self.roundNumber} is about to begin. +</p> + <p> + The length of this round is {duration}. + </p> +<h2>Strategy Reminder</h2> +<hr> + <p> + Reminder: + </p> + <ul> + <li><b>{first(self.selectedRules)}</b></li> + </ul> +<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='external-survey-enabled'>true</entry> +<entry key='survey-url'> + <![CDATA[https://qtrial.qualtrics.com/SE/?SID=SV_3jHrnndEZSM9cqM&SURVEY_ID={surveyId}]]> +</entry> + +</properties> diff -r 7645aa1a27b218508a1a956de0e28a5f06c0bbc3 -r 20d6e5acb1d87143f4bc035fd42c23197e4aaf60 src/main/resources/configuration/iu/2011/imposed/round5.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed/round5.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> +<entry key="duration">240</entry> + +<entry key="initial-distribution">.25</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> +</properties> diff -r 7645aa1a27b218508a1a956de0e28a5f06c0bbc3 -r 20d6e5acb1d87143f4bc035fd42c23197e4aaf60 src/main/resources/configuration/iu/2011/imposed/round6.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed/round6.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> +<entry key="duration">240</entry> + +<entry key="initial-distribution">.25</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> +</properties> diff -r 7645aa1a27b218508a1a956de0e28a5f06c0bbc3 -r 20d6e5acb1d87143f4bc035fd42c23197e4aaf60 src/main/resources/configuration/iu/2011/imposed/round7.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed/round7.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> +<entry key="duration">240</entry> + +<entry key="initial-distribution">.25</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + + +<entry key='external-survey-enabled'>true</entry> +<entry key='survey-url'> + <![CDATA[https://qtrial.qualtrics.com/SE/?SID=SV_3efXdNaJ6EXZ0S8&SURVEY_ID={surveyId}]]> +</entry> +</properties> diff -r 7645aa1a27b218508a1a956de0e28a5f06c0bbc3 -r 20d6e5acb1d87143f4bc035fd42c23197e4aaf60 src/main/resources/configuration/iu/2011/imposed/round8.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed/round8.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> +<entry key="duration">240</entry> + +<entry key="initial-distribution">.25</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +</properties> diff -r 7645aa1a27b218508a1a956de0e28a5f06c0bbc3 -r 20d6e5acb1d87143f4bc035fd42c23197e4aaf60 src/main/resources/configuration/iu/2011/imposed/round9.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed/round9.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">4</entry> +<entry key="resource-depth">26</entry> +<entry key="resource-width">26</entry> +<entry key="duration">240</entry> + +<entry key="initial-distribution">.25</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + + +<entry key='external-survey-enabled'>true</entry> +<entry key='survey-url'> + <![CDATA[https://qtrial.qualtrics.com/SE/?SID=SV_e8rPe7yyhue5OVm&SURVEY_ID={surveyId}]]> +</entry> + +<entry key='survey-instructions'> + <![CDATA[ + <h1>Survey</h1> + <hr> + <p> + We would like to again ask you some quick questions. Please <a href='{surveyUrl}'>click here</a> to begin the survey. + </p> + <p> + We will continue after all of the surveys have been completed by all the + participants in the room. Please press the "Continue" button at the + bottom of the screen after you have successfully completed the survey. + </p> + <p> + If you encounter any problems with the survey <b>please inform the experimenter</b>. + </p> + <br> + <form> + <input type="submit" value="Continue" name="continue"> + </form> + ]]> +</entry> + + +</properties> diff -r 7645aa1a27b218508a1a956de0e28a5f06c0bbc3 -r 20d6e5acb1d87143f4bc035fd42c23197e4aaf60 src/main/resources/configuration/iu/2011/imposed/server.xml --- /dev/null +++ b/src/main/resources/configuration/iu/2011/imposed/server.xml @@ -0,0 +1,356 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging experiment server configuration</comment> +<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="wait-for-participants">true</entry> +<entry key="number-of-rounds">10</entry> +<entry key='external-survey-enabled'>true</entry> +<entry key='survey-id-enabled'>true</entry> +<entry key='survey-instructions'> + <![CDATA[ + <h1>Survey</h1> + <hr> + <p> + Before we continue to the next round of the token task, we would like to ask you + some quick questions. Please <a href='{surveyUrl}'>click here</a> to + begin the survey. + </p> + <p> + We will continue with the rest of the experiment after all of the + surveys have been completed by all the participants in the room. Please + press the "Continue" button at the bottom of the screen after you have + successfully completed the survey. + </p> + <p> + If you encounter any problems with the survey <b>please inform the experimenter</b>. + </p> + <br> + <form> + <input type="submit" value="Continue" name="continue"> + </form> + ]]> +</entry> + +<entry key="facilitator-instructions"> +<![CDATA[ +<p> + This facilitator interface allows you to control the experiment. In general you + will be following a sequence similar to this: + <ol> + <li>Show instructions</li> + <li>Start round</li> + <li>After round is over + <ol> + <li>show trust game if necessary</li> + <li>start standalone chat round if necessary</li> + </ol> + </li> + <li>Goto 1.</li> + </ol> +</p> +]]> +</entry> + +<entry key="welcome-instructions"> +<![CDATA[ +<h1>Welcome</h1> +<hr> +<p> +Welcome to the experiment. The experiment will begin shortly after everyone has been +assigned a station. +<br><br> +Please <b>wait quietly</b> and <b>do not close this window, open any other + applications, or communicate with any of the other participants</b> unless you +are told to do so. +</p> +]]> +</entry> + +<entry key="general-instructions"> +<![CDATA[ +<h1>General Instructions</h1> +<h2>Your Earnings</h2> +<hr> +<p> + You have already earned {showUpPayment} by showing up at this experiment. You can +earn more, up to a maximum of about $15-$50, by participating in this experiment +which will take about an hour to an hour and a half. The amount of money you earn +depends on your decisions, as well as the decisions of your group members during the nine rounds of the experiment.</p> +<h2>The Token Task</h2> +<hr> +<p> + Today's experiment is on the computer. In the experiment, you can collect green + diamond shaped tokens <img src="@CODEBASE_URL@/images/gem-token.gif"></img>, and + you will earn <b>{dollarsPerToken}</b> for each token you collect. When the token task + begins, you will appear on the screen as a yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"></img>. + To collect a token, move your yellow dot over a green token and <b>press the + space bar</b>. If you move over a token without pressing the space bar you will + NOT collect that token. You can move either up, down, left, or right. You have + to press an arrow key for every move of your yellow dot. +</p> +<p> + Later, you will be assigned to a group. The other group members will appear as + blue dots <img src="@CODEBASE_URL@/images/gem-other.gif"></img>. + +<h2>Tokens</h2> +<hr> +<p> +The tokens that you collect have the potential to regenerate. After you have +collected a green token, a new token can re-appear on that empty cell. The rate at +which new tokens appear is dependent on the number of adjacent cells that still have +tokens. The more tokens there are in the eight cells around an empty cell, the faster +a new token will appear on that empty cell. +</p> +<p> +Tokens generate new tokens. Thus, the middle cell, which is denoted with X in Image 1 will be regenerated at a faster rate than the middle cell in Image 2. +When all neighboring cells are empty, there is no renewal. +</p> +<table width="100%"> +<tr> +<td align="center"><b>Image 1</b></td> +<td align="center"><b>Image 2</b></td> +</tr> +<tr> +<td align="center"> + <img src="@CODEBASE_URL@/images/8neighbors.jpg" alt="image 1"></img> +</td> +<td align="center"> + <img src="@CODEBASE_URL@/images/5neighbors.jpg" alt="image 2"></img> +</td> +</tr> +</table> +<p> + If you have any questions at this time, please raise your hand and someone will + come over to your station and answer it. If you have no questions, continue to + the quiz below. +</p> +]]> +</entry> + +<entry key='trust-game-instructions'> +<![CDATA[ +<h1>Instructions</h1> +<hr> +<p> + You will now participate in an exercise where you will be matched with a random + person in your group. In this exercise there are two roles, Player 1 and Player 2. + Your job is to design strategies for both Player 1 and Player 2 roles. When you + are randomly paired with another member of your group you may be selected as + Player 1 <b>or</b> Player 2. The results of randomly pairing your strategies + with the other group member's strategies will be shown to you at the <b>end of + the experiment</b>. +</p> + +<h2>How to participate</h2> +<hr> +<ol> + <li>Player 1 will first receive an endowment of one dollar and has to decide <b>how much to keep</b>. The remaining amount is <b>sent to Player 2</b>. + <li>The amount Player 1 sends to Player 2 is tripled by the system and then + given to Player 2. Player 2 must then decide <b>how much to keep</b> and <b>how much to send back to Player 1</b>. +</ol> +<p> +For example, if Player 1 sends 0 cents to Player 2, Player 1 earns 1 dollar and +Player 2 earns 0 cents. However, if Player 1 sends 1 dollar to Player 2, 3 dollars +would be sent to Player 2. Player 2 then decides to return $1.75 back to Player 1. +In this case, Player 1 earns $1.75, and Player 2 earns $1.25. +</p> +<p> +Please fill in the following form to design your strategies as Player 1 or Player 2. +<br> +<b>If you have any questions, please raise your hand. Are there any questions?</b> +</p> +]]> +</entry> + +<entry key="chat-instructions"> +<![CDATA[ +<p> +You can chat with the other participants in your group during this round. +You may discuss any aspect of the experiment with the other participants in your group with two exceptions: +<ol> + <li>You <b>may not promise side-payments after the experiment is completed or threaten anyone with any consequence after the experiment is finished</b>.</li> + <li>You <b>may not reveal your actual identity</b></li> +</ol> +We are monitoring the chat traffic while you chat. If we detect any violation of the +rules we will have to stop the the experiment and remove the group where the offense +occurred from the room. +</p> +<p> + You will see other participants labeled from A to {self.lastChatHandle} in the + chat box. You can send a chat message by typing into the textfield and pressing + the enter key. +</p> +]]> +</entry> + +<entry key="sameRoundAsPreviousInstructions"> +<![CDATA[ +<h3>Round {self.roundNumber} Instructions</h3> +<hr> +<p>Round {self.roundNumber} is the same as the previous round.</p> +<p>The length of this round is {duration}.</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> +<entry key='facilitator-debriefing'> +<![CDATA[ +<h3>Round {self.roundNumber} results</h3> +<hr> +<table border=1 cellspacing=3 cellpadding=3> +<tr> +<th>Participant</th><th>Current tokens</th><th>Current income</th><th>Quiz earnings</th><th>Trust game earnings</th><th>Total income</th> +</tr> +{clientDataList: {data | +<tr align="RIGHT"><td>{data.id}</td><td>{data.currentTokens}</td><td>{data.currentIncome}</td><td>{data.quizEarnings}</td><td>{data.trustGameEarnings}</td><td>{data.grandTotalIncome}</td></tr> +}} +</table> +]]> +</entry> +<entry key='client-debriefing'> +<![CDATA[ +<h1>{if (self.practiceRound)}Practice Round{else}Round {self.roundNumber}{endif} Results</h1> +<hr> +<ul> +<li>Tokens collected in this round: {clientData.currentTokens}</li> +<li>Income from tokens collected: {clientData.currentIncome}</li> +<li>Quiz earnings: {clientData.quizEarnings}</li> +<li>Show up payment: {showUpPayment}</li> +</ul> +{if (showExitInstructions && !clientData.trustGameLog.empty) } +<h2>Trust Game Earnings</h2> +<hr> +<ul> +{clientData.trustGameLog: {trustGameLog| +<li>Trust Game #{i}: {trustGameLog}</li> +}} +</ul> +Your total trust game earnings: <b>{clientData.trustGameEarnings}</b>. +{endif} +<h2>Total Income</h2> +<hr> +<p> +Your <b>total income</b> is <b>{clientData.grandTotalIncome}</b>. +</p> +{if (showExitInstructions)} +<h2>Final Round</h2> +<hr> + <p>This was the last round of the experiment.</p> +<h2>Payment</h2> +<hr> +<p> +Please wait quietly while we prepare your payments. When payments are ready we will +call you up one by one. Please wait until your computer number, +<b>{clientData.id}</b>, is called before coming up to receive payment. Thank you +for participating. +</p> +{endif} +]]> +</entry> +<entry key='voting-results'> + <![CDATA[ + <h1>Nomination Results</h1> + <hr> + <table border=3 cellspacing=3 cellpadding=3> + <tr><th>Strategy</th><th>Nominations</th></tr> + {nominations: { strategyNomination | + <tr bgcolor="#{if (strategyNomination.selected)}FFFFCC{else}CCCCCC{endif}"><td>{strategyNomination.strategy}</td><td>{strategyNomination.nominations}</td></tr> + }} + </table> + <h1>Selected Strategy</h1> + <hr> + {if (tiebreaker)} + <p><b>NOTE:</b> There was a tie and the selected strategy listed here was randomly selected as the winner.</p> + {endif} + <p><b> {first(selectedRules)} </b></p> + ]]> +</entry> +<entry key='initial-voting-instructions'> + <![CDATA[ +<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 have the option to implement one of five 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 {self.clientsPerGroup} people in your group can nominate one of the five + potential strategies. The single strategy that receives the most nominations + wins. +</p> +<p> + <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='waiting-room-instructions'> +<![CDATA[ +<h1>Please Wait</h1> +<hr> +<p>Please wait while the other participants complete their tasks.</p> +]]> +</entry> + +<entry key='voting-instructions'> +<![CDATA[ +<h1>Strategy Nomination Instructions</h1> +<hr> +<p> +To nominate a strategy, click the radio button that is to the right of the one you choose; 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 strategy will NOT be revealed. +Therefore, neither you nor the experimenter will know who nominated a particular +strategy. +</p> +]]> +</entry> + +<entry key='imposed-strategy-instructions'> +<![CDATA[ +<h1>Important New Instructions! Strategy for managing how players collect tokens for the rest of the experiment.</h1> +<hr> +<p> +Your group is being assigned a strategy for how you and the three other people in your group collect tokens for the rest of the experiment. +</p> +<h1>Assigned Strategy</h1> +<hr> +<p> +<b>{strategy}</b> +</p> +]]> +</entry> +</properties> 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. |
From: Bitbucket <com...@bi...> - 2012-02-27 22:16:02
|
2 new commits in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/0e3924e00421/ changeset: 0e3924e00421 user: alllee date: 2012-02-27 22:57:43 summary: persisting imposed strategy and storing it server-side on the ServerDataModel affected #: 6 files diff -r c0cc3f516d15252f7d5b375722d359105f850d59 -r 0e3924e004210a3426c1db997a507d39c2ecf4ae src/main/java/edu/asu/commons/foraging/event/ImposeStrategyEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/ImposeStrategyEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/ImposeStrategyEvent.java @@ -5,6 +5,12 @@ import edu.asu.commons.foraging.rules.Strategy; import edu.asu.commons.net.Identifier; +/** + * $Id$ + * Notifies the server of a facilitator imposed strategy. + * + * @author alllee + */ public class ImposeStrategyEvent extends AbstractPersistableEvent implements FacilitatorRequest { private static final long serialVersionUID = -7231412845435362871L; @@ -12,7 +18,7 @@ private final Strategy strategy; public ImposeStrategyEvent(Identifier id, Strategy strategy) { - super(id, strategy.toString()); + super(id, "Imposed strategy: " + strategy); this.strategy = strategy; } diff -r c0cc3f516d15252f7d5b375722d359105f850d59 -r 0e3924e004210a3426c1db997a507d39c2ecf4ae src/main/java/edu/asu/commons/foraging/facilitator/Facilitator.java --- a/src/main/java/edu/asu/commons/foraging/facilitator/Facilitator.java +++ b/src/main/java/edu/asu/commons/foraging/facilitator/Facilitator.java @@ -229,10 +229,11 @@ public void sendImposeStrategyEvent(ForagingStrategy strategy) { if (imposedStrategy == strategy) { - facilitatorWindow.addMessage(String.format("%s has already been imposed.", strategy)); + facilitatorWindow.addMessage(strategy + " has already been imposed."); return; } this.imposedStrategy = strategy; + facilitatorWindow.addMessage("sending imposed strategy: " + strategy); transmit(new ImposeStrategyEvent(getId(), strategy)); } diff -r c0cc3f516d15252f7d5b375722d359105f850d59 -r 0e3924e004210a3426c1db997a507d39c2ecf4ae src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java --- a/src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java +++ b/src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java @@ -211,7 +211,6 @@ ForagingStrategy.values(), ForagingStrategy.NONE ); - addMessage("selecting strategy: " + selection); facilitator.sendImposeStrategyEvent(selection); } }); diff -r c0cc3f516d15252f7d5b375722d359105f850d59 -r 0e3924e004210a3426c1db997a507d39c2ecf4ae src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java --- a/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java +++ b/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java @@ -37,7 +37,7 @@ import edu.asu.commons.foraging.event.TokenMovedEvent; import edu.asu.commons.foraging.event.TokensMovedEvent; import edu.asu.commons.foraging.event.UnlockResourceRequest; -import edu.asu.commons.foraging.graphics.FractalTerrain; +import edu.asu.commons.foraging.rules.Strategy; import edu.asu.commons.net.Identifier; /** @@ -53,15 +53,13 @@ private static final long serialVersionUID = 8166812955398387600L; + private static final NumberFormat CURRENCY_FORMATTER = NumberFormat.getCurrencyInstance(); + private transient Logger logger = Logger.getLogger( getClass().getName() ); + private transient Random random = new Random(); + private transient boolean dirty = false; - private final static NumberFormat CURRENCY_FORMATTER = NumberFormat.getCurrencyInstance(); - - private transient Random random = new Random(); - - private transient FractalTerrain terrain; - - private transient boolean dirty = false; + private Strategy imposedStrategy; // Maps client Identifiers to the GroupDataModel that the client belongs to private final Map<Identifier, GroupDataModel> clientsToGroups = new HashMap<Identifier, GroupDataModel>(); @@ -208,14 +206,6 @@ return new Point(x, y); } - public FractalTerrain getTerrain() { - return terrain; - } - - public void setTerrain(FractalTerrain terrain) { - this.terrain = terrain; - } - public void clear() { // XXX: we no longer remove the Groups from the ServerGameState since we want persistent groups. // This should be configurable? @@ -469,4 +459,12 @@ return new ArrayList<Identifier>(clientsToGroups.keySet()); } + + public Strategy getImposedStrategy() { + return imposedStrategy; + } + + public void setImposedStrategy(Strategy imposedStrategy) { + this.imposedStrategy = imposedStrategy; + } } diff -r c0cc3f516d15252f7d5b375722d359105f850d59 -r 0e3924e004210a3426c1db997a507d39c2ecf4ae src/main/java/edu/asu/commons/foraging/rules/Strategy.java --- a/src/main/java/edu/asu/commons/foraging/rules/Strategy.java +++ b/src/main/java/edu/asu/commons/foraging/rules/Strategy.java @@ -1,5 +1,7 @@ package edu.asu.commons.foraging.rules; +import java.io.Serializable; + /** * $Id$ * @@ -7,6 +9,6 @@ * * @author alllee */ -public interface Strategy { +public interface Strategy extends Serializable { } diff -r c0cc3f516d15252f7d5b375722d359105f850d59 -r 0e3924e004210a3426c1db997a507d39c2ecf4ae src/main/java/edu/asu/commons/foraging/server/ForagingServer.java --- a/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java +++ b/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java @@ -48,6 +48,7 @@ import edu.asu.commons.foraging.event.FacilitatorUpdateEvent; import edu.asu.commons.foraging.event.HarvestFruitRequest; import edu.asu.commons.foraging.event.HarvestResourceRequest; +import edu.asu.commons.foraging.event.ImposeStrategyEvent; import edu.asu.commons.foraging.event.LockResourceEvent; import edu.asu.commons.foraging.event.LockResourceRequest; import edu.asu.commons.foraging.event.PostRoundSanctionRequest; @@ -580,6 +581,18 @@ } } }); + addEventProcessor(new EventTypeProcessor<ImposeStrategyEvent>(ImposeStrategyEvent.class) { + @Override + public void handle(ImposeStrategyEvent event) { + if (! event.getId().equals(facilitatorId)) { + sendFacilitatorMessage("Ignoring request to impose strategy " + event); + return; + } + persister.store(event); + serverDataModel.setImposedStrategy(event.getStrategy()); + sendFacilitatorMessage("Server has imposed strategy: " + event.getStrategy()); + } + }); addEventProcessor(new EventTypeProcessor<ShowRequest>(ShowRequest.class, true) { @Override public void handle(ShowRequest request) { https://bitbucket.org/virtualcommons/foraging/changeset/7645aa1a27b2/ changeset: 7645aa1a27b2 user: alllee date: 2012-02-27 23:15:16 summary: connecting ShowImposedStrategyRequest from facilitator to client still need to create imposed-strategy-instructions StringTemplate affected #: 6 files diff -r 0e3924e004210a3426c1db997a507d39c2ecf4ae -r 7645aa1a27b218508a1a956de0e28a5f06c0bbc3 src/main/java/edu/asu/commons/foraging/client/ForagingClient.java --- a/src/main/java/edu/asu/commons/foraging/client/ForagingClient.java +++ b/src/main/java/edu/asu/commons/foraging/client/ForagingClient.java @@ -33,6 +33,7 @@ import edu.asu.commons.foraging.event.RoundStartedEvent; import edu.asu.commons.foraging.event.RuleSelectedUpdateEvent; import edu.asu.commons.foraging.event.RuleVoteRequest; +import edu.asu.commons.foraging.event.ShowImposedStrategyRequest; import edu.asu.commons.foraging.event.ShowSurveyInstructionsRequest; import edu.asu.commons.foraging.event.ShowTrustGameRequest; import edu.asu.commons.foraging.event.ShowVoteScreenRequest; @@ -161,6 +162,11 @@ getGameWindow().showTrustGame(); } }); + addEventProcessor(new EventTypeProcessor<ShowImposedStrategyRequest>(ShowImposedStrategyRequest.class) { + @Override public void handle(ShowImposedStrategyRequest request) { + getGameWindow2D().showImposedStrategy(request); + } + }); addEventProcessor(new EventTypeProcessor<ShowVotingInstructionsRequest>(ShowVotingInstructionsRequest.class) { public void handle(ShowVotingInstructionsRequest request) { getGameWindow2D().showInitialVotingInstructions(); diff -r 0e3924e004210a3426c1db997a507d39c2ecf4ae -r 7645aa1a27b218508a1a956de0e28a5f06c0bbc3 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 @@ -20,6 +20,7 @@ import edu.asu.commons.foraging.model.EnforcementMechanism; import edu.asu.commons.foraging.model.ResourceDispenser; import edu.asu.commons.foraging.model.ServerDataModel; +import edu.asu.commons.foraging.rules.Strategy; import edu.asu.commons.foraging.rules.iu.ForagingStrategy; import edu.asu.commons.foraging.rules.iu.ForagingStrategyNomination; import edu.asu.commons.net.Identifier; @@ -846,4 +847,10 @@ return getProperty("survey-confirmation-message", "Please make sure you have completed the survey before continuing. Have you completed the survey?"); } + + public String getImposedStrategyInstructions(Strategy strategy) { + ST st = createStringTemplate(getProperty("imposed-strategy-instructions")); + st.add("strategy", strategy); + return st.render(); + } } diff -r 0e3924e004210a3426c1db997a507d39c2ecf4ae -r 7645aa1a27b218508a1a956de0e28a5f06c0bbc3 src/main/java/edu/asu/commons/foraging/event/ShowImposedStrategyRequest.java --- /dev/null +++ b/src/main/java/edu/asu/commons/foraging/event/ShowImposedStrategyRequest.java @@ -0,0 +1,28 @@ +package edu.asu.commons.foraging.event; + +import edu.asu.commons.event.AbstractEvent; +import edu.asu.commons.event.ShowRequest; +import edu.asu.commons.foraging.rules.Strategy; +import edu.asu.commons.net.Identifier; + +public class ShowImposedStrategyRequest extends AbstractEvent implements ShowRequest<ShowImposedStrategyRequest> { + + private static final long serialVersionUID = -6046837892041909032L; + + private final Strategy strategy; + + public ShowImposedStrategyRequest(Identifier id, Strategy strategy) { + super(id); + this.strategy = strategy; + } + + @Override + public ShowImposedStrategyRequest clone(Identifier id) { + return new ShowImposedStrategyRequest(id, strategy); + } + + public Strategy getStrategy() { + return strategy; + } + +} diff -r 0e3924e004210a3426c1db997a507d39c2ecf4ae -r 7645aa1a27b218508a1a956de0e28a5f06c0bbc3 src/main/java/edu/asu/commons/foraging/facilitator/Facilitator.java --- a/src/main/java/edu/asu/commons/foraging/facilitator/Facilitator.java +++ b/src/main/java/edu/asu/commons/foraging/facilitator/Facilitator.java @@ -24,6 +24,7 @@ import edu.asu.commons.foraging.event.FacilitatorUpdateEvent; import edu.asu.commons.foraging.event.ImposeStrategyEvent; import edu.asu.commons.foraging.event.QuizCompletedEvent; +import edu.asu.commons.foraging.event.ShowImposedStrategyRequest; import edu.asu.commons.foraging.event.ShowSurveyInstructionsRequest; import edu.asu.commons.foraging.event.ShowTrustGameRequest; import edu.asu.commons.foraging.event.ShowVoteScreenRequest; @@ -31,7 +32,7 @@ import edu.asu.commons.foraging.event.TrustGameResultsFacilitatorEvent; import edu.asu.commons.foraging.event.TrustGameSubmissionEvent; import edu.asu.commons.foraging.model.ServerDataModel; -import edu.asu.commons.foraging.rules.iu.ForagingStrategy; +import edu.asu.commons.foraging.rules.Strategy; /** * $Id$ @@ -44,7 +45,7 @@ private ServerDataModel serverDataModel; private FacilitatorWindow facilitatorWindow; private boolean experimentRunning = false; - private ForagingStrategy imposedStrategy; + private Strategy imposedStrategy; private Facilitator() { this(new ServerConfiguration()); @@ -227,7 +228,7 @@ this.serverDataModel = serverGameState; } - public void sendImposeStrategyEvent(ForagingStrategy strategy) { + public void sendImposeStrategyEvent(Strategy strategy) { if (imposedStrategy == strategy) { facilitatorWindow.addMessage(strategy + " has already been imposed."); return; @@ -237,4 +238,16 @@ transmit(new ImposeStrategyEvent(getId(), strategy)); } + public Strategy getImposedStrategy() { + return imposedStrategy; + } + + public void sendShowImposedStrategy() { + if (imposedStrategy == null) { + facilitatorWindow.addMessage("No imposed strategy selected, please select a strategy first."); + return; + } + transmit(new ShowImposedStrategyRequest(getId(), imposedStrategy)); + } + } diff -r 0e3924e004210a3426c1db997a507d39c2ecf4ae -r 7645aa1a27b218508a1a956de0e28a5f06c0bbc3 src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java --- a/src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java +++ b/src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java @@ -35,6 +35,7 @@ import edu.asu.commons.foraging.event.FacilitatorEndRoundEvent; import edu.asu.commons.foraging.event.FacilitatorSanctionUpdateEvent; import edu.asu.commons.foraging.event.QuizCompletedEvent; +import edu.asu.commons.foraging.event.ShowImposedStrategyRequest; import edu.asu.commons.foraging.event.TrustGameResultsFacilitatorEvent; import edu.asu.commons.foraging.event.TrustGameSubmissionEvent; import edu.asu.commons.foraging.model.ClientData; @@ -202,7 +203,7 @@ facilitator.sendShowVoteScreenRequest(); } }); - imposeStrategyMenuItem = createMenuItem(menu, "Impose condition", new ActionListener() { + imposeStrategyMenuItem = createMenuItem(menu, "Select imposed strategy", new ActionListener() { public void actionPerformed(ActionEvent e) { ForagingStrategy selection = (ForagingStrategy) JOptionPane.showInputDialog(FacilitatorWindow.this, "Select the strategy to impose:\n", "Impose Strategy", @@ -214,6 +215,11 @@ facilitator.sendImposeStrategyEvent(selection); } }); + createMenuItem(menu, "Show imposed strategy", new ActionListener() { + public void actionPerformed(ActionEvent e) { + facilitator.sendShowImposedStrategy(); + } + }); menuBar.add(menu); // survey menu diff -r 0e3924e004210a3426c1db997a507d39c2ecf4ae -r 7645aa1a27b218508a1a956de0e28a5f06c0bbc3 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 @@ -54,6 +54,7 @@ import edu.asu.commons.foraging.event.QuizResponseEvent; import edu.asu.commons.foraging.event.RealTimeSanctionRequest; import edu.asu.commons.foraging.event.ResetTokenDistributionRequest; +import edu.asu.commons.foraging.event.ShowImposedStrategyRequest; import edu.asu.commons.foraging.event.TrustGameResultsClientEvent; import edu.asu.commons.foraging.model.ClientData; import edu.asu.commons.foraging.model.Direction; @@ -895,5 +896,13 @@ showDebriefing(event.getClientData(), true); } + public void showImposedStrategy(final ShowImposedStrategyRequest request) { + SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { + setInstructions(dataModel.getRoundConfiguration().getImposedStrategyInstructions(request.getStrategy())); + } + }); + } + } 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. |
From: Bitbucket <com...@bi...> - 2012-02-27 21:08:03
|
2 new commits in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/d6d5f9239f4a/ changeset: d6d5f9239f4a user: alllee date: 2012-02-27 22:04:34 summary: adding marker Strategy class and ImposeStrategyEvent for the imposed strategy condition this may break serializability with previous versions, bumping version affected #: 4 files diff -r d26df48b07e2e4513d86a61917a3ce5ee74e4583 -r d6d5f9239f4a9d1fb8f51940b95c6d136c47d892 pom.xml --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ <groupId>edu.asu.commons</groupId><artifactId>foraging</artifactId><packaging>jar</packaging> - <version>1.0-SNAPSHOT</version> + <version>1.1-SNAPSHOT</version><name>foraging</name><url>http://commons.asu.edu/foraging</url><properties> diff -r d26df48b07e2e4513d86a61917a3ce5ee74e4583 -r d6d5f9239f4a9d1fb8f51940b95c6d136c47d892 src/main/java/edu/asu/commons/foraging/event/ImposeStrategyEvent.java --- /dev/null +++ b/src/main/java/edu/asu/commons/foraging/event/ImposeStrategyEvent.java @@ -0,0 +1,22 @@ +package edu.asu.commons.foraging.event; + +import edu.asu.commons.event.AbstractPersistableEvent; +import edu.asu.commons.foraging.rules.Strategy; +import edu.asu.commons.net.Identifier; + +public class ImposeStrategyEvent extends AbstractPersistableEvent { + + private static final long serialVersionUID = -7231412845435362871L; + + private final Strategy strategy; + + public ImposeStrategyEvent(Identifier id, Strategy strategy) { + super(id, strategy.toString()); + this.strategy = strategy; + } + + public Strategy getStrategy() { + return strategy; + } + +} diff -r d26df48b07e2e4513d86a61917a3ce5ee74e4583 -r d6d5f9239f4a9d1fb8f51940b95c6d136c47d892 src/main/java/edu/asu/commons/foraging/rules/Strategy.java --- /dev/null +++ b/src/main/java/edu/asu/commons/foraging/rules/Strategy.java @@ -0,0 +1,12 @@ +package edu.asu.commons.foraging.rules; + +/** + * $Id$ + * + * Marker interface: Governance strategies for managing the resource. + * + * @author alllee + */ +public interface Strategy { + +} diff -r d26df48b07e2e4513d86a61917a3ce5ee74e4583 -r d6d5f9239f4a9d1fb8f51940b95c6d136c47d892 src/main/java/edu/asu/commons/foraging/rules/iu/ForagingStrategy.java --- a/src/main/java/edu/asu/commons/foraging/rules/iu/ForagingStrategy.java +++ b/src/main/java/edu/asu/commons/foraging/rules/iu/ForagingStrategy.java @@ -1,5 +1,7 @@ package edu.asu.commons.foraging.rules.iu; +import edu.asu.commons.foraging.rules.Strategy; + /** * $Id$ * @@ -8,9 +10,9 @@ * @author <a href='mailto:all...@as...'>Allen Lee</a> * @version $Rev$ */ -public enum ForagingStrategy { - // FIXME: hard coded for 4 minute rounds, but templatizing this text is a bit of overkill at the moment unless - // we move this over to the configuration. +public enum ForagingStrategy implements Strategy { + // FIXME: hard coded for 4 minute rounds, but templatizing this text is a bit of overkill at the moment + // figure out how best to move the construction of the description message into the configuration. WAIT_ONE_MINUTE("Wait 60 seconds for the screen to fill up with tokens (there will be 180 seconds left on the timer). Then everyone collects tokens for the remaining amount of time."), COLLECT_TOKENS_AND_WAIT("Collect 40 tokens, then wait 30 seconds. Repeat this process until time runs out or the tokens are all gone."), 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."), https://bitbucket.org/virtualcommons/foraging/changeset/c0cc3f516d15/ changeset: c0cc3f516d15 user: alllee date: 2012-02-27 22:07:45 summary: adding menu item and input dialog for facilitator to select and transmit an imposed strategy affected #: 3 files diff -r d6d5f9239f4a9d1fb8f51940b95c6d136c47d892 -r c0cc3f516d15252f7d5b375722d359105f850d59 src/main/java/edu/asu/commons/foraging/event/ImposeStrategyEvent.java --- a/src/main/java/edu/asu/commons/foraging/event/ImposeStrategyEvent.java +++ b/src/main/java/edu/asu/commons/foraging/event/ImposeStrategyEvent.java @@ -1,10 +1,11 @@ package edu.asu.commons.foraging.event; import edu.asu.commons.event.AbstractPersistableEvent; +import edu.asu.commons.event.FacilitatorRequest; import edu.asu.commons.foraging.rules.Strategy; import edu.asu.commons.net.Identifier; -public class ImposeStrategyEvent extends AbstractPersistableEvent { +public class ImposeStrategyEvent extends AbstractPersistableEvent implements FacilitatorRequest { private static final long serialVersionUID = -7231412845435362871L; diff -r d6d5f9239f4a9d1fb8f51940b95c6d136c47d892 -r c0cc3f516d15252f7d5b375722d359105f850d59 src/main/java/edu/asu/commons/foraging/facilitator/Facilitator.java --- a/src/main/java/edu/asu/commons/foraging/facilitator/Facilitator.java +++ b/src/main/java/edu/asu/commons/foraging/facilitator/Facilitator.java @@ -22,6 +22,7 @@ import edu.asu.commons.foraging.event.FacilitatorEndRoundEvent; import edu.asu.commons.foraging.event.FacilitatorSanctionUpdateEvent; import edu.asu.commons.foraging.event.FacilitatorUpdateEvent; +import edu.asu.commons.foraging.event.ImposeStrategyEvent; import edu.asu.commons.foraging.event.QuizCompletedEvent; import edu.asu.commons.foraging.event.ShowSurveyInstructionsRequest; import edu.asu.commons.foraging.event.ShowTrustGameRequest; @@ -30,6 +31,7 @@ import edu.asu.commons.foraging.event.TrustGameResultsFacilitatorEvent; import edu.asu.commons.foraging.event.TrustGameSubmissionEvent; import edu.asu.commons.foraging.model.ServerDataModel; +import edu.asu.commons.foraging.rules.iu.ForagingStrategy; /** * $Id$ @@ -42,16 +44,17 @@ private ServerDataModel serverDataModel; private FacilitatorWindow facilitatorWindow; private boolean experimentRunning = false; + private ForagingStrategy imposedStrategy; private Facilitator() { this(new ServerConfiguration()); } - @SuppressWarnings("rawtypes") public Facilitator(ServerConfiguration configuration) { super(configuration); } - + + @SuppressWarnings("rawtypes") void createFacilitatorWindow(Dimension dimension) { facilitatorWindow = new FacilitatorWindow(dimension, this); if (getId() == null) { @@ -224,4 +227,13 @@ this.serverDataModel = serverGameState; } + public void sendImposeStrategyEvent(ForagingStrategy strategy) { + if (imposedStrategy == strategy) { + facilitatorWindow.addMessage(String.format("%s has already been imposed.", strategy)); + return; + } + this.imposedStrategy = strategy; + transmit(new ImposeStrategyEvent(getId(), strategy)); + } + } diff -r d6d5f9239f4a9d1fb8f51940b95c6d136c47d892 -r c0cc3f516d15252f7d5b375722d359105f850d59 src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java --- a/src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java +++ b/src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java @@ -39,10 +39,16 @@ import edu.asu.commons.foraging.event.TrustGameSubmissionEvent; import edu.asu.commons.foraging.model.ClientData; import edu.asu.commons.foraging.model.ServerDataModel; +import edu.asu.commons.foraging.rules.iu.ForagingStrategy; import edu.asu.commons.net.Identifier; import edu.asu.commons.ui.HtmlEditorPane; import edu.asu.commons.ui.UserInterfaceUtils; +/** + * $Id$ + * + */ +@SuppressWarnings("unused") public class FacilitatorWindow extends JPanel { private static final String JAVAX_JNLP_CLIPBOARD_SERVICE = "javax.jnlp.ClipboardService"; @@ -71,13 +77,12 @@ private JMenuItem startChatMenuItem; private JMenuItem showTrustGameMenuItem; - @SuppressWarnings("unused") private JMenuItem showVotingInstructionsMenuItem; - @SuppressWarnings("unused") private JMenuItem showVoteScreenMenuItem; - @SuppressWarnings("unused") private JMenuItem showSurveyInstructionsMenuItem; - + private JMenuItem showExitInstructionsMenuItem; + private JMenuItem imposeStrategyMenuItem; + private HtmlEditorPane messageEditorPane; private StringBuilder instructionsBuilder; @@ -86,16 +91,11 @@ private ClipboardService clipboardService; - private JMenuItem showExitInstructionsMenuItem; public FacilitatorWindow(Dimension dimension, Facilitator facilitator) { this.facilitator = facilitator; initGuiComponents(); createMenu(); - // FIXME: only applicable for standalone java app version - also - // seems to be causing a NPE for some reason - // centerOnScreen(); - // frame.setVisible(true); } public void initializeReplay() { @@ -110,8 +110,7 @@ * This method gets called after the end of each round */ public void displayInstructions() { - - // repaint(); + } /* @@ -203,6 +202,19 @@ facilitator.sendShowVoteScreenRequest(); } }); + imposeStrategyMenuItem = createMenuItem(menu, "Impose condition", new ActionListener() { + public void actionPerformed(ActionEvent e) { + ForagingStrategy selection = (ForagingStrategy) JOptionPane.showInputDialog(FacilitatorWindow.this, "Select the strategy to impose:\n", + "Impose Strategy", + JOptionPane.QUESTION_MESSAGE, + null, + ForagingStrategy.values(), + ForagingStrategy.NONE + ); + addMessage("selecting strategy: " + selection); + facilitator.sendImposeStrategyEvent(selection); + } + }); menuBar.add(menu); // survey menu 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. |
From: Bitbucket <com...@bi...> - 2012-02-27 06:33:36
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/778cb995bf11/ changeset: 778cb995bf11 branch: asu-foraging-2012 user: alllee date: 2012-02-27 07:32:08 summary: adding chat event marker to chats to more easily find them in the all-data file affected #: 1 file diff -r 26d91b7a0df07259b54fa5ad43bb1df695319a92 -r 778cb995bf1154680a88c39587cd40e65e8e67ef src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java @@ -119,7 +119,7 @@ else { targetStringBuilder.append(request.getTarget()); } - String line = String.format("%s, %s, %s, %s", savedRoundData.toSecondString(event), sourceId, targetStringBuilder.toString(), message); + String line = String.format("%s, %s, %s, %s, Chat event", savedRoundData.toSecondString(event), sourceId, targetStringBuilder.toString(), message); System.err.println(line); writer.println(line); } 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. |
From: Bitbucket <com...@bi...> - 2012-02-27 06:32:26
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/d26df48b07e2/ changeset: d26df48b07e2 user: alllee date: 2012-02-27 07:32:08 summary: adding chat event marker to chats to more easily find them in the all-data file affected #: 1 file diff -r 2b64a1d5d8c92345ebcbda0726da02d0173cbbbc -r d26df48b07e2e4513d86a61917a3ce5ee74e4583 src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java @@ -119,7 +119,7 @@ else { targetStringBuilder.append(request.getTarget()); } - String line = String.format("%s, %s, %s, %s", savedRoundData.toSecondString(event), sourceId, targetStringBuilder.toString(), message); + String line = String.format("%s, %s, %s, %s, Chat event", savedRoundData.toSecondString(event), sourceId, targetStringBuilder.toString(), message); System.err.println(line); writer.println(line); } 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. |
From: Bitbucket <com...@bi...> - 2012-02-27 06:23:40
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/9305b20c0d8b/ changeset: 9305b20c0d8b branch: stable user: alllee date: 2012-02-27 07:23:37 summary: merging save file fixes from default for limited vision condition affected #: 5 files diff -r 3a0ef9068485da2d5ad7d6a5cba1f736aa3bfb8a -r 9305b20c0d8b45612903fe086e961e20bf743220 ivy.xml --- a/ivy.xml +++ b/ivy.xml @@ -5,7 +5,7 @@ <ivy-module version="2.0"><info organisation="edu.asu.commons" module="foraging"/><dependencies> - <dependency org="edu.asu.commons" name="csidex" rev="0.4-SNAPSHOT" /> + <dependency org="edu.asu.commons" name="csidex" rev="0.5-SNAPSHOT" /><dependency org="net.java.dev.jogl" name="jogl" rev="1.1.1-rc6"/><dependency org="javax.media" name="jmf" rev="2.1.1e"/><dependency org="javax.jnlp" name="javaws" rev="1.6.0_30"/> diff -r 3a0ef9068485da2d5ad7d6a5cba1f736aa3bfb8a -r 9305b20c0d8b45612903fe086e961e20bf743220 pom.xml --- a/pom.xml +++ b/pom.xml @@ -79,7 +79,7 @@ <dependency><groupId>edu.asu.commons</groupId><artifactId>csidex</artifactId> - <version>0.4-SNAPSHOT</version> + <version>0.5-SNAPSHOT</version></dependency><dependency><groupId>net.java.dev.jogl</groupId> diff -r 3a0ef9068485da2d5ad7d6a5cba1f736aa3bfb8a -r 9305b20c0d8b45612903fe086e961e20bf743220 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 @@ -177,6 +177,10 @@ return getBooleanProperty("subjects-field-of-vision", false); } + /** + * FIXME: rename for consistency, getSubjectsFieldOfVisionRadius() + * @return + */ public int getViewSubjectsRadius() { if (isSubjectsFieldOfVisionEnabled()) { return getIntProperty("view-subjects-radius", 6); diff -r 3a0ef9068485da2d5ad7d6a5cba1f736aa3bfb8a -r 9305b20c0d8b45612903fe086e961e20bf743220 src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java @@ -22,11 +22,12 @@ import edu.asu.commons.foraging.model.GroupDataModel; import edu.asu.commons.foraging.model.Resource; import edu.asu.commons.foraging.model.ServerDataModel; +import edu.asu.commons.foraging.ui.Circle; import edu.asu.commons.net.Identifier; import edu.asu.commons.util.Utils; /** - * $Id: AllDataProcessor.java 526 2010-08-06 01:25:27Z alllee $ + * $Id$ * * Serializes all data in the save file into a CSV string format, ordered by time. * @@ -44,24 +45,21 @@ @Override public void process(SavedRoundData savedRoundData, PrintWriter writer) { RoundConfiguration roundConfiguration = (RoundConfiguration) savedRoundData.getRoundParameters(); - if (roundConfiguration.is2dExperiment()) { - processData2d(savedRoundData, writer); - } - else { - processData3d(savedRoundData, writer); - } + processData(savedRoundData, writer); } - private void processData2d(SavedRoundData savedRoundData, PrintWriter writer) { - // RoundConfiguration roundConfiguration = (RoundConfiguration) savedRoundData.getRoundParameters(); + private void processData(SavedRoundData savedRoundData, PrintWriter writer) { + RoundConfiguration roundConfiguration = (RoundConfiguration) savedRoundData.getRoundParameters(); SortedSet<PersistableEvent> actions = savedRoundData.getActions(); - ServerDataModel model = (ServerDataModel) savedRoundData.getDataModel(); - Map<Identifier, ClientMovementTokenCount> clientMovementTokenCounts = ClientMovementTokenCount.createMap(model); -// List<GroupDataModel> groups = new ArrayList<GroupDataModel>(model.getGroups()); - Map<Identifier, ClientData> clientDataMap = model.getClientDataMap(); + ServerDataModel dataModel = (ServerDataModel) savedRoundData.getDataModel(); + Map<Identifier, ClientMovementTokenCount> clientMovementTokenCounts = ClientMovementTokenCount.createMap(dataModel); + Map<Identifier, ClientData> clientDataMap = dataModel.getClientDataMap(); + boolean restrictedVisibility = roundConfiguration.isSubjectsFieldOfVisionEnabled(); + dataModel.reinitialize(); for (PersistableEvent event: actions) { if (event instanceof MovementEvent) { MovementEvent movementEvent = (MovementEvent) event; + dataModel.apply(movementEvent); ClientData clientData = clientDataMap.get(event.getId()); ClientMovementTokenCount client = clientMovementTokenCounts.get(event.getId()); client.moves++; @@ -101,9 +99,27 @@ else if (event instanceof ChatRequest) { ChatRequest request = (ChatRequest) event; Identifier sourceId = request.getSource(); - Identifier targetId = request.getTarget(); + StringBuilder targetStringBuilder = new StringBuilder(); String message = request.toString(); - String line = String.format("%s, %s, %s, %s", savedRoundData.toSecondString(event), sourceId, targetId, message); + if (restrictedVisibility) { + int radius = roundConfiguration.getViewSubjectsRadius(); + ClientData clientData = clientDataMap.get(event.getId()); + GroupDataModel group = clientData.getGroupDataModel(); + Circle circle = new Circle(clientData.getPoint(), radius); + targetStringBuilder.append('['); + for (Map.Entry<Identifier, Point> entry: group.getClientPositions().entrySet()) { + Identifier id = entry.getKey(); + Point position = entry.getValue(); + if (circle.contains(position)) { + targetStringBuilder.append(id).append(','); + } + } + targetStringBuilder.setCharAt(targetStringBuilder.length() - 1, ']'); + } + else { + targetStringBuilder.append(request.getTarget()); + } + String line = String.format("%s, %s, %s, %s", savedRoundData.toSecondString(event), sourceId, targetStringBuilder.toString(), message); System.err.println(line); writer.println(line); } @@ -195,4 +211,4 @@ } } } -} \ No newline at end of file +} diff -r 3a0ef9068485da2d5ad7d6a5cba1f736aa3bfb8a -r 9305b20c0d8b45612903fe086e961e20bf743220 src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java --- a/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java +++ b/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java @@ -334,11 +334,6 @@ } } - /** - * Resets this server data model by performing the following: - * - * 1. Sets event channel to a no-op event channel. - */ public void setNullEventChannel() { super.channel = new EventTypeChannel() { public void handle(Event event) { } @@ -350,7 +345,15 @@ group.resetResourceDistribution(); } } - + /** + * Reinitializes this server data model in preparation for a replay by: + * <ol> + * <li> Sets event channel to a no-op event channel.</li> + * <li> resets all group resource distributions </li> + * <li> reinitializes all client positions </li> + * </ol> + * FIXME: may be safer to return a clone() instead? + */ public void reinitialize() { setNullEventChannel(); resetGroupResourceDistributions(); 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. |
From: Bitbucket <com...@bi...> - 2012-02-27 06:21:54
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/2b64a1d5d8c9/ changeset: 2b64a1d5d8c9 user: alllee date: 2012-02-27 07:21:49 summary: upwards fix from asu-foraging-2012, grabbing radius after restricted visibility check affected #: 1 file diff -r b6b1f49dc6a167667e39b81d297e5c5163658b86 -r 2b64a1d5d8c92345ebcbda0726da02d0173cbbbc src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java @@ -55,7 +55,6 @@ Map<Identifier, ClientMovementTokenCount> clientMovementTokenCounts = ClientMovementTokenCount.createMap(dataModel); Map<Identifier, ClientData> clientDataMap = dataModel.getClientDataMap(); boolean restrictedVisibility = roundConfiguration.isSubjectsFieldOfVisionEnabled(); - int radius = roundConfiguration.getViewSubjectsRadius(); dataModel.reinitialize(); for (PersistableEvent event: actions) { if (event instanceof MovementEvent) { @@ -103,21 +102,22 @@ StringBuilder targetStringBuilder = new StringBuilder(); String message = request.toString(); if (restrictedVisibility) { - ClientData clientData = clientDataMap.get(event.getId()); - GroupDataModel group = clientData.getGroupDataModel(); - Circle circle = new Circle(clientData.getPoint(), radius); - targetStringBuilder.append('['); - for (Map.Entry<Identifier, Point> entry: group.getClientPositions().entrySet()) { - Identifier id = entry.getKey(); - Point position = entry.getValue(); - if (circle.contains(position)) { - targetStringBuilder.append(id).append(','); - } - } - targetStringBuilder.setCharAt(targetStringBuilder.length() - 1, ']'); + int radius = roundConfiguration.getViewSubjectsRadius(); + ClientData clientData = clientDataMap.get(event.getId()); + GroupDataModel group = clientData.getGroupDataModel(); + Circle circle = new Circle(clientData.getPoint(), radius); + targetStringBuilder.append('['); + for (Map.Entry<Identifier, Point> entry: group.getClientPositions().entrySet()) { + Identifier id = entry.getKey(); + Point position = entry.getValue(); + if (circle.contains(position)) { + targetStringBuilder.append(id).append(','); + } + } + targetStringBuilder.setCharAt(targetStringBuilder.length() - 1, ']'); } else { - targetStringBuilder.append(request.getTarget()); + targetStringBuilder.append(request.getTarget()); } String line = String.format("%s, %s, %s, %s", savedRoundData.toSecondString(event), sourceId, targetStringBuilder.toString(), message); System.err.println(line); 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. |
From: Bitbucket <com...@bi...> - 2012-02-27 06:19:29
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/26d91b7a0df0/ changeset: 26d91b7a0df0 branch: asu-foraging-2012 user: alllee date: 2012-02-27 06:49:34 summary: removing 3d data processing affected #: 1 file diff -r bfe5a1ea3b53d1cba35168c48c07ae0d88fe7db7 -r 26d91b7a0df07259b54fa5ad43bb1df695319a92 src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java @@ -45,15 +45,10 @@ @Override public void process(SavedRoundData savedRoundData, PrintWriter writer) { RoundConfiguration roundConfiguration = (RoundConfiguration) savedRoundData.getRoundParameters(); - if (roundConfiguration.is2dExperiment()) { - processData2d(savedRoundData, writer); - } - else { - processData3d(savedRoundData, writer); - } + processData(savedRoundData, writer); } - private void processData2d(SavedRoundData savedRoundData, PrintWriter writer) { + private void processData(SavedRoundData savedRoundData, PrintWriter writer) { RoundConfiguration roundConfiguration = (RoundConfiguration) savedRoundData.getRoundParameters(); SortedSet<PersistableEvent> actions = savedRoundData.getActions(); ServerDataModel dataModel = (ServerDataModel) savedRoundData.getDataModel(); 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. |
From: Bitbucket <com...@bi...> - 2012-02-27 06:16:44
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/bfe5a1ea3b53/ changeset: bfe5a1ea3b53 branch: asu-foraging-2012 user: alllee date: 2012-02-27 07:16:24 summary: moving getViewSubjectsRadius after conditional check to avoid UnsupportedOperationException affected #: 1 file diff -r 8a7e72dfa1bd191d6164645be21a8521cf8abbce -r bfe5a1ea3b53d1cba35168c48c07ae0d88fe7db7 src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java @@ -60,7 +60,6 @@ Map<Identifier, ClientMovementTokenCount> clientMovementTokenCounts = ClientMovementTokenCount.createMap(dataModel); Map<Identifier, ClientData> clientDataMap = dataModel.getClientDataMap(); boolean restrictedVisibility = roundConfiguration.isSubjectsFieldOfVisionEnabled(); - int radius = roundConfiguration.getViewSubjectsRadius(); dataModel.reinitialize(); for (PersistableEvent event: actions) { if (event instanceof MovementEvent) { @@ -108,21 +107,22 @@ StringBuilder targetStringBuilder = new StringBuilder(); String message = request.toString(); if (restrictedVisibility) { - ClientData clientData = clientDataMap.get(event.getId()); - GroupDataModel group = clientData.getGroupDataModel(); - Circle circle = new Circle(clientData.getPoint(), radius); - targetStringBuilder.append('['); - for (Map.Entry<Identifier, Point> entry: group.getClientPositions().entrySet()) { - Identifier id = entry.getKey(); - Point position = entry.getValue(); - if (circle.contains(position)) { - targetStringBuilder.append(id).append(','); - } - } - targetStringBuilder.setCharAt(targetStringBuilder.length() - 1, ']'); + int radius = roundConfiguration.getViewSubjectsRadius(); + ClientData clientData = clientDataMap.get(event.getId()); + GroupDataModel group = clientData.getGroupDataModel(); + Circle circle = new Circle(clientData.getPoint(), radius); + targetStringBuilder.append('['); + for (Map.Entry<Identifier, Point> entry: group.getClientPositions().entrySet()) { + Identifier id = entry.getKey(); + Point position = entry.getValue(); + if (circle.contains(position)) { + targetStringBuilder.append(id).append(','); + } + } + targetStringBuilder.setCharAt(targetStringBuilder.length() - 1, ']'); } else { - targetStringBuilder.append(request.getTarget()); + targetStringBuilder.append(request.getTarget()); } String line = String.format("%s, %s, %s, %s", savedRoundData.toSecondString(event), sourceId, targetStringBuilder.toString(), message); System.err.println(line); @@ -216,4 +216,4 @@ } } } -} \ No newline at end of file +} 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. |
From: Bitbucket <com...@bi...> - 2012-02-27 06:14:06
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/8a7e72dfa1bd/ changeset: 8a7e72dfa1bd branch: asu-foraging-2012 user: alllee date: 2012-02-27 06:29:51 summary: keeping track of client movements and adding chat targets to all data processor - fixes issue #35 affected #: 1 file diff -r 47cf4ea41fba8a64462d34927dd8ce4d1a58213f -r 8a7e72dfa1bd191d6164645be21a8521cf8abbce src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java @@ -22,6 +22,7 @@ import edu.asu.commons.foraging.model.GroupDataModel; import edu.asu.commons.foraging.model.Resource; import edu.asu.commons.foraging.model.ServerDataModel; +import edu.asu.commons.foraging.ui.Circle; import edu.asu.commons.net.Identifier; import edu.asu.commons.util.Utils; @@ -53,15 +54,18 @@ } private void processData2d(SavedRoundData savedRoundData, PrintWriter writer) { - // RoundConfiguration roundConfiguration = (RoundConfiguration) savedRoundData.getRoundParameters(); + RoundConfiguration roundConfiguration = (RoundConfiguration) savedRoundData.getRoundParameters(); SortedSet<PersistableEvent> actions = savedRoundData.getActions(); - ServerDataModel model = (ServerDataModel) savedRoundData.getDataModel(); - Map<Identifier, ClientMovementTokenCount> clientMovementTokenCounts = ClientMovementTokenCount.createMap(model); -// List<GroupDataModel> groups = new ArrayList<GroupDataModel>(model.getGroups()); - Map<Identifier, ClientData> clientDataMap = model.getClientDataMap(); + ServerDataModel dataModel = (ServerDataModel) savedRoundData.getDataModel(); + Map<Identifier, ClientMovementTokenCount> clientMovementTokenCounts = ClientMovementTokenCount.createMap(dataModel); + Map<Identifier, ClientData> clientDataMap = dataModel.getClientDataMap(); + boolean restrictedVisibility = roundConfiguration.isSubjectsFieldOfVisionEnabled(); + int radius = roundConfiguration.getViewSubjectsRadius(); + dataModel.reinitialize(); for (PersistableEvent event: actions) { if (event instanceof MovementEvent) { MovementEvent movementEvent = (MovementEvent) event; + dataModel.apply(movementEvent); ClientData clientData = clientDataMap.get(event.getId()); ClientMovementTokenCount client = clientMovementTokenCounts.get(event.getId()); client.moves++; @@ -101,9 +105,26 @@ else if (event instanceof ChatRequest) { ChatRequest request = (ChatRequest) event; Identifier sourceId = request.getSource(); - Identifier targetId = request.getTarget(); + StringBuilder targetStringBuilder = new StringBuilder(); String message = request.toString(); - String line = String.format("%s, %s, %s, %s", savedRoundData.toSecondString(event), sourceId, targetId, message); + if (restrictedVisibility) { + ClientData clientData = clientDataMap.get(event.getId()); + GroupDataModel group = clientData.getGroupDataModel(); + Circle circle = new Circle(clientData.getPoint(), radius); + targetStringBuilder.append('['); + for (Map.Entry<Identifier, Point> entry: group.getClientPositions().entrySet()) { + Identifier id = entry.getKey(); + Point position = entry.getValue(); + if (circle.contains(position)) { + targetStringBuilder.append(id).append(','); + } + } + targetStringBuilder.setCharAt(targetStringBuilder.length() - 1, ']'); + } + else { + targetStringBuilder.append(request.getTarget()); + } + String line = String.format("%s, %s, %s, %s", savedRoundData.toSecondString(event), sourceId, targetStringBuilder.toString(), message); System.err.println(line); writer.println(line); } 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. |
From: Bitbucket <com...@bi...> - 2012-02-27 06:05:55
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/47cf4ea41fba/ changeset: 47cf4ea41fba branch: asu-foraging-2012 user: alllee date: 2012-02-27 07:05:44 summary: creating branch for asu foraging 2012 affected #: 2 files diff -r dedbf30aad77d957dd1b25dc411faa456f30c6c5 -r 47cf4ea41fba8a64462d34927dd8ce4d1a58213f src/main/java/edu/asu/commons/foraging/data/AggregateTimeIntervalProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/AggregateTimeIntervalProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/AggregateTimeIntervalProcessor.java @@ -29,7 +29,7 @@ import edu.asu.commons.util.Utils; /** - * $Id: AggregateTimeIntervalProcessor.java 526 2010-08-06 01:25:27Z alllee $ + * $Id$ * * Generates aggregate statistics * diff -r dedbf30aad77d957dd1b25dc411faa456f30c6c5 -r 47cf4ea41fba8a64462d34927dd8ce4d1a58213f src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java --- a/src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java +++ b/src/main/java/edu/asu/commons/foraging/data/AllDataProcessor.java @@ -26,7 +26,7 @@ import edu.asu.commons.util.Utils; /** - * $Id: AllDataProcessor.java 526 2010-08-06 01:25:27Z alllee $ + * $Id$ * * Serializes all data in the save file into a CSV string format, ordered by time. * 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. |