mutwo.generators.edwards¶
Algorithms which are related to British composer Michael Edwards.
Classes:
|
Python implementation of Michael Edwards activity level algorithm. |
- class ActivityLevel(start_at=0)[source]¶
Bases:
objectPython implementation of Michael Edwards activity level algorithm.
- Parameters
start_at (int) – from which pattern per level shall be started (can be either 0, 1 or 2)
- Return type
None
Activity Levels is a concept derived from Michael Edwards. Quoting Michael Edwards, Activity Levels are an “object for determining (deterministically) on a call-by-call basis whether a process is active or not (boolean). This is determined by nine 10-element lists (actually three versions of each) of hand-coded 1s and 0s, each list representing an ‘activity-level’ (how active the process should be). The first three 10-element lists have only one 1 in them, the rest being zeros. The second three have two 1s, etc. Activity-levels of 0 and 10 would return never active and always active respectively.”.
Example:
>>> from mutwo.generators import edwards >>> activity_levels = edwards.ActivityLevel() >>> activity_levels(0) # activity level 0 will always return False False >>> activity_levels(10) # activity level 10 will always return True True >>> activity_levels(7) # activity level 7 will mostly return True True >>> tuple(activity_levels(7) for _ in range(10)) (True, False, True, True, False, True, True, False, True, True)
Methods:
__call__(level)Return current state (is active or not) of entered activity level.