Add random mode
This commit is contained in:
parent
a09b5cc9d1
commit
cb5a143623
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user