Skip to content

Instantly share code, notes, and snippets.

@jessesnyder
Created January 22, 2020 04:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jessesnyder/e870f537a0e7eae4ea280f1872f4d8d2 to your computer and use it in GitHub Desktop.
Save jessesnyder/e870f537a0e7eae4ea280f1872f4d8d2 to your computer and use it in GitHub Desktop.
Experiment delegation/strategy
from . import games
def extra_parameters():
config = dlgr.config.get_config()
config.register('mexp_turn_type', six.text_type, [], False)
class MyExperiment(dlgr.experiments.Experiment):
"""Experiment that delegates turn-taking implementation based on configuration"""
def __init__(self, session):
"""Initialize the experiment."""
super(MyExperiment, self).__init__(session)
config = dlgr.config.get_config()
self.game = games.by_name(
config.get(u'mexp_turn_type', u'fixed_turns'), quorum=self.quorum
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment