Implement anarchy mode

This commit is contained in:
Dominic Zimmer 2022-10-29 15:19:13 +02:00
parent 3b459606e4
commit a09b5cc9d1

View File

@ -186,3 +186,21 @@ async def _(get_input: InputGetter, set_output: OutputSetter):
output[choice] = True
set_output(output)
@arbiter.mode("anarchy", allow_multitouch=False)
async def _(get_input: InputGetter, set_output: OutputSetter):
while True:
await asyncio.sleep(settings.democracy_vote_cycle)
inputs: list[Input] = await get_input()
the_input = random.choice(inputs)
if not the_input:
set_output(EMPTY_INPUT)
continue
output = {button: the_input[button] for button in Button}
set_output(output)