Add random mode

This commit is contained in:
Dominic Zimmer 2022-10-29 15:26:12 +02:00
parent a09b5cc9d1
commit cb5a143623

View File

@ -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)