Clone wiki

ExperimentTool / A4 Steps to program an experiment

Required project : Exp Implementation


1) Create two packages for your experiment, one for the server classes, and one for the client classes:

  • edu.kit.exp.impl.YourExperimentName.server
  • edu.kit.exp.impl.YourExperimentName.client

2) Under the server package,following classes are mandatory:

  • YourExperimentNameInstitution extends Institution
  • YourExperimentNameEnvironment extends Environment
  • YourExperimentNameRoleMatcher extends RoleMatcher

For example:


public class UltimatumGameEnvironment extends Environment{}
public class UltimatumGameInstitution extends Institution<UltimatumGameEnvironment>{}
public class UltimatumGameRoleMatcher extends RoleMatcher{}

3) Under the server package, following class is optional:

  • YourExperimentNameSubjectGroupMatcher extends SubjectGroupMatcher

For example:


public class EnglishAuctionFixedGroupMatcher extends SubjectGroupMatcher {}

4) Under the client package, screens can be programmed, using

  • YourTreatmentNameScreen extends Screen

For example:


public class UltimatumGameResult extends Screen {}

5) The Institution class needs three methods to be implemented:

  • startPeriod(), processMessage(), endPeriod().
  • The startPeriod() and endPeriod() are used to specify which screen is to be displayed in the start of each period, and the end of each period, respectively.
  • The processMessage() method is used to specify the flow of the experiment, when messages are passed from the client to the server, and how the server is supposed to handle that.

6) Finally, the Environment class can be used to specify differences in parameters, across treatments.

7) The RoleMatcher class matches roles to subjects and has to be defined in every Environment. Two methods should be implemented therefore:

  • The Method setupSubjectRoles() creates the initial mapping of subjects and roles.
  • The Method “rematch()” reallocates the roles for a given period.

8) The GroupMatcher class matches subjects with roles to SubjectGroups and has to be defined in every Environment. In addition, it should contain the following two methods:

  • The method setupSubjectGroups() creates the initial mapping of subjects with roles to SubjectGroups.
  • The method rematch() reallocates the Subjects in each period, but you could also choose not to rematch, so that the groups stay just like in the first round.