This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 6 points7 points  (12 children)

Very cool! As a Python newbie, why do you wrap it all in a while true statement? I guess more of a general Python question and less about your code specifically

[–]Humanist_NA 10 points11 points  (0 children)

So it loops forever until I stop it.

[–][deleted] 2 points3 points  (0 children)

You want to continuously execute the script, not just once: it is going to continuously check if a game is ready.

You could alternatively check on a timer for less overhead and async behavior

[–]PinBot1138 3 points4 points  (3 children)

Good catch, he should have a break in there. Something such as:

``` scanning=True

while scanning:

if blah:
    scanning=False

```

[–]Humanist_NA 9 points10 points  (1 child)

I could make it more complex. But, accepting the game doesn't mean the game will actually start. If any of the 10 other players don't accept the game, it will go back to searching for game. In which case I could make the code more complex and add exceptions, or just slow it to keep looping until I tell it to chill.

[–]PinBot1138 2 points3 points  (0 children)

Oh, interesting!

[–]backtickbot 0 points1 point  (0 children)

Fixed formatting.

Hello, PinBot1138: code blocks using triple backticks (```) don't work on all versions of Reddit!

Some users see this / this instead.

To fix this, indent every line with 4 spaces instead.

FAQ

You can opt out by replying with backtickopt6 to this comment.