From 2c8b218b1059f05a01abc2b348170121d490dfec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Wed, 4 Mar 2020 17:12:47 +0100 Subject: [PATCH] Coroutines --- README.md | 3 ++- index.html | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6a70a48..e71536b 100644 --- a/README.md +++ b/README.md @@ -2294,7 +2294,8 @@ async def random_controller(id_, moves): await asyncio.sleep(random.random() / 2) async def human_controller(screen, moves): - while (ch := screen.getch()) != 27: + while True: + ch = screen.getch() key_mappings = {259: D.n, 261: D.e, 258: D.s, 260: D.w} if ch in key_mappings: moves.put_nowait(('*', key_mappings[ch])) diff --git a/index.html b/index.html index d54bc80..05a4801 100644 --- a/index.html +++ b/index.html @@ -1990,7 +1990,8 @@ D = enum.Enum('D', 'n await asyncio.sleep(random.random() / 2) async def human_controller(screen, moves): - while (ch := screen.getch()) != 27: + while True: + ch = screen.getch() key_mappings = {259: D.n, 261: D.e, 258: D.s, 260: D.w} if ch in key_mappings: moves.put_nowait(('*', key_mappings[ch]))