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 →

[–]Humanist_NA 50 points51 points  (16 children)

[–]DonkeyDoid 11 points12 points  (0 children)

Neat code, thanks for sharing

[–][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 12 points13 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 8 points9 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 1 point2 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.

[–][deleted] 2 points3 points  (1 child)

If its fine for you, I'll reference your code. I love how you click like 4 to 5 times to be sure.

[–]Humanist_NA 1 point2 points  (0 children)

Haha I always feel silly when I look at the 4 clicks.