diff --git a/backend/backend/arbiter.py b/backend/backend/arbiter.py index c516930..c6f2f26 100644 --- a/backend/backend/arbiter.py +++ b/backend/backend/arbiter.py @@ -204,3 +204,19 @@ async def _(get_input: InputGetter, set_output: OutputSetter): output = {button: the_input[button] for button in Button} set_output(output) + + +@arbiter.mode("random", allow_multitouch=False) +async def _(get_input: InputGetter, set_output: OutputSetter): + while True: + await asyncio.sleep(settings.democracy_vote_cycle) + + the_choice = random.choice([button for button in Button]) + + if not the_choice: + set_output(EMPTY_INPUT) + continue + + output = {button: (button == the_choice) for button in Button} + + set_output(output)