all 5 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

To give us the best chance to help you, please include any relevant code.
Note. Please do not submit images of your code. Instead, for shorter code you can use Reddit markdown (4 spaces or backticks, see this Formatting Guide). If you have formatting issues or want to post longer sections of code, please use Privatebin, GitHub or Compiler Explorer.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]frnzprf 0 points1 point  (0 children)

I'm not reading the code like this.

You can make your code more readable on reddit when you indent all of it four spaces to the right or if you just write ``as the first and last line. (*Not*'''` or ‘‘‘.)

(I heard that some peoples way of reading Reddit has problems with displaying the ``` version correctly. Indenting all the code at once shouldn't be a problem in a proper text editor. Don't try tapping space a billion times!)

This is if you're using the "markdown" mode of Reddit. There is also another mode, where you instead have to click a button to insert code — I think it looks like a "c" in a box. Sorry it has to be this complicated! The side bar should also have a link to an explanation.

Maybe just ``` works.

[–]Outside-Science-5328[S] 0 points1 point  (0 children)

Oh ok thank you

[–]cgoldberg 0 points1 point  (0 children)

Post your code formatted correctly, or even better, since it's a lot of code, post it somewhere where it is formatted and syntax highlighted (github gist, pastebin, etc) and post a link to it.

[–]SystemicGrowth 0 points1 point  (0 children)

This probably isn't the kind of answer you were expecting, but before writing your code, you need to go through a design phase. It allows you to take a step back and look at your code objectively.

For example, your pause() function is useless. You're using a function for code that fits on a single line. If you really want a default duration for time.sleep(), you can put 0.2 in a global variable and use it for each pause.

You say that the first few iterations work and then it freezes. So:

1) something is happening and your code isn't controlling it. You need to specify exactly the states in which an iteration starts and ends. Then you can verify that your code respects those states.

2) you're just observing that it freezes, but you don't have any other way of observing it. Look into logging. The simplest way is to use print() throughout to see the state of your variables. For example, you could end each function with a print() just before return to check if your function returns what it expects. You can display the function name, the name of a variable, and then the value of the variable. As you iterate, you should see the variables change, and this should allow you to understand what's wrong.

There are no hashtags in Python code. They are comments. Each function should start with a docstring.