Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6bb4a63

Browse files
committed
Coroutines
1 parent e257b7b commit 6bb4a63

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2292,8 +2292,8 @@ async def main_coroutine(screen):
22922292

22932293
async def random_controller(id_, moves):
22942294
while True:
2295-
move = id_, random.choice(list(D))
2296-
moves.put_nowait(move)
2295+
d = random.choice(list(D))
2296+
moves.put_nowait((id_, d))
22972297
await asyncio.sleep(random.random() / 2)
22982298

22992299
async def human_controller(screen, moves):

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2015,8 +2015,8 @@
20152015

20162016
<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">random_controller</span><span class="hljs-params">(id_, moves)</span>:</span>
20172017
<span class="hljs-keyword">while</span> <span class="hljs-keyword">True</span>:
2018-
move = id_, random.choice(list(D))
2019-
moves.put_nowait(move)
2018+
d = random.choice(list(D))
2019+
moves.put_nowait((id_, d))
20202020
<span class="hljs-keyword">await</span> asyncio.sleep(random.random() / <span class="hljs-number">2</span>)
20212021

20222022
<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">human_controller</span><span class="hljs-params">(screen, moves)</span>:</span>

0 commit comments

Comments
 (0)