Python:
class YogaFlowHero(Skill):
def __init__(self):
super().__init__()
self.set_skill_type(3) # burst mode skill
self.mode: bool = True
self.r2 = Responder(
"Take a deep breath", "Child's Pose", "Seated forward fold",
"Lie on your back", "Rest in Savasana", "Gentle twist", "Legs up the wall"
)
self.r1 = Responder(
"Mountain Pose", "Warrior II", "Tree Pose", "Chair Pose",
"Downward Dog", "Plank", "Bridge Pose"
)
self.activeResponder = self.r1
self.onOffSwitch = OnOffSwitch()
self.timeGate = TimeGate(5)
self.onOffSwitch.setOn(Responder("begin practice", "find balance", "namaste"))
self.onOffSwitch.setOff(Responder("end session", "pause yoga", "namaste"))
self.onOffSwitch.setPause(15)
self.dripper = PercentDripper()
self.dripper.setLimit(50)
self.gamification = AXGamification()
self.isGaming = False
def input(self, ear, skin, eye):
if self.onOffSwitch.getMode(ear):
if not self.isGaming:
self.isGaming = True
self.gamification.resetCount()
if self.timeGate.isClosed():
self.gamification.increment()
self.mode = bool(random.getrandbits(1))
self.algPartsFusion(4, APShy("Inhale…" if self.mode else "Exhale…"))
self.activeResponder = self.nextResponder(self.mode)
self.timeGate.open_for_n_seconds(30)
return
if self.dripper.drip():
self.algPartsFusion(4, APShy(self.activeResponder.getAResponse()))
return
elif self.isGaming:
self.isGaming = False
self.setSimpleAlg("Session complete. Feel the peace within.")
if ear == "yoga score":
self.setSimpleAlg(f'You flowed through {self.gamification.getCounter()} sequences.')
def nextResponder(self, m):
return self.r1 if m else self.r2
def skillNotes(self, param: str) -> str:
if param == "notes":
return "Guides mindful yoga flows"
elif param == "triggers":
return "on with begin practice, off with end session"
return "Note unavailable"